我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用gi.repository.Gtk.STOCK_APPLY。
def do_activate(self): if not self.window: self.window = self.builder.get_object("main_window") self.window.set_application(self) self.window.present() #The preferences dialog self.preferences_dialog = Gtk.Dialog(self.window, self.window, True, ) self.preferences_dialog.add_buttons(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE, Gtk.STOCK_APPLY, Gtk.ResponseType.APPLY) self.preferences_dialog.set_title("Preferences") box = self.preferences_dialog.get_content_area() box.add(self.settings_box)
def __init__(self, default_profile): ProfileManagerBase.__init__(self, default_profile) self.add_button(Gtk.STOCK_APPLY, Gtk.ResponseType.ACCEPT)
def __init__(self, datadir, uifile): SimpleGtkbuilderApp.__init__( self, os.path.join(datadir, "ui/gtk3", uifile), "software-center") # generic data self.token = None self.display_name = None self._login_successful = False self._whoami_token_reset_nr = 0 #persistent config configfile = os.path.join( SOFTWARE_CENTER_CONFIG_DIR, "submit_reviews.cfg") self.config = get_config(configfile) # status spinner self.status_spinner = Gtk.Spinner() self.status_spinner.set_size_request(32, 32) self.login_spinner_vbox.pack_start(self.status_spinner, False, False, 0) self.login_spinner_vbox.reorder_child(self.status_spinner, 0) self.status_spinner.show() #submit status spinner self.submit_spinner = Gtk.Spinner() self.submit_spinner.set_size_request(*Gtk.icon_size_lookup( Gtk.IconSize.SMALL_TOOLBAR)[:2]) #submit error image self.submit_error_img = Gtk.Image() self.submit_error_img.set_from_stock(Gtk.STOCK_DIALOG_ERROR, Gtk.IconSize.SMALL_TOOLBAR) #submit success image self.submit_success_img = Gtk.Image() self.submit_success_img.set_from_stock(Gtk.STOCK_APPLY, Gtk.IconSize.SMALL_TOOLBAR) #submit warn image self.submit_warn_img = Gtk.Image() self.submit_warn_img.set_from_stock(Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.SMALL_TOOLBAR) #label size to prevent image or spinner from resizing self.label_transmit_status.set_size_request(-1, Gtk.icon_size_lookup(Gtk.IconSize.SMALL_TOOLBAR)[1])