本文整理汇总了Python中sugar3.graphics.toolbarbox.ToolbarBox.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ToolbarBox.__init__方法的具体用法?Python ToolbarBox.__init__怎么用?Python ToolbarBox.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbarbox.ToolbarBox
的用法示例。
在下文中一共展示了ToolbarBox.__init__方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self, activity):
ToolbarBox.__init__(self)
self.add_btn = ToolButton(icon_name='list-add',
tooltip=_('Add new favorite view'))
self.insert(self.add_btn, -1)
self.add_btn.connect('clicked', self.add_view)
self.activity = activity
self._favorite_icons = {}
self._view_icons = {}
self._view_buttons = {}
self._favorite_names = {}
if hasattr(desktop, 'get_favorite_names'):
self.favorite_names_enabled = True
else:
self.favorite_names_enabled = False
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
self.insert(separator, -1)
self.load_views()
self.show_all()
示例2: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self):
ToolbarBox.__init__(self)
self._mount_point = None
self._filter_type = None
self._what_filter = None
self.search_entry = iconentry.IconEntry()
self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
'entry-search')
text = _('Search in %s') % _('Journal')
self.search_entry.set_placeholder_text(text)
self.search_entry.connect('activate', self._search_entry_activated_cb)
self.search_entry.connect('changed', self._search_entry_changed_cb)
self.search_entry.add_clear_button()
self._autosearch_timer = None
self._add_widget(self.search_entry, expand=True)
self._favorite_button = ToggleToolButton('emblem-favorite')
self._favorite_button.set_tooltip(_('Favorite entries'))
self._favorite_button.connect('toggled',
self.__favorite_button_toggled_cb)
self.toolbar.insert(self._favorite_button, -1)
self._favorite_button.show()
self._what_search_combo = ComboBox()
self._what_combo_changed_sid = self._what_search_combo.connect(
'changed', self._combo_changed_cb)
tool_item = ToolComboBox(self._what_search_combo)
self.toolbar.insert(tool_item, -1)
tool_item.show()
self._when_search_combo = self._get_when_search_combo()
tool_item = ToolComboBox(self._when_search_combo)
self.toolbar.insert(tool_item, -1)
tool_item.show()
self._sorting_button = SortingButton()
self.toolbar.insert(self._sorting_button, -1)
self._sorting_button.connect('sort-property-changed',
self.__sort_changed_cb)
self._sorting_button.show()
# TODO: enable it when the DS supports saving the buddies.
# self._with_search_combo = self._get_with_search_combo()
# tool_item = ToolComboBox(self._with_search_combo)
# self.insert(tool_item, -1)
# tool_item.show()
self._query = self._build_query()
self.refresh_filters()
示例3: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self, activity):
ToolbarBox.__init__(self)
self.toolbar.insert(ActivityToolbarButton(activity), -1)
self.toolbar.insert(make_separator(expand=False), -1)
self.button_fast = ToolButton("fast-button")
self.toolbar.insert(self.button_fast, -1)
self.button_slow = ToolButton("slow-button")
self.toolbar.insert(self.button_slow, -1)
self.button_step = ToolButton("step-button")
self.toolbar.insert(self.button_step, -1)
self.button_slow_music = ToolButton("slow-music-button")
self.toolbar.insert(self.button_slow_music, -1)
self.button_step_music = ToolButton("step-music-button")
self.toolbar.insert(self.button_step_music, -1)
self.button_stop = ToolButton("stop-turtle-button")
self.toolbar.insert(self.button_stop, -1)
self.button_clear = ToolButton("clear-button")
self.toolbar.insert(self.button_clear, -1)
self.button_palette = ToolButton("palette-button")
self.toolbar.insert(self.button_palette, -1)
self.button_hide_blocks = ToolButton("hide-blocks-button")
self.toolbar.insert(self.button_hide_blocks, -1)
self.button_collapse_blocks = ToolButton("collapse-blocks-button")
self.toolbar.insert(self.button_collapse_blocks, -1)
self.button_help = ToolButton("help-button")
self.toolbar.insert(self.button_help, -1)
self.toolbar.insert(make_separator(expand=True), -1)
self.button_menu = ToolButton("menu-button")
self.toolbar.insert(self.button_menu, -1)
self.toolbar.insert(make_separator(expand=False), -1)
self.toolbar.insert(StopButton(activity), -1)
self.show_all()
self.toolbar.show_all()
示例4: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self):
ToolbarBox.__init__(self)
self._metadata = None
self._temp_file_path = None
self._resume = ToolButton('activity-start')
self._resume.connect('clicked', self._resume_clicked_cb)
self.toolbar.insert(self._resume, -1)
self._resume.show()
client = GConf.Client.get_default()
color = XoColor(client.get_string('/desktop/sugar/user/color'))
self._copy = ToolButton()
icon = Icon(icon_name='edit-copy', xo_color=color)
self._copy.set_icon_widget(icon)
icon.show()
self._copy.set_tooltip(_('Copy to'))
self._copy.connect('clicked', self._copy_clicked_cb)
self.toolbar.insert(self._copy, -1)
self._copy.show()
self._duplicate = ToolButton()
icon = Icon(icon_name='edit-duplicate', xo_color=color)
self._duplicate.set_icon_widget(icon)
self._duplicate.set_tooltip(_('Duplicate'))
self._duplicate.connect('clicked', self._duplicate_clicked_cb)
self.toolbar.insert(self._duplicate, -1)
if len(accountsmanager.get_configured_accounts()) > 0:
self._refresh = ToolButton()
icon = Icon(icon_name='refresh', xo_color=color)
self._refresh.set_icon_widget(icon)
icon.show()
self._refresh.set_tooltip(_('Refresh'))
self._refresh.connect('clicked', self._refresh_clicked_cb)
self.toolbar.insert(self._refresh, -1)
self._refresh.show()
separator = Gtk.SeparatorToolItem()
self.toolbar.insert(separator, -1)
separator.show()
erase_button = ToolButton('list-remove')
erase_button.set_tooltip(_('Erase'))
erase_button.connect('clicked', self._erase_button_clicked_cb)
self.toolbar.insert(erase_button, -1)
erase_button.show()
示例5: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self, activity):
SugarToolbarbox.__init__(self)
activity_button = ActivityToolbarButton(activity)
self.toolbar.insert(activity_button, 0)
self.toolbar.insert(utils.make_separator(False), -1)
toolbar_file = FileToolbar()
toolbar_file.connect("new-page", lambda toolbar: self.emit("new-page"))
toolbar_file.connect(
"chooser-open", lambda toolbar: self.emit("chooser-open"))
toolbar_file.connect("chooser-save", self._chooser_save)
toolbar_file.connect(
"print-file", lambda toolbar: self.emit("print-file"))
self.toolbar.add(toolbar_file.button)
toolbar_edit = EditToolbar()
toolbar_edit.connect("undo", lambda toolbar: self.emit("undo"))
toolbar_edit.connect("redo", lambda toolbar: self.emit("redo"))
toolbar_edit.connect("search-text", self._search_text)
toolbar_edit.connect(
"replace-text", lambda toolbar: self.emit("replace-text"))
self.toolbar.insert(toolbar_edit.button, -1)
toolbar_view = ViewToolbar(activity.conf)
toolbar_view.connect("font-size-changed", self._font_size_changed)
toolbar_view.connect("font-family-changed", self._font_family_changed)
toolbar_view.connect(
"show-line-numbers-changed", self._show_line_numbers_changed)
toolbar_view.connect(
"show-right-line-changed", self._show_right_line_changed)
toolbar_view.connect(
"right-line-pos-changed", self._right_line_pos_changed)
toolbar_view.connect("theme-changed", self._theme_changed)
self.toolbar.insert(toolbar_view.button, -1)
self.toolbar.insert(utils.make_separator(True), -1)
stop_button = StopButton(activity)
stop_button.props.accelerator = "<Ctrl><Shift>Q"
self.toolbar.insert(stop_button, -1)
self.button_undo = toolbar_edit.undo
self.button_redo = toolbar_edit.redo
self.button_save = toolbar_file.button_save
self.entry_search = toolbar_edit.entry_search
self.entry_replace = toolbar_edit.entry_replace
self.spinner_right_line = toolbar_view.spinner_right_line
示例6: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self, journalactivity):
ToolbarBox.__init__(self)
self._journalactivity = journalactivity
self._metadata = None
self._temp_file_path = None
self._refresh = None
self._resume = ToolButton('activity-start')
self._resume.connect('clicked', self._resume_clicked_cb)
self.toolbar.insert(self._resume, -1)
self._resume.show()
self._resume_menu = None
color = profile.get_color()
self._copy = ToolButton()
icon = Icon(icon_name='edit-copy', xo_color=color)
self._copy.set_icon_widget(icon)
icon.show()
self._copy.set_tooltip(_('Copy to'))
self._copy.connect('clicked', self._copy_clicked_cb)
self.toolbar.insert(self._copy, -1)
self._copy.show()
self._duplicate = ToolButton()
icon = Icon(icon_name='edit-duplicate', xo_color=color)
self._duplicate.set_icon_widget(icon)
self._duplicate.set_tooltip(_('Duplicate'))
self._duplicate.connect('clicked', self._duplicate_clicked_cb)
self.toolbar.insert(self._duplicate, -1)
if accountsmanager.has_configured_accounts():
self._refresh = ToolButton('entry-refresh')
self._refresh.set_tooltip(_('Refresh'))
self._refresh.connect('clicked', self._refresh_clicked_cb)
self.toolbar.insert(self._refresh, -1)
self._refresh.show()
separator = Gtk.SeparatorToolItem()
self.toolbar.insert(separator, -1)
separator.show()
erase_button = ToolButton('list-remove')
erase_button.set_tooltip(_('Erase'))
erase_button.connect('clicked', self._erase_button_clicked_cb)
self.toolbar.insert(erase_button, -1)
erase_button.show()
示例7: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self, activity):
ToolbarBox.__init__(self)
activity_button = ActivityToolbarButton(activity)
self.toolbar.insert(activity_button, 0)
activity_button.show()
separator = Gtk.SeparatorToolItem()
self.toolbar.insert(separator, -1)
self.choose_button = ToolButton('view-list')
self.choose_button.set_tooltip(_('Choose a Poll'))
self.toolbar.insert(self.choose_button, -1)
self.create_button = ToolButton('view-source')
self.create_button.set_tooltip(_('Build a Poll'))
self.toolbar.insert(self.create_button, -1)
self.settings_button = ToolButton('preferences-system')
self.settings_button.set_tooltip(_('Settings'))
self.toolbar.insert(self.settings_button, -1)
self.help_button = ToolButton('toolbar-help')
self.help_button.set_tooltip(_('Lesson Plans'))
self.toolbar.insert(self.help_button, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
self.toolbar.insert(separator, -1)
separator.show()
self.toolbar.insert(StopButton(activity), -1)
self.show_all()
示例8: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self, tabbed_view, act):
ToolbarBase.__init__(self)
self._url_toolbar = UrlToolbar()
self._activity = act
self._tabbed_view = self._canvas = tabbed_view
self._loading = False
toolbar = self.toolbar
activity_button = ActivityToolbarButton(self._activity)
toolbar.insert(activity_button, 0)
separator = Gtk.SeparatorToolItem()
save_as_pdf = ToolButton("save-as-pdf")
save_as_pdf.set_tooltip(_("Save page as pdf"))
save_as_pdf.connect("clicked", self.save_as_pdf)
activity_button.props.page.insert(separator, -1)
activity_button.props.page.insert(save_as_pdf, -1)
separator.show()
save_as_pdf.show()
self._go_home = ToolButton("go-home")
self._go_home.set_tooltip(_("Home page"))
self._go_home.connect("clicked", self._go_home_cb)
# add a menu to save the home page
menu_box = PaletteMenuBox()
self._go_home.props.palette.set_content(menu_box)
menu_item = PaletteMenuItem()
menu_item.set_label(_("Select as initial page"))
menu_item.connect("activate", self._set_home_cb)
menu_box.append_item(menu_item)
self._reset_home_menu = PaletteMenuItem()
self._reset_home_menu.set_label(_("Reset initial page"))
self._reset_home_menu.connect("activate", self._reset_home_cb)
menu_box.append_item(self._reset_home_menu)
if os.path.isfile(LIBRARY_PATH):
library_menu = PaletteMenuItem()
library_menu.set_label(_("Library"))
library_menu.connect("activate", self._go_library_cb)
menu_box.append_item(library_menu)
menu_box.show_all()
# verify if the home page is configured
client = GConf.Client.get_default()
self._reset_home_menu.set_visible(client.get_string(HOME_PAGE_GCONF_KEY) is not None)
toolbar.insert(self._go_home, -1)
self._go_home.show()
self.entry = WebEntry()
self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY, "entry-stop")
self.entry.connect("icon-press", self._stop_and_reload_cb)
self.entry.connect("activate", self._entry_activate_cb)
self.entry.connect("focus-in-event", self.__focus_in_event_cb)
self.entry.connect("focus-out-event", self.__focus_out_event_cb)
self.entry.connect("key-press-event", self.__key_press_event_cb)
self.entry.connect("changed", self.__changed_cb)
self._entry_item = Gtk.ToolItem()
self._entry_item.set_expand(True)
self._entry_item.add(self.entry)
self.entry.show()
toolbar.insert(self._entry_item, -1)
self._entry_item.show()
self._back = ToolButton("go-previous-paired")
self._back.set_tooltip(_("Back"))
self._back.props.sensitive = False
self._back.connect("clicked", self._go_back_cb)
toolbar.insert(self._back, -1)
self._back.show()
palette = self._back.get_palette()
self._back_box_menu = Gtk.VBox()
self._back_box_menu.show()
palette.set_content(self._back_box_menu)
# FIXME, this is a hack, should be done in the theme:
palette._content.set_border_width(1)
self._forward = ToolButton("go-next-paired")
self._forward.set_tooltip(_("Forward"))
self._forward.props.sensitive = False
self._forward.connect("clicked", self._go_forward_cb)
toolbar.insert(self._forward, -1)
self._forward.show()
palette = self._forward.get_palette()
self._forward_box_menu = Gtk.VBox()
self._forward_box_menu.show()
palette.set_content(self._forward_box_menu)
#.........这里部分代码省略.........
示例9: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self, activity):
self._activity = activity
ToolbarBox.__init__(self)
activity_button = ActivityToolbarButton(self._activity)
self.toolbar.insert(activity_button, -1)
self._activity.set_toolbar_box(self)
edit_toolbar = ToolbarButton()
edit_toolbar.props.page = DrawEditToolbar(self._activity)
edit_toolbar.props.icon_name = 'toolbar-edit'
edit_toolbar.props.label = _('Edit')
self.toolbar.insert(edit_toolbar, -1)
self._fill_color_button = ButtonFillColor(activity)
self._fill_color_button.set_title(_('Shapes properties'))
item_fill_color = Gtk.ToolItem()
item_fill_color.add(self._fill_color_button)
self._fill_color_button.set_sensitive(False)
self._activity.tool_group = None
self.tools_builder = ToolsToolbarBuilder(self.toolbar, self._activity,
self._fill_color_button)
separator = Gtk.SeparatorToolItem()
separator.set_draw(True)
self.toolbar.insert(separator, -1)
self.shapes_button = DrawToolButton('shapes',
self._activity.tool_group,
_('Shapes'))
self.toolbar.insert(self.shapes_button, -1)
self.shapes_builder = ShapesToolbarBuilder(self._activity,
self.shapes_button,
self._fill_color_button)
self.initialize_brush_shape_tools()
self.toolbar.insert(item_fill_color, -1)
separator = Gtk.SeparatorToolItem()
separator.set_draw(True)
self.toolbar.insert(separator, -1)
fonts_button = ToolbarButton()
fonts_button.props.page = TextToolbar(self._activity)
fonts_button.props.icon_name = 'format-text-size'
fonts_button.props.label = _('Fonts')
self.toolbar.insert(fonts_button, -1)
image_button = ToolbarButton()
image_button.props.page = ImageToolbar(self._activity)
image_button.props.icon_name = 'picture'
image_button.props.label = _('Image')
self.toolbar.insert(image_button, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_size_request(0, -1)
separator.set_expand(True)
self.toolbar.insert(separator, -1)
separator.show()
stop = StopButton(self._activity)
self.toolbar.insert(stop, -1)
# TODO: workaround
# the BrushButton does not starts
self.brush_button = self.tools_builder._stroke_color.color_button
area = self._activity.area
self.brush_button.set_brush_shape(area.tool['line shape'])
self.brush_button.set_brush_size(area.tool['line size'])
self.brush_button.set_stamp_size(area.tool['stamp size'])
# init the color
cairo_stroke_color = area.tool['cairo_stroke_color']
red = cairo_stroke_color[0] * 65535
green = cairo_stroke_color[1] * 65535
blue = cairo_stroke_color[2] * 65535
stroke_color = Gdk.Color(red, green, blue)
self.brush_button.set_color(stroke_color)
示例10: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self, activity):
ToolbarBox.__init__(self)
activity_button = ActivityToolbarButton(activity)
self.toolbar.insert(activity_button, 0)
activity_button.show()
separator = Gtk.SeparatorToolItem()
self.toolbar.insert(separator, -1)
self.choose_button = RadioToolButton('view-list')
self.choose_button.set_tooltip(_('Choose a Poll'))
self.toolbar.insert(self.choose_button, -1)
modes_group = self.choose_button
self.create_button = RadioToolButton('new-poll')
self.create_button.set_tooltip(_('Build a Poll'))
self.toolbar.insert(self.create_button, -1)
self.create_button.props.group = modes_group
self.settings_button = ToolButton('preferences-system')
self.settings_button.set_tooltip(_('Settings'))
self.settings_button.palette_invoker.props.toggle_palette = True
self.settings_button.palette_invoker.props.lock_palette = True
self.settings_button.props.hide_tooltip_on_click = False
palette = self.settings_button.get_palette()
hbox = Gtk.HBox()
self._options_palette = OptionsPalette(activity)
hbox.pack_start(self._options_palette, True, True,
style.DEFAULT_SPACING)
hbox.show_all()
palette.set_content(hbox)
self.toolbar.insert(self.settings_button, -1)
self.toolbar.insert(Gtk.SeparatorToolItem(), -1)
self.pie_chart_button = RadioToolButton('pie-chart')
self.pie_chart_button.set_tooltip(_('Pie chart'))
self.toolbar.insert(self.pie_chart_button, -1)
charts_group = self.pie_chart_button
self.vbar_chart_button = RadioToolButton('vbar-chart')
self.vbar_chart_button.set_tooltip(_('Vertical bar chart'))
self.toolbar.insert(self.vbar_chart_button, -1)
self.vbar_chart_button.props.group = charts_group
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
self.toolbar.insert(separator, -1)
separator.show()
self.toolbar.insert(StopButton(activity), -1)
# add the export buttons
activity_button.page.insert(Gtk.SeparatorToolItem(), -1)
self.export_data_bt = ToolButton('save-as-data')
self.export_data_bt.props.tooltip = _('Export data')
activity_button.page.insert(self.export_data_bt, -1)
self.export_image_bt = ToolButton('save-as-image')
self.export_image_bt.set_tooltip(_("Save as Image"))
activity_button.page.insert(self.export_image_bt, -1)
activity_button.page.show_all()
self.show_all()
示例11: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self, tabbed_view, act):
ToolbarBase.__init__(self)
self._url_toolbar = UrlToolbar()
self._activity = act
self._tabbed_view = self._canvas = tabbed_view
self._loading = False
toolbar = self.toolbar
activity_button = ActivityToolbarButton(self._activity)
toolbar.insert(activity_button, 0)
separator = Gtk.SeparatorToolItem()
save_as_pdf = ToolButton('save-as-pdf')
save_as_pdf.set_tooltip(_('Save page as pdf'))
save_as_pdf.connect('clicked', self.save_as_pdf)
activity_button.props.page.insert(separator, -1)
activity_button.props.page.insert(save_as_pdf, -1)
separator.show()
save_as_pdf.show()
self._go_home = ToolButton('go-home')
self._go_home.set_tooltip(_('Home page'))
self._go_home.connect('clicked', self._go_home_cb)
# add a menu to save the home page
menu_box = PaletteMenuBox()
self._go_home.props.palette.set_content(menu_box)
self._reset_home_menu = PaletteMenuItem()
self._reset_home_menu.set_label(_('Reset initial page'))
self._reset_home_menu.connect('activate', self._reset_home_cb)
menu_box.append_item(self._reset_home_menu)
if os.path.isfile(LIBRARY_PATH):
library_menu = PaletteMenuItem()
library_menu.set_label(_('Library'))
library_menu.connect('activate', self._go_library_cb)
menu_box.append_item(library_menu)
menu_box.show_all()
# verify if the home page is configured
self._reset_home_menu.set_visible(False)
toolbar.insert(self._go_home, -1)
self._go_home.show()
self.entry = WebEntry()
self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY,
'entry-stop')
self.entry.connect('icon-press', self._stop_and_reload_cb)
self.entry.connect('activate', self._entry_activate_cb)
self.entry.connect('focus-in-event', self.__focus_in_event_cb)
self.entry.connect('focus-out-event', self.__focus_out_event_cb)
self.entry.connect('key-press-event', self.__key_press_event_cb)
self.entry.connect('changed', self.__changed_cb)
self._entry_item = Gtk.ToolItem()
self._entry_item.set_expand(True)
self._entry_item.add(self.entry)
self.entry.show()
toolbar.insert(self._entry_item, -1)
self._entry_item.show()
self._back = ToolButton('go-previous-paired')
self._back.set_tooltip(_('Back'))
self._back.props.sensitive = False
self._back.connect('clicked', self._go_back_cb)
toolbar.insert(self._back, -1)
self._back.show()
palette = self._back.get_palette()
self._back_box_menu = Gtk.VBox()
self._back_box_menu.show()
palette.set_content(self._back_box_menu)
# FIXME, this is a hack, should be done in the theme:
palette._content.set_border_width(1)
self._forward = ToolButton('go-next-paired')
self._forward.set_tooltip(_('Forward'))
self._forward.props.sensitive = False
self._forward.connect('clicked', self._go_forward_cb)
toolbar.insert(self._forward, -1)
self._forward.show()
palette = self._forward.get_palette()
self._forward_box_menu = Gtk.VBox()
self._forward_box_menu.show()
palette.set_content(self._forward_box_menu)
# FIXME, this is a hack, should be done in the theme:
palette._content.set_border_width(1)
self._link_add = ToolButton('emblem-favorite')
#.........这里部分代码省略.........
示例12: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import __init__ [as 别名]
def __init__(self, tabbed_view, act):
ToolbarBase.__init__(self)
self._url_toolbar = UrlToolbar()
self._activity = act
self.model = act.model
self.model.link_removed_signal.connect(self.__link_removed_cb)
self._tabbed_view = self._canvas = tabbed_view
self._loading = False
self._download_running_hid = None
toolbar = self.toolbar
activity_button = ActivityToolbarButton(self._activity)
toolbar.insert(activity_button, 0)
separator = Gtk.SeparatorToolItem()
'''
Disabled since the python gi bindings don't expose the critical
WebKit2.PrintOperation.print function
save_as_pdf = ToolButton('save-as-pdf')
save_as_pdf.set_tooltip(_('Save page as pdf'))
save_as_pdf.connect('clicked', self.save_as_pdf)
activity_button.props.page.insert(separator, -1)
activity_button.props.page.insert(save_as_pdf, -1)
separator.show()
save_as_pdf.show()
'''
inspect_view = ToolButton('emblem-view-source')
inspect_view.set_tooltip(_('Show Web Inspector'))
inspect_view.connect('clicked', self.inspect_view)
activity_button.props.page.insert(separator, -1)
activity_button.props.page.insert(inspect_view, -1)
separator.show()
inspect_view.show()
self._go_home = ToolButton('go-home')
self._go_home.set_tooltip(_('Home page'))
self._go_home.connect('clicked', self._go_home_cb)
# add a menu to save the home page
menu_box = PaletteMenuBox()
self._go_home.props.palette.set_content(menu_box)
menu_item = PaletteMenuItem()
menu_item.set_label(_('Select as initial page'))
menu_item.connect('activate', self._set_home_cb)
menu_box.append_item(menu_item)
self._reset_home_menu = PaletteMenuItem()
self._reset_home_menu.set_label(_('Reset initial page'))
self._reset_home_menu.connect('activate', self._reset_home_cb)
menu_box.append_item(self._reset_home_menu)
if os.path.isfile(LIBRARY_PATH):
library_menu = PaletteMenuItem()
library_menu.set_label(_('Library'))
library_menu.connect('activate', self._go_library_cb)
menu_box.append_item(library_menu)
menu_box.show_all()
# verify if the home page is configured
client = GConf.Client.get_default()
self._reset_home_menu.set_visible(
client.get_string(HOME_PAGE_GCONF_KEY) is not None)
toolbar.insert(self._go_home, -1)
self._go_home.show()
self.entry = WebEntry()
self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY,
'entry-stop')
self.entry.connect('icon-press', self._stop_and_reload_cb)
self.entry.connect('activate', self._entry_activate_cb)
self.entry.connect('focus-in-event', self.__focus_in_event_cb)
self.entry.connect('focus-out-event', self.__focus_out_event_cb)
self.entry.connect('key-press-event', self.__key_press_event_cb)
self.entry.connect('changed', self.__changed_cb)
# In an event box so that it can render the background
entry_box = Gtk.EventBox()
entry_box.add(self.entry)
entry_box.show()
self._entry_item = Gtk.ToolItem()
self._entry_item.set_expand(True)
self._entry_item.add(entry_box)
self.entry.show()
toolbar.insert(self._entry_item, -1)
self._entry_item.show()
self._back = ToolButton('go-previous-paired',
accelerator='<ctrl>Left')
#.........这里部分代码省略.........