我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用gi.repository.Gtk.STOCK_QUIT。
def add_file_menu_actions(self, action_group): action_filemenu = Gtk.Action("FileMenu", "File", None, None) action_group.add_action(action_filemenu) action_getDataFromDataBase = Gtk.Action("getDataFromDataBase", "_obtener Datos","getDataFromDataBase", Gtk.STOCK_REFRESH) action_getDataFromDataBase.connect("activate", self.on_menu_getDataFromDataBase) action_group.add_action_with_accel(action_getDataFromDataBase, None) action_lanzarScrapy = Gtk.Action("lanzarScrapy", "_lanzar Scrapy","lanzarScrapy", Gtk.STOCK_EXECUTE) action_lanzarScrapy.connect("activate", self.on_menu_lanzarScrapy) action_group.add_action_with_accel(action_lanzarScrapy, None) action_createDataBase = Gtk.Action("createDataBase", "_crear Base Datos","createDataBase", Gtk.STOCK_EXECUTE) action_createDataBase.connect("activate", self.on_menu_createDataBase) action_group.add_action_with_accel(action_createDataBase, None) action_filequit = Gtk.Action("salir", None, "salir", Gtk.STOCK_QUIT) action_filequit.connect("activate", self.on_menu_file_quit) action_group.add_action(action_filequit) #dialogo info
def __init__(self, default_profile): ProfileManagerBase.__init__(self, default_profile) self.add_button(Gtk.STOCK_QUIT, Gtk.ResponseType.CLOSE) b = self.add_button(_("_Start GNU Solfege"), Gtk.ResponseType.ACCEPT) b.grab_focus() self.set_default_response(Gtk.ResponseType.ACCEPT)
def _build_menu_new(self, menu_bar): """ Build the whole New menu item. """ menu_item = self._build_menu_item("New", menu_bar) self.dropmenu_new = Gtk.Menu() menu_item.set_submenu(self.dropmenu_new) self.subitem_new_session = self._build_menu_item( "New Session", self.dropmenu_new, image=Gtk.STOCK_NEW ) self.subitem_save_configuration = self._build_menu_item( "Save configuration", self.dropmenu_new, image=Gtk.STOCK_SAVE, callback=self.on_save_clicked ) self.subitem_load_configuration = self._build_menu_item( "Load Configuration", self.dropmenu_new, image=Gtk.STOCK_FILE, callback=self.on_load_clicked ) self.subitem_recent_session = self._build_menu_item( "Recent Session", self.dropmenu_new, image=Gtk.STOCK_REVERT_TO_SAVED ) self.subitem_preferences = self._build_menu_item( "Preferences", self.dropmenu_new, image=Gtk.STOCK_PREFERENCES ) self._build_separatormenuitem(self.dropmenu_new) self.subitem_quit = self._build_menu_item( "Quit", self.dropmenu_new, image=Gtk.STOCK_QUIT, callback=Gtk.main_quit ) return menu_item
def checkForA11yInteractively(): # pragma: no cover """ Checks if accessibility is enabled, and presents a dialog prompting the user if it should be enabled if it is not already, then halts execution. """ if isA11yEnabled(): return dialog = Gtk.Dialog('Enable Assistive Technology Support?', None, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, (Gtk.STOCK_QUIT, Gtk.ResponseType.CLOSE, "_Enable", Gtk.ResponseType.ACCEPT)) question = """Dogtail requires that Assistive Technology Support be enabled for it to function. Would you like to enable Assistive Technology support now? Note that you will have to log out for the change to fully take effect. """.strip() dialog.set_default_response(Gtk.ResponseType.ACCEPT) questionLabel = Gtk.Label(label=question) questionLabel.set_line_wrap(True) dialog.vbox.pack_start(questionLabel, True, True, 0) dialog.show_all() result = dialog.run() if result == Gtk.ResponseType.ACCEPT: logger.log("Enabling accessibility...") enableA11y() elif result == Gtk.ResponseType.CLOSE: bailBecauseA11yIsDisabled() dialog.destroy()