/[circus]/circus/modules/CircusMenus/menus.py
ViewVC logotype

Diff of /circus/modules/CircusMenus/menus.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by bskahan, Sun Nov 17 07:38:10 2002 UTC revision 1.6 by bskahan, Sun Nov 17 08:02:17 2002 UTC
# Line 19  import os Line 19  import os
19  from Xlib import X  from Xlib import X
20  from circus import module  from circus import module
21    
22  # return of the son of the bride of the night of the living menus.py  # XXX not sure if event handling can be abstracted to this module, I'd like it
23  class MyModule(module.Module):  # to be but maybe it needs to go in rendering modules?  If I put handle_event
24    # inton Menu class will that fuck up module loading?
25      # these are the X event we might need  class Menu:
26      my_events = [X.ButtonPress, X.MotionNotify]      """CircusMenu system backend
27    
28        For now all we need from this module is menu_dict and event handling.
29        This creates the menu that we'll use in all the Menu rendering modules,
30        there should be zero rendering code in here.  At the moment we're working
31        with the default hard coded menu because its in the format we want.  Once
32        the first rendering module is working we'll come back and define better
33        menu objects"""
34    
35      # till the config parser works this is all you get      # till the config parser works this is all you get
36      default_menu = {0:['Term','xterm'],1:['Vim','gvim']}      default_menu = {0:['Term','xterm'],1:['Vim','gvim']}
# Line 47  class MyModule(module.Module): Line 54  class MyModule(module.Module):
54      def load(self):      def load(self):
55          pass          pass
56    
     def handle_event(self,event):  
         if event.type == X.ButtonPress:  
             if __debug__:  
                 print "Menus got X.ButtonPress", event.state, event.detail  
                 print "at ", event.root_x, "x", event.root_y  
   
                 # XXX only load the menu once for now  
                 if not self.menu_loaded:  
                     print "Menu events: ", self.my_events  
                     print "buttons: ", self.buttons  
                     print "modifiers: ", self.modifiers  
                     self.load_menu()  
                     self.menu_loaded = 1  
   
57      def run_program(prog, *args):      def run_program(prog, *args):
58          """this works"""          """this works"""
59          pid = os.fork()          pid = os.fork()
# Line 82  class MyModule(module.Module): Line 75  class MyModule(module.Module):
75          if __debug__:          if __debug__:
76              print self.menu_dict              print self.menu_dict
77    
78    # return of the son of the bride of the night of the living menus.py
79    class MyModule(module.Module):
80    
81        # these are the X event we might need
82        my_events = [X.ButtonPress, X.MotionNotify]
83        root_menu = Menu()
84        def handle_event(self,event):
85              if event.type == X.ButtonPress:
86                  if __debug__:
87                        print "Menus got X.ButtonPress", event.state, event.detail
88                        print "at ", event.root_x, "x", event.root_y
89    
90                        # XXX only load the menu once for now
91                        if not self.root_menu.menu_loaded:
92                            # XXX notice this snafu my_events is in MyModule all
93                            # the event handling is in Menu
94                            print "Menu events: ", self.my_events
95                            print "buttons: ", self.root_menu.buttons
96                            print "modifiers: ", self.root_menu.modifiers
97    
98                            # XXX THIS IS WHERE I STOPPED XXX
99                            # it goes up till here fine but raises an exception
100                            # error fo attribute not found.  WTF it can find
101                            # buttons and modifiers just fine?
102                            self.root_menu.load_menu()
103                            self.root_menu.menu_loaded = 1
104    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26