Changeset 225

Show
Ignore:
Timestamp:
03/01/09 19:58:08 (18 months ago)
Author:
poillubo
Message:

* fix submenu bug in a submenu

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pycawm/menus.py

    r223 r225  
    199199        self.display.sync() 
    200200        self.can_be_closed = (x != pointer.root_x or y != pointer.root_y) 
     201        self.try_launch_submenu() 
    201202 
    202203    def get_good_menu(self, window): 
     
    324325                self.child.close() 
    325326                self.child = None 
    326             if (self.current is not None and 
    327                 self.current < len(self.elements) and 
    328                 self.elements[self.current][1] == self.sub_menu): 
    329                 if self.timer is not None: 
    330                     self.timer.cancel() 
    331                 x = self.x + self.width + 2 + self.wm.theme.menu.sub_menu.dx 
    332                 y = self.y + self.get_height(self.current) 
    333                 self.timer = Timer( 
    334                     self.wm.theme.menu.sub_menu.delay, self.delay_submenu, 
    335                     args=[self.current, self.elements[self.current][2], 
    336                           self, x, y]) 
    337                 self.timer.start() 
     327            self.try_launch_submenu() 
     328 
     329    def try_launch_submenu(self): 
     330        if (self.current is not None and 
     331            self.current < len(self.elements) and 
     332            self.elements[self.current][1] == self.sub_menu): 
     333            if self.timer is not None: 
     334                self.timer.cancel() 
     335            x = self.x + self.width + 2 + self.wm.theme.menu.sub_menu.dx 
     336            y = self.y + self.get_height(self.current) 
     337            self.timer = Timer( 
     338                self.wm.theme.menu.sub_menu.delay, self.delay_submenu, 
     339                args=[self.current, self.elements[self.current][2], 
     340                      self, x, y]) 
     341            self.timer.start() 
    338342 
    339343    def delay_submenu(self, current, fun, menu, x, y):