Python gi.repository.Gtk 模块,SeparatorToolItem() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用gi.repository.Gtk.SeparatorToolItem()

项目:PyCut    作者:FOSSRIT    | 项目源码 | 文件源码
def build_toolbar(self):
        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

        activity_button = ActivityToolbarButton(self)
        toolbar_box.toolbar.insert(activity_button, -1)
        activity_button.show()

        # Pause/Play button:

        stop_play = ToolButton('media-playback-stop')
        stop_play.set_tooltip(_("Stop"))
        stop_play.set_accelerator(_('<ctrl>space'))
        stop_play.connect('clicked', self._stop_play_cb)
        stop_play.show()

        toolbar_box.toolbar.insert(stop_play, -1)

        # Blank space (separator) and Stop button at the end:

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(self)
        toolbar_box.toolbar.insert(stop_button, -1)
        stop_button.show()
项目:HFOSSFinal    作者:AlanLeeson    | 项目源码 | 文件源码
def build_toolbar(self):
        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

        activity_button = ActivityToolbarButton(self)
        toolbar_box.toolbar.insert(activity_button, -1)
        activity_button.show()

        # Pause/Play button:

        stop_play = ToolButton('media-playback-stop')
        stop_play.set_tooltip(_("Stop"))
        stop_play.set_accelerator(_('<ctrl>space'))
        stop_play.connect('clicked', self._stop_play_cb)
        stop_play.show()

        toolbar_box.toolbar.insert(stop_play, -1)

        # Blank space (separator) and Stop button at the end:

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(self)
        toolbar_box.toolbar.insert(stop_button, -1)
        stop_button.show()
项目:impress-writer    作者:CSEC-NITH    | 项目源码 | 文件源码
def create_toolbar_top(self):
        toolbar=Gtk.Toolbar()
        self.grid.attach(toolbar,0,0,4,1)

##############New_Button#################################################

        button_new=Gtk.ToolButton()
        button_new.set_icon_name("document-new")
        toolbar.insert(button_new,0)
        toolbar.insert(Gtk.SeparatorToolItem(),1)

##############Open_Button############################################

        button_open=Gtk.ToolButton()
        button_open.set_icon_name("document-open")
        toolbar.insert(button_open,2)
        toolbar.insert(Gtk.SeparatorToolItem(),3)

#############Save_Buton#################################################

        button_save=Gtk.ToolButton()
        button_save.set_icon_name("document-save")
        toolbar.insert(button_save,4)
        toolbar.insert(Gtk.SeparatorToolItem(),5)

#########Help_Button#####################################################

        button_help=Gtk.ToolButton()
        button_help.set_icon_name("help-about")
        toolbar.insert(button_help,6)
项目:math-hurdler    作者:craigcabrey    | 项目源码 | 文件源码
def build_toolbar(self):
        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

        activity_button = ActivityToolbarButton(self)
        toolbar_box.toolbar.insert(activity_button, -1)
        activity_button.show()

        # Pause/Play button:

        stop_play = ToolButton('media-playback-stop')
        stop_play.set_tooltip(_("Stop"))
        stop_play.set_accelerator(_('<ctrl>space'))
        stop_play.connect('clicked', self._stop_play_cb)
        stop_play.show()

        toolbar_box.toolbar.insert(stop_play, -1)

        # Blank space (separator) and Stop button at the end:

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(self)
        toolbar_box.toolbar.insert(stop_button, -1)
        stop_button.show()
项目:bokken    作者:thestr4ng3r    | 项目源码 | 文件源码
def create(toolbar):
    '''Set of instructions to create the search widget in a toolbar.'''

    # Search components
    toolbar.search_combo_tb = Gtk.ToolItem()
    toolbar.search_combo_align = Gtk.Alignment.new(0, 0.5, 0, 0)
    store = Gtk.ListStore(GdkPixbuf.Pixbuf, str)
    toolbar.search_combo = Gtk.ComboBox.new_with_model(store)
    rendererText = Gtk.CellRendererText()
    rendererPix = Gtk.CellRendererPixbuf()
    toolbar.search_combo.pack_start(rendererPix, False)
    toolbar.search_combo.pack_start(rendererText, True)
    toolbar.search_combo.add_attribute(rendererPix, 'pixbuf', 0)
    toolbar.search_combo.add_attribute(rendererText, 'text', 1)

    options = {
        'String':GdkPixbuf.Pixbuf.new_from_file(datafile_path('icon_string_16.png')),
        'String no case':GdkPixbuf.Pixbuf.new_from_file(datafile_path('icon_string_no_case_16.png')),
        'Hexadecimal':GdkPixbuf.Pixbuf.new_from_file(datafile_path('icon_hexadecimal_16.png')),
        'Regexp':GdkPixbuf.Pixbuf.new_from_file(datafile_path('icon_regexp_16.png'))
    }

    for option in options.keys():
        store.append([options[option], option])
    toolbar.search_combo.set_active(0)
    toolbar.search_combo_align.add(toolbar.search_combo)
    toolbar.search_combo_tb.add(toolbar.search_combo_align)
    toolbar.main_tb.insert(toolbar.search_combo_tb, -1)

    # Separator
    toolbar.sep = Gtk.SeparatorToolItem()
    toolbar.sep.set_draw(False)
    toolbar.main_tb.insert(toolbar.sep, -1)

    toolbar.search_entry_tb = Gtk.ToolItem()
    toolbar.search_entry = Gtk.Entry()
    toolbar.search_entry.set_max_length(100)
    toolbar.search_entry.set_text('Text to search')
    toolbar.search_entry.set_icon_from_stock(1, Gtk.STOCK_FIND)
    toolbar.search_entry.set_icon_tooltip_text(1, 'Search')
    toolbar.search_entry.connect("activate", toolbar.search)
    toolbar.search_entry.connect("icon-press", toolbar.search)
    toolbar.search_entry.connect('focus-in-event', toolbar._clean, 'in')
    toolbar.search_entry.connect('focus-out-event', toolbar._clean, 'out')
    toolbar.search_entry_tb.add(toolbar.search_entry)
    # We use the AccelGroup object from the main window.
    my_accel = Gtk.accel_groups_from_object(toolbar.main.window)[0]
    key, mod = Gtk.accelerator_parse('<Control>F')
    toolbar.search_entry.set_tooltip_text('Control-F to search')
    toolbar.search_entry.add_accelerator('grab-focus', my_accel, key, mod, Gtk.AccelFlags.MASK)
    toolbar.main_tb.insert(toolbar.search_entry_tb, -1)