我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用gi.repository.Gtk.STOCK_GO_DOWN。
def on_right_click_row(self, button, event, linked): idx = self.m_model.index(linked) if event.button == 3: m = Gtk.Menu() item = Gtk.ImageMenuItem(Gtk.STOCK_DELETE) item.connect('activate', self.on_delete_link, linked) ### m.append(item) item = Gtk.ImageMenuItem(Gtk.STOCK_CUT) item.connect('activate', self.on_cut_link, idx) ### m.append(item) item = Gtk.ImageMenuItem(Gtk.STOCK_PASTE) item.set_sensitive(bool(Editor.clipboard)) item.connect('activate', self.on_paste, idx) ### m.append(item) item = Gtk.ImageMenuItem(Gtk.STOCK_EDIT) item.connect('activate', self.on_edit_linktext, linked) item.set_sensitive(bool(not isinstance(linked, basestring))) ### m.append(item) item = Gtk.ImageMenuItem(Gtk.STOCK_GO_UP) item.connect('activate', self.on_move_link_up, idx) item.set_sensitive(bool(idx > 0)) ### m.append(item) item = Gtk.ImageMenuItem(Gtk.STOCK_GO_DOWN) item.connect('activate', self.on_move_link_down, idx) item.set_sensitive(bool(idx < len(self.m_model) - 1)) ### m.append(item) item = Gtk.ImageMenuItem(Gtk.STOCK_EDIT) item.set_sensitive(isinstance(linked, unicode)) item.connect('activate', self.on_edit_file, idx) ### m.append(item) m.show_all() m.popup(None, None, None, None, event.button, event.time) return True
def _hide_tb_toggled(self, widget): if widget.get_active(): self.main.tviews.term_nb.show() i = Gtk.Image() i.set_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.MENU) widget.set_image(i) else: self.main.tviews.term_nb.hide() i = Gtk.Image() i.set_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.MENU) widget.set_image(i)
def _hide_tb_toggled(self, widget): if widget.get_active(): self.main.topbuttons.hide() self.main.mbar.hide() i = Gtk.Image() i.set_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.MENU) widget.set_image(i) else: self.main.topbuttons.show() self.main.mbar.show() i = Gtk.Image() i.set_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.MENU) widget.set_image(i)
def _hide_tb_toggled(self, widget): if widget.get_active(): self.main.topbuttons.main_tb.hide() i = Gtk.Image() i.set_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.MENU) widget.set_image(i) else: self.main.topbuttons.main_tb.show() i = Gtk.Image() i.set_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.MENU) widget.set_image(i)
def __init__(self, configuration): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.set_homogeneous(False) self.sequence_player = None self.tool_bar = Gtk.Toolbar() self.pack_start(self.tool_bar, False, True, 0) self.tool_add = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.BUTTON), "Add") self.tool_add.connect("clicked", self.on_add_clicked) self.tool_bar.insert(self.tool_add, -1) self.tool_delete = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_DELETE, Gtk.IconSize.BUTTON), "Delete") self.tool_delete.connect("clicked", self.on_delete_clicked) self.tool_bar.insert(self.tool_delete, -1) self.tool_bar.insert(Gtk.SeparatorToolItem.new(), -1) self.tool_up = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.BUTTON), "Add") self.tool_up.connect("clicked", self.on_up_clicked) self.tool_bar.insert(self.tool_up, -1) self.tool_down = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.BUTTON), "Add") self.tool_down.connect("clicked", self.on_down_clicked) self.tool_bar.insert(self.tool_down, -1) self.tool_bar.insert(Gtk.SeparatorToolItem.new(), -1) self.tool_play = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON), "Run") self.tool_play.connect("clicked", self.on_run_clicked) self.tool_bar.insert(self.tool_play, -1) self.enable_tools(True, False) self.content = Gtk.ListBox() self.scrollTree = Gtk.ScrolledWindow() self.scrollTree.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) self.scrollTree.add_with_viewport(self.content) self.scrollTree.set_min_content_height(100) self.pack_start(self.scrollTree, True, True, 0) self.sbrickConfiguration = configuration self.sbrick = None self.sequenceSteps = [] if "sequence" in self.sbrickConfiguration: for step in self.sbrickConfiguration["sequence"]: stepbox = SequenceStepBox(step, self.sbrickConfiguration["functions"]) self.content.add(stepbox) self.sequenceSteps.append(stepbox) else: self.sbrickConfiguration["sequence"] = []
def _build_search(self, widget): '''Builds the search bar.''' self.srchtab = Gtk.HBox() # close button close = Gtk.Image() close.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU) eventbox = Gtk.EventBox() eventbox.add(close) eventbox.connect("button-release-event", self._close) self.srchtab.pack_start(eventbox, False, False, 3) # label label = Gtk.Label(label="Find:") self.srchtab.pack_start(label, False, False, 3) # entry self.search_entry = Gtk.Entry() self.search_entry.set_tooltip_text("Type here the phrase you want to find") self.search_entry.connect("activate", self._find, "next") self.search_entry.connect("changed", self._find_cb, "find") self.srchtab.pack_start(self.search_entry, False, False, 3) # find next button if self.small: but_text = '' else: but_text = 'Next' butn = SemiStockButton(but_text, Gtk.STOCK_GO_DOWN) butn.set_relief(Gtk.ReliefStyle.NONE) butn.connect("clicked", self._find, "next") butn.set_tooltip_text("Find the next ocurrence of the phrase") self.srchtab.pack_start(butn, False, False, 3) # find previous button if self.small: but_text = '' else: but_text = ('Previous') butp = SemiStockButton(but_text, Gtk.STOCK_GO_UP) butp.set_relief(Gtk.ReliefStyle.NONE) butp.connect("clicked", self._find, "previous") butp.set_tooltip_text("Find the previous ocurrence of the phrase") self.srchtab.pack_start(butp, False, False, 3) # make last two buttons equally width # MEOW wn,hn = butn.get_preferred_size() wp,hp = butp.get_preferred_size() newwidth = max(wn.width, wp.width) butn.set_size_request(newwidth, hn.height) butp.set_size_request(newwidth, hp.height) # Match case CheckButton butCase = Gtk.CheckButton(('Match case')) butCase.set_active(self._matchCaseValue) butCase.connect("clicked", self._matchCase) # FIXME # current version of Gtk.TextIter doesn't support SEARCH_CASE_INSENSITIVE #butCase.show() #self.srchtab.pack_start(butCase, expand=False, fill=False, padding=3) self.pack_start(self.srchtab, False, False, 0) # Results self._resultsLabel = Gtk.Label(label="") self.srchtab.pack_start(self._resultsLabel, False, False, 3) self.searching = False