def do_startup(self): """ Perform startup operations. Called once, on application startup. """ Application.do_startup(self) # Connect the close button to a callback action = SimpleAction.new('quit', None) action.connect('activate', self.on_quit) self.add_action(action) # Install main menu builder = Builder() builder.add_from_string(MENU) self.set_app_menu(builder.get_object('app-menu')) # Get a (single) view and model. # Because this function is executed only once, # multiple models or views cannot exist. self.view = View(application=self, title=APP_TITLE) self.model = Model() # Pass view all the callbacks, to assign each one to the appropriate GUI object. self.view.setCallbacks( self.Callbacks(self.model, self.view, self.XML(self.model, self.view))) # Initialize the GUI self.view.initGUI() # Connect each view component with its corresponding model. # This is clearly a controller's responsibility. self.view.zones.set_model(self.model.zones) self.view.playlists.set_model(self.model.playlists) for dayIndex in range(7): self.view.schedule[dayIndex].set_model( self.model.schedule[dayIndex]) # Set app title and logo in gnome's top bar self.view.set_wmclass('Flow Dashboard', 'Flow Dashboard') self.view.set_icon_from_file('src/resources/logo.png') # Make the GUI visible self.view.show_all() # Zone Inspector is set initially invisible, until a zone is selected self.view.zoneInspector.hide()
def do_startup(self): Application.do_startup(self) #TODO: Parse args #if "open-entity" in args: # Set app menu action = SimpleAction.new("preferences", None) action.connect("activate", self.on_preferences) #self.set_accels_for_action("app.preferences", ["<Control>,"]) self.add_action(action) action = SimpleAction.new("shortcuts", None) action.connect("activate", self.on_shortcuts) self.set_accels_for_action("app.shortcuts", ["<Control>F1"]) self.add_action(action) # Set app menu action = SimpleAction.new("help", None) action.connect("activate", self.on_help) self.set_accels_for_action("app.help", ["F1"]) self.add_action(action) action = SimpleAction.new("about", None) action.connect("activate", self.on_about) self.add_action(action) action = SimpleAction.new("quit", None) action.connect("activate", self.on_quit) self.set_accels_for_action("app.quit", ["<Control>q"]) self.add_action(action) # Set entity menu action = SimpleAction.new("entity_close", None) action.connect("activate", self.on_entity_close) self.set_accels_for_action("app.entity_close", ["<Control>w"]) self.add_action(action)
def do_startup(self): GtkApplication.do_startup(self) action = SimpleAction.new("new-window", None) action.connect("activate", self.on_new_window) self.add_action(action) action = SimpleAction.new("shortcuts", None) action.connect("activate", self.on_shortcuts) self.add_action(action) action = SimpleAction.new("about", None) action.connect("activate", self.on_about) self.add_action(action) action = SimpleAction.new("traceback", VariantType.new('s')) action.connect("activate", self.on_traceback) self.add_action(action) action = SimpleAction.new("quit", None) action.connect("activate", self.on_quit) self.add_action(action) self.set_app_menu(AppMenu())
def do_startup(self): Application.do_startup(self)