我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用gi.repository.Gtk.STOCK_NEW。
def __init__(self, filename=None): self.m_instance_number = EditorDialogBase.instance_counter EditorDialogBase.instance_counter += 1 self.m_filename = filename self.m_savetime = time.time() self.connect('delete_event', self.on_delete_event) self.g_ui_manager = Gtk.UIManager() accelgroup = self.g_ui_manager.get_accel_group() self.add_accel_group(accelgroup) self.g_actiongroup = Gtk.ActionGroup('') self.g_actiongroup.add_actions([ ('Close', Gtk.STOCK_CLOSE, None, None, None, self.close_window), ('Save', Gtk.STOCK_SAVE, None, None, None, self.on_save), ('SaveAs', Gtk.STOCK_SAVE_AS, None, None, None, self.on_save_as), ('New', Gtk.STOCK_NEW, None, None, None, self.new_file), ('Open', Gtk.STOCK_OPEN, None, None, None, self.on_open), ('Help', Gtk.STOCK_HELP, None, None, None, self.on_show_help), ])
def __init__(self, parent): Gtk.Dialog.__init__(self, "Something", parent, Gtk.DialogFlags.MODAL, buttons=( Gtk.STOCK_NEW, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)) self.set_default_size(400, 600) box = self.get_content_area() label = Gtk.Label("Insert text you want to search for:") box.add(label) # self.entry = Gtk.Entry() # box.add(self.entry) self.main_area = Gtk.Stack() self.main_area.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT) self.main_area.set_transition_duration(1000) self.entry = Gtk.Entry() self.main_area.add_titled(self.entry, "entry_name", "Entry Url") self.labelS = Gtk.Label() self.label_txt = """<big><i>you have choice to runn the scan directly or after setup the scanning process you want to follow on your target</i></big>""" self.labelS.set_markup(self.label_txt) self.labelS.set_line_wrap(True) self.main_area.add_titled(self.labelS, "label_name", "How Scan will Start") self.our_stackSwitcher = Gtk.StackSwitcher() self.our_stackSwitcher.set_stack(self.main_area) box.add(self.our_stackSwitcher) box.add(self.main_area) self.show_all() #~~~~~~~~~~~~ History Dialog ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
def __init__(self): super(CellRendererFadeWindow, self).__init__(title="CellRendererFade Example") self.set_default_size(200, 200) self.liststore = Gtk.ListStore(str, str) self.liststore.append(["New", Gtk.STOCK_NEW]) self.liststore.append(["Open", Gtk.STOCK_OPEN]) self.liststore.append(["Save", Gtk.STOCK_SAVE]) treeview = Gtk.TreeView(model=self.liststore) renderer_text = Gtk.CellRendererText() column_text = Gtk.TreeViewColumn("Text", renderer_text, text=0) treeview.append_column(column_text) renderer_pixbuf = CellRenderFade(param=0.001) column_pixbuf = Gtk.TreeViewColumn("Image", renderer_pixbuf, stock_id=1) treeview.append_column(column_pixbuf) self.add(treeview)
def __init__(self): self.placeholder_image = Gtk.Image.new_from_icon_name( Gtk.STOCK_NEW, Gtk.IconSize.DIALOG) self.new_feed_button = Gtk.Button("New Feed") self.new_feed_vbox = Gtk.Box(Gtk.Orientation.VERTICAL) self.new_feed_vbox.set_halign(Gtk.Align.CENTER) self.new_feed_vbox.set_valign(Gtk.Align.CENTER) _pack_widgets(self.new_feed_vbox, self.placeholder_image, self.new_feed_button) self._grid = Gtk.Grid() self._grid.set_row_homogeneous(True) self._grid.set_column_homogeneous(True) self._grid.attach(self.new_feed_vbox, 0, 0, 1, 1) self._grid.attach(Gtk.Label("FEED ELEMENT DEBUG1"), 1, 0, 1, 1) # DEBUG self._grid.attach(Gtk.Label("FEED ELEMENT DEBUG2"), 0, 1, 1, 1) # DEBUG self._grid.attach(Gtk.Label("FEED ELEMENT DEBUG3"), 1, 1, 1, 1) # DEBUG self._grid.show_all() self.container = self._grid
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 __init__(self): self.placeholder_image = Gtk.Image.new_from_icon_name( Gtk.STOCK_NEW, Gtk.IconSize.DIALOG) self.new_feed_button = Gtk.Button("New Feed") self.new_feed_vbox = Gtk.Box(Gtk.Orientation.VERTICAL) self.new_feed_vbox.set_halign(Gtk.Align.CENTER) self.new_feed_vbox.set_valign(Gtk.Align.CENTER) _pack_widgets(self.new_feed_vbox, self.placeholder_image, self.new_feed_button)