当前位置: 首页>>代码示例>>Python>>正文


Python Gtk.ToggleToolButton方法代码示例

本文整理汇总了Python中gi.repository.Gtk.ToggleToolButton方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.ToggleToolButton方法的具体用法?Python Gtk.ToggleToolButton怎么用?Python Gtk.ToggleToolButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gtk的用法示例。


在下文中一共展示了Gtk.ToggleToolButton方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_toolitem

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ToggleToolButton [as 别名]
def add_toolitem(self, name, group, position, image_file, description,
                     toggle):
        if toggle:
            tbutton = Gtk.ToggleToolButton()
        else:
            tbutton = Gtk.ToolButton()
        tbutton.set_label(name)

        if image_file is not None:
            image = Gtk.Image()
            image.set_from_file(image_file)
            tbutton.set_icon_widget(image)

        if position is None:
            position = -1

        self._add_button(tbutton, group, position)
        signal = tbutton.connect('clicked', self._call_tool, name)
        tbutton.set_tooltip_text(description)
        tbutton.show_all()
        self._toolitems.setdefault(name, [])
        self._toolitems[name].append((tbutton, signal)) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:24,代码来源:backend_gtk3.py

示例2: onTaskOpened

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ToggleToolButton [as 别名]
def onTaskOpened(self, plugin_api):
        image_geolocalization_path = os.path.join(self.plugin_path,
                                                  "icons/hicolor/24x24/\
                                                  geolocalization.png")
        pixbuf_geolocalization = GdkPixbuf.Pixbuf.new_from_file_at_size(
            image_geolocalization_path, 24, 24)

        # create the image and associate the pixbuf
        icon_geolocalization = Gtk.Image()
        icon_geolocalization.set_from_pixbuf(pixbuf_geolocalization)
        icon_geolocalization.show()

        # toolbar button for the location_view
        btn_location_view = Gtk.ToggleToolButton()
        btn_location_view.set_icon_widget(icon_geolocalization)
        btn_location_view.set_label("Location View")

        self.task_separator = plugin_api.add_task_toolbar_item(
            Gtk.SeparatorToolItem())

        btn_set_location = Gtk.ToolButton()
        btn_set_location.set_icon_widget(icon_geolocalization)
        btn_set_location.set_label("Set/View location")
        btn_set_location.connect('clicked', self.set_task_location, plugin_api)
        self.btn_set_location = plugin_api.add_task_toolbar_item(
            btn_set_location) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:28,代码来源:geolocalized_tasks.py

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ToggleToolButton [as 别名]
def __init__(self, graph, mydot, core):
        GObject.GObject.__init__(self)

        self.graph = graph
        self.mydot = mydot
        self.uicore = core

        self.toolbox = self
        b = SemiStockButton("", Gtk.STOCK_ZOOM_IN, 'Zoom In')
        b.connect("clicked", self._zoom, "in")
        self.toolbox.pack_start(b, False, False, 0)
        b = SemiStockButton("", Gtk.STOCK_ZOOM_OUT, 'Zoom Out')
        b.connect("clicked", self._zoom, "out")
        self.toolbox.pack_start(b, False, False, 0)
        b = SemiStockButton("", Gtk.STOCK_ZOOM_FIT, 'Zoom Fit')
        b.connect("clicked", self._zoom, "fit")
        self.toolbox.pack_start(b, False, False, 0)
        b = SemiStockButton("", Gtk.STOCK_ZOOM_100, 'Zoom 100%')
        b.connect("clicked", self._zoom, "100")
        self.toolbox.pack_start(b, False, False, 0)
        # Separator
        self.sep = Gtk.HSeparator()
        self.toolbox.pack_start(self.sep, False, False, 0)

        # Change between Callgraph and Flowgraph
        if self.uicore.backend == 'radare':
            self.grpah_layout = Gtk.ToggleToolButton(stock_id=Gtk.STOCK_FULLSCREEN)
            self.grpah_layout.connect("clicked", self._change_layout)
            self.toolbox.pack_start(self.grpah_layout, False, False, 0)

        # Grayed?
        self.toolbox.set_sensitive(True)
        self.show_all() 
开发者ID:inguma,项目名称:bokken,代码行数:35,代码来源:graph_bar.py

示例4: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ToggleToolButton [as 别名]
def __init__(self, persp):
        self.persp = persp
        self.filtered = False

        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        # buttons
        toolbar = Gtk.Toolbar()

        firstButton = Gtk.ToolButton(stock_id=Gtk.STOCK_MEDIA_PREVIOUS)
        toolbar.insert(firstButton, -1)

        prevButton = Gtk.ToolButton(stock_id=Gtk.STOCK_MEDIA_REWIND)
        toolbar.insert(prevButton, -1)

        nextButton = Gtk.ToolButton(stock_id=Gtk.STOCK_MEDIA_FORWARD)
        toolbar.insert(nextButton, -1)

        lastButton = Gtk.ToolButton(stock_id=Gtk.STOCK_MEDIA_NEXT)
        toolbar.insert(lastButton, -1)

        self.filterButton = Gtk.ToggleToolButton(Gtk.STOCK_FIND)
        self.filterButton.set_tooltip_text(_("Filter game list by current game moves"))
        toolbar.insert(self.filterButton, -1)

        addButton = Gtk.ToolButton(stock_id=Gtk.STOCK_ADD)
        addButton.set_tooltip_text(_("Add sub-fen filter from position/circles"))
        toolbar.insert(addButton, -1)

        firstButton.connect("clicked", self.on_first_clicked)
        prevButton.connect("clicked", self.on_prev_clicked)
        nextButton.connect("clicked", self.on_next_clicked)
        lastButton.connect("clicked", self.on_last_clicked)

        addButton.connect("clicked", self.on_add_clicked)
        self.filterButton.connect("clicked", self.on_filter_clicked)

        tool_box = Gtk.Box()
        tool_box.pack_start(toolbar, False, False, 0)

        # board
        self.gamemodel = self.persp.gamelist.gamemodel
        self.boardcontrol = BoardControl(self.gamemodel, {}, game_preview=True)
        self.boardview = self.boardcontrol.view
        self.board = self.gamemodel.boards[self.boardview.shown].board
        self.boardview.set_size_request(170, 170)

        self.boardview.got_started = True
        self.boardview.auto_update_shown = False

        self.box.pack_start(self.boardcontrol, True, True, 0)
        self.box.pack_start(tool_box, False, True, 0)
        self.box.show_all()

        selection = self.persp.gamelist.get_selection()
        self.conid = selection.connect_after('changed', self.on_selection_changed)
        self.persp.gamelist.preview_cid = self.conid

        # force first game to show
        self.persp.gamelist.set_cursor(0) 
开发者ID:pychess,项目名称:pychess,代码行数:62,代码来源:PreviewPanel.py

示例5: create_toolbuttons

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ToggleToolButton [as 别名]
def create_toolbuttons(self):
        def on_logoff_clicked(button):
            self.emit("logout")
            self.close()

        self.logoff_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_DISCONNECT)
        self.logoff_button.set_tooltip_text(_("Log Off"))
        self.logoff_button.set_label("logoff")
        self.logoff_button.connect("clicked", on_logoff_clicked)

        def on_minute_1_clicked(button):
            self.connection.client.run_command("1-minute")

        def on_minute_3_clicked(button):
            self.connection.client.run_command("3-minute")

        def on_minute_5_clicked(button):
            self.connection.client.run_command("5-minute")

        def on_minute_15_clicked(button):
            self.connection.client.run_command("15-minute")

        def on_minute_25_clicked(button):
            self.connection.client.run_command("25-minute")

        def on_chess960_clicked(button):
            self.connection.client.run_command("chess960")

        self.minute_1_button = Gtk.ToggleToolButton()
        self.minute_1_button.set_label("1")
        self.minute_1_button.set_tooltip_text(_("New game from 1-minute playing pool"))
        self.minute_1_button.connect("clicked", on_minute_1_clicked)

        self.minute_3_button = Gtk.ToggleToolButton()
        self.minute_3_button.set_label("3")
        self.minute_3_button.set_tooltip_text(_("New game from 3-minute playing pool"))
        self.minute_3_button.connect("clicked", on_minute_3_clicked)

        self.minute_5_button = Gtk.ToggleToolButton()
        self.minute_5_button.set_label("5")
        self.minute_5_button.set_tooltip_text(_("New game from 5-minute playing pool"))
        self.minute_5_button.connect("clicked", on_minute_5_clicked)

        self.minute_15_button = Gtk.ToggleToolButton()
        self.minute_15_button.set_label("15")
        self.minute_15_button.set_tooltip_text(_("New game from 15-minute playing pool"))
        self.minute_15_button.connect("clicked", on_minute_15_clicked)

        self.minute_25_button = Gtk.ToggleToolButton()
        self.minute_25_button.set_label("25")
        self.minute_25_button.set_tooltip_text(_("New game from 25-minute playing pool"))
        self.minute_25_button.connect("clicked", on_minute_25_clicked)

        self.chess960_button = Gtk.ToggleToolButton()
        self.chess960_button.set_label("960")
        self.chess960_button.set_tooltip_text(_("New game from Chess960 playing pool"))
        self.chess960_button.connect("clicked", on_chess960_clicked) 
开发者ID:pychess,项目名称:pychess,代码行数:59,代码来源:__init__.py


注:本文中的gi.repository.Gtk.ToggleToolButton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。