本文整理汇总了Python中gi.repository.Gtk.Toolbar方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.Toolbar方法的具体用法?Python Gtk.Toolbar怎么用?Python Gtk.Toolbar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.Toolbar方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Toolbar [as 别名]
def __init__(self, canvas, window):
"""
figManager is the FigureManagerGTK3 instance that contains the
toolbar, with attributes figure, window and drawingArea
"""
GObject.GObject.__init__(self)
self.canvas = canvas
# Note: Gtk.Toolbar already has a 'window' attribute
self.win = window
self.set_style(Gtk.ToolbarStyle.ICONS)
self._create_toolitems()
self.update = self._update
self.fileselect = FileChooserDialog(
title='Save the figure',
parent=self.win,
filetypes=self.canvas.get_supported_filetypes(),
default_filetype=self.canvas.get_default_filetype())
self.show_all()
self.update()
示例2: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Toolbar [as 别名]
def __init__(self, title):
View.__init__(self)
toolbar = Gtk.Toolbar()
toolbar.props.show_arrow = False
fullscreen_icon = label.create_button_label(constants.BUTTON_EXP)
self['maximize_button'] = Gtk.ToolButton()
self['maximize_button'].set_icon_widget(fullscreen_icon)
redock_icon = label.create_button_label(constants.BUTTON_UNDOCK)
self['redock_button'] = Gtk.ToolButton()
self['redock_button'].set_icon_widget(redock_icon)
self['redock_button'].set_tooltip_text("Redock")
toolbar.insert(self['maximize_button'], 0)
toolbar.insert(self['redock_button'], 1)
self['headerbar'].props.title = title
self['headerbar'].pack_end(toolbar)
self['headerbar'].show_all()
self.get_top_widget().set_titlebar(self['headerbar'])
示例3: _add_button
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Toolbar [as 别名]
def _add_button(self, button, group, position):
if group not in self._groups:
if self._groups:
self._add_separator()
toolbar = Gtk.Toolbar()
toolbar.set_style(Gtk.ToolbarStyle.ICONS)
self._toolarea.pack_start(toolbar, False, False, 0)
toolbar.show_all()
self._groups[group] = toolbar
self._groups[group].insert(button, position)
示例4: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Toolbar [as 别名]
def __init__(self, main):
super(LeftButtons,self).__init__(False, 1)
self.main = main
self.prev_size = ()
#################################################################
# Left mini-toolbar
#################################################################
toolbar = Gtk.Toolbar()
toolbar.set_style(Gtk.ToolbarStyle.ICONS)
##################################
# Methods
示例5: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Toolbar [as 别名]
def __init__(self, model):
InsertedObjectWidget.__init__(self)
self.textarea_width = 0
self.model = model
# used in pageview
self._has_cursor = False # Skip table object, if someone moves cursor around in textview
# used here
self._timer = None # NONE or number of current GObject.timer, which is running
self._keep_toolbar_open = False # a cell is currently edited, toolbar should not be hidden
self._cellinput_canceled = None # cell changes should be skipped
self._toolbar_enabled = True # sets if toolbar should be shown beneath a selected table
# Toolbar for table actions
self.toolbar = self.create_toolbar()
self.toolbar.show_all()
self.toolbar.set_no_show_all(True)
self.toolbar.hide()
# Create treeview
self._init_treeview(model)
# package gui elements
self.vbox = Gtk.VBox()
self.add(self.vbox)
self.vbox.pack_end(self.toolbar, True, True, 0)
self.scroll_win = ScrolledWindow(self.treeview, Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER, Gtk.ShadowType.NONE)
self.vbox.pack_start(self.scroll_win, True, True, 0)
# signals
model.connect('model-changed', self.on_model_changed)
示例6: create_toolbar
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Toolbar [as 别名]
def create_toolbar(self):
'''This function creates a toolbar which is displayed next to the table'''
toolbar = Gtk.Toolbar()
toolbar.set_orientation(Gtk.Orientation.HORIZONTAL)
toolbar.set_style(Gtk.ToolbarStyle.ICONS)
toolbar.set_border_width(1)
for pos, stock, handler, data, tooltip in (
(0, Gtk.STOCK_ADD, self.on_add_row, None, _('Add row')), # T: tooltip on mouse hover
(1, Gtk.STOCK_DELETE, self.on_delete_row, None, _('Remove row')), # T: tooltip on mouse hover
(2, Gtk.STOCK_COPY, self.on_clone_row, None, _('Clone row')), # T: tooltip on mouse hover
(3, None, None, None, None),
(4, Gtk.STOCK_GO_UP, self.on_move_row, -1, _('Row up')), # T: tooltip on mouse hover
(5, Gtk.STOCK_GO_DOWN, self.on_move_row, 1, _('Row down')), # T: tooltip on mouse hover
(6, None, None, None, None),
(7, Gtk.STOCK_PREFERENCES, self.on_change_columns, None, _('Change columns')), # T: tooltip on mouse hover
(8, None, None, None, None),
(9, Gtk.STOCK_HELP, self.on_open_help, None, _('Open help')), # T: tooltip on mouse hover
):
if stock is None:
toolbar.insert(Gtk.SeparatorToolItem(), pos)
else:
button = Gtk.ToolButton(stock)
if data:
button.connect('clicked', handler, data)
else:
button.connect('clicked', handler)
button.set_tooltip_text(tooltip)
toolbar.insert(button, pos)
toolbar.set_size_request(300, -1)
toolbar.set_icon_size(Gtk.IconSize.MENU)
return toolbar
示例7: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Toolbar [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)
示例8: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Toolbar [as 别名]
def __init__(self, url):
from pychess.System.uistuff import keepWindowSize
self.window = Gtk.Window()
keepWindowSize("webkitbrowser", self.window, (800, 600))
self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.window.add(self.vbox)
self.box = Gtk.Box()
self.toolbar = Gtk.Toolbar()
self.box.pack_start(self.toolbar, False, False, 0)
self.go_back_button = Gtk.ToolButton(stock_id=Gtk.STOCK_GO_BACK)
self.toolbar.insert(self.go_back_button, -1)
self.go_forward_button = Gtk.ToolButton(stock_id=Gtk.STOCK_GO_FORWARD)
self.toolbar.insert(self.go_forward_button, -1)
self.go_refresh_button = Gtk.ToolButton(stock_id=Gtk.STOCK_REFRESH)
self.toolbar.insert(self.go_refresh_button, -1)
self.url = Gtk.Entry()
self.box.pack_start(self.url, True, True, 0)
self.search_entry = Gtk.SearchEntry()
self.box.pack_start(self.search_entry, False, False, 0)
self.vbox.pack_start(self.box, False, False, 0)
self.view = WebKit.WebView()
self.scrolled_window = Gtk.ScrolledWindow()
self.scrolled_window.add(self.view)
self.vbox.pack_start(self.scrolled_window, True, True, 0)
self.window.show_all()
self.view.connect("load-committed", self.check_buttons)
self.view.connect("title-changed", self.change_title)
self.url.connect("activate", self.go)
self.search_entry.connect("activate", self.search)
self.go_back_button.connect("clicked", self.go_back)
self.go_forward_button.connect("clicked", self.go_forward)
self.go_refresh_button.connect("clicked", self.refresh)
self.view.open(url)
self.view.show()
示例9: _init_view
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Toolbar [as 别名]
def _init_view(self):
self.buffer.object_attrib.connect('changed', self.on_attrib_changed)
self.view = GtkSource.View()
self.view.set_buffer(self.buffer)
self.view.modify_font(Pango.FontDescription('monospace'))
self.view.set_auto_indent(True)
self.view.set_smart_home_end(True)
self.view.set_highlight_current_line(True)
self.view.set_right_margin_position(80)
self.view.set_show_right_margin(True)
self.view.set_tab_width(4)
self.view.set_show_line_numbers(self.buffer.object_attrib['linenumbers'])
self.view.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
self.WRAP_MODE = {
WRAP_NONE: Gtk.WrapMode.NONE,
WRAP_WORD_CHAR: Gtk.WrapMode.WORD_CHAR,
WRAP_CHAR: Gtk.WrapMode.CHAR,
WRAP_WORD: Gtk.WrapMode.WORD,
}
# simple toolbar
#~ bar = Gtk.HBox() # FIXME: use Gtk.Toolbar stuff
#~ lang_selector = Gtk.ComboBoxText()
#~ lang_selector.append_text('(None)')
#~ for l in lang_names: lang_selector.append_text(l)
#~ try:
#~ lang_selector.set_active(lang_ids.index(self._attrib['lang'])+1)
#~ self.set_language(self._attrib['lang'] or None, False)
#~ except (ValueError, KeyError):
#~ lang_selector.set_active(0)
#~ self.set_language(None, False)
#~ lang_selector.connect('changed', self.on_lang_changed)
#~ bar.pack_start(lang_selector, False, False)
#~ line_numbers = Gtk.ToggleButton('Line numbers')
#~ try:
#~ line_numbers.set_active(self._attrib['linenumbers']=='true')
#~ self.show_line_numbers(self._attrib['linenumbers'], False)
#~ except (ValueError, KeyError):
#~ line_numbers.set_active(True)
#~ self.show_line_numbers(True, False)
#~ line_numbers.connect('toggled', self.on_line_numbers_toggled)
#~ bar.pack_start(line_numbers, False, False)
#~ self.add_header(bar)
# TODO: other toolbar options
# TODO: autohide toolbar if textbuffer is not active
win = ScrolledWindow(self.view, Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER, Gtk.ShadowType.NONE)
self.add(win)
self.view.connect('populate-popup', self.on_populate_popup)