我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用gtk.STOCK_PREFERENCES。
def setup_gui_url_chooser(self): self.media_model = gtk.ListStore(str) self.media_type = gtk.ComboBox(self.media_model) cell = gtk.CellRendererText() self.media_type.pack_start(cell, True) self.media_type.add_attribute(cell, "text", 0) for t in ("file", "dvd", "tv", "dvb", "vcd", "radio", "cdda", "tivo"): self.media_model.append((t,)) self.media_location = gtk.Entry() self.media_server = gtk.Label() self.media_server.set_alignment(0, 0.5) d = catota.ui.Dialog("Choose Location", self.parent_win, extra_buttons=(gtk.STOCK_PREFERENCES, 1)) t = catota.ui.new_table((("Server:", self.media_server), ("Type:", self.media_type), ("Location:", self.media_location))) d.vbox.pack_start(t, True, True) self.gui_url_chooser = d # setup_gui_url_chooser()
def _setup_actions(self): self._add_stock_action("Quit", stock=gtk.STOCK_QUIT) self._add_stock_action("Preferences", stock=gtk.STOCK_PREFERENCES) self._add_stock_action("Open", stock=gtk.STOCK_OPEN) self._add_stock_action("Play", stock=gtk.STOCK_MEDIA_PLAY) self._add_stock_action("Stop", stock=gtk.STOCK_MEDIA_STOP) act = gtk.ToggleAction("Pause", None, None, gtk.STOCK_MEDIA_PAUSE) self.action_group.add_action_with_accel(act, None) act.set_accel_group(self.accel_group) act.connect_accelerator() self.actions["Pause"] = act # _setup_actions()
def _setup_config(self): stock_size = gtk.ICON_SIZE_BUTTON config_bar = gtk.HBox() b_conf = Utils.button_stock(gtk.STOCK_PREFERENCES,stock_size) self.widgets_to_disable.append(b_conf) # connect b_conf.connect("clicked",self.on_config) # tooltips b_conf.set_tooltip_text("open configuration dialog") config_bar.pack_start(b_conf,False,False,0) return config_bar