Logo Search packages:      
Sourcecode: gameclock version File versions  Download package

def gtkui::GameclockUI::main (   self )
create the main user interface with GTK

Definition at line 322 of file gtkui.py.

                  :
        """create the main user interface with GTK"""

        # create a new window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

        # handle window close events
        self.window.connect("delete_event", lambda a, b: False)    
        self.window.connect("destroy", self.quit)
    
        self.window.connect('key_press_event', self.handle_key_press)

        event_box = gtk.EventBox()
        self.window.add(event_box)
        event_box.show()
        # catch clicks as end turn
        event_box.set_extension_events(gtk.gdk.EXTENSION_EVENTS_ALL)
        event_box.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        event_box.connect("button_press_event", self.end_turn)
        event_box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('black'))

        # main window consists of a vbox containing two hbox
        self.vlayout = vlayout = gtk.VBox(False, 0)
        event_box.add(vlayout)

        # the menu on top, which also acts as a dispatcher for the "New" dialog
        menu = GameclockUI.MenuItemFactory(self)

        # turn counter
        self.turns = gtk.Label()
        self.turns.modify_fg(gtk.STATE_NORMAL, gtk.gdk.Color('white'))
        vlayout.pack_start(self.turns, False, False, 0)

        # the clocks
        self.clock_table = gtk.Table(1, 2, True)
        self.clock_table.show()
        vlayout.pack_start(self.clock_table, True, True, 0)

        vlayout.show()

        if self.fullscreen:
            self.window.fullscreen()

        menu.new_dialog(self, None, None).run()

        if self.game:
            self.window.show()
            gtk.main()


Generated by  Doxygen 1.6.0   Back to index