本文整理汇总了Python中sugar3.graphics.toolbarbox.ToolbarButton.hide方法的典型用法代码示例。如果您正苦于以下问题:Python ToolbarButton.hide方法的具体用法?Python ToolbarButton.hide怎么用?Python ToolbarButton.hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbarbox.ToolbarButton
的用法示例。
在下文中一共展示了ToolbarButton.hide方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LogActivity
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import hide [as 别名]
class LogActivity(activity.Activity):
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self._autosearch_timer = None
# Paths to watch: ~/.sugar/someuser/logs, /var/log
paths = []
paths.append(env.get_profile_path('logs'))
paths.append('/var/log')
# Additional misc files.
ext_files = []
ext_files.append(os.path.expanduser('~/.bash_history'))
self.viewer = MultiLogView(paths, ext_files)
self.set_canvas(self.viewer)
self.viewer.grab_focus()
self._build_toolbox()
# Get Sugar's clipboard
self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
self.show()
self._configure_cb(None)
Gdk.Screen.get_default().connect('size-changed', self._configure_cb)
def _build_toolbox(self):
toolbar_box = ToolbarBox()
self.max_participants = 1
activity_button = ActivityToolbarButton(self)
activity_toolbar = activity_button.page
self._toolbar = toolbar_box.toolbar
self._toolbar.insert(activity_button, -1)
self._secondary_toolbar = Gtk.Toolbar()
self._secondary_toolbar_button = ToolbarButton(
page=self._secondary_toolbar,
icon_name='system-search')
self._secondary_toolbar.show()
self._toolbar.insert(self._secondary_toolbar_button, -1)
self._secondary_toolbar_button.hide()
show_list = ToggleToolButton('view-list')
show_list.set_active(True)
show_list.set_tooltip(_('Show list of files'))
show_list.connect('toggled', self._list_toggled_cb)
self._toolbar.insert(show_list, -1)
show_list.show()
copy = CopyButton()
copy.connect('clicked', self.__copy_clicked_cb)
self._toolbar.insert(copy, -1)
wrap_btn = ToggleToolButton("format-wrap")
wrap_btn.set_tooltip(_('Word Wrap'))
wrap_btn.connect('clicked', self._wrap_cb)
self._toolbar.insert(wrap_btn, -1)
self.search_entry = iconentry.IconEntry()
self.search_entry.set_size_request(Gdk.Screen.width() / 3, -1)
self.search_entry.set_icon_from_name(
iconentry.ICON_ENTRY_PRIMARY, 'entry-search')
self.search_entry.add_clear_button()
self.search_entry.connect('activate', self._search_entry_activate_cb)
self.search_entry.connect('changed', self._search_entry_changed_cb)
self._search_item = Gtk.ToolItem()
self._search_item.add(self.search_entry)
self._toolbar.insert(self._search_item, -1)
self._search_prev = ToolButton('go-previous-paired')
self._search_prev.set_tooltip(_('Previous'))
self._search_prev.connect('clicked', self._search_prev_cb)
self._toolbar.insert(self._search_prev, -1)
self._search_next = ToolButton('go-next-paired')
self._search_next.set_tooltip(_('Next'))
self._search_next.connect('clicked', self._search_next_cb)
self._toolbar.insert(self._search_next, -1)
self._update_search_buttons()
self.collector_palette = CollectorPalette(self)
collector_btn = ToolButton('log-export')
collector_btn.set_palette(self.collector_palette)
collector_btn.connect('clicked', self._logviewer_cb)
collector_btn.show()
activity_toolbar.insert(collector_btn, -1)
self._delete_btn = ToolButton('list-remove')
self._delete_btn.set_tooltip(_('Delete Log File'))
self._delete_btn.connect('clicked', self._delete_log_cb)
self._toolbar.insert(self._delete_btn, -1)
self._separator = Gtk.SeparatorToolItem()
#.........这里部分代码省略.........
示例2: JukeboxActivity
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import hide [as 别名]
class JukeboxActivity(activity.Activity):
__gsignals__ = {
'playlist-finished': (GObject.SignalFlags.RUN_FIRST, None, []), }
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self.player = None
self._alert = None
self._playlist_jobject = None
self.set_title(_('Jukebox Activity'))
self.max_participants = 1
self._toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
activity_toolbar = activity_button.page
self._toolbar_box.toolbar.insert(activity_button, 0)
self.title_entry = activity_toolbar.title
self._view_toolbar = ViewToolbar()
self._view_toolbar.connect('go-fullscreen',
self.__go_fullscreen_cb)
self._view_toolbar.connect('toggle-playlist',
self.__toggle_playlist_cb)
view_toolbar_button = ToolbarButton(
page=self._view_toolbar,
icon_name='toolbar-view')
self._view_toolbar.show()
self._toolbar_box.toolbar.insert(view_toolbar_button, -1)
view_toolbar_button.show()
self._control_toolbar = Gtk.Toolbar()
self._control_toolbar_button = ToolbarButton(
page=self._control_toolbar,
icon_name='media-playback-start')
self._control_toolbar.show()
self._toolbar_box.toolbar.insert(self._control_toolbar_button, -1)
self._control_toolbar_button.hide()
self.set_toolbar_box(self._toolbar_box)
self._toolbar_box.show_all()
self.connect('key_press_event', self.__key_press_event_cb)
self.connect('playlist-finished', self.__playlist_finished_cb)
# We want to be notified when the activity gets the focus or
# loses it. When it is not active, we don't need to keep
# reproducing the video
self.connect('notify::active', self.__notify_active_cb)
self._video_canvas = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self._playlist_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.playlist_widget = PlayList()
self.playlist_widget.connect('play-index', self.__play_index_cb)
self.playlist_widget.connect('missing-tracks',
self.__missing_tracks_cb)
self.playlist_widget.set_size_request(
Gdk.Screen.width() * PLAYLIST_WIDTH_PROP, 0)
self.playlist_widget.show()
self._playlist_box.pack_start(self.playlist_widget, expand=True,
fill=True, padding=0)
self._playlist_toolbar = Gtk.Toolbar()
move_up = ToolButton("go-up")
move_up.set_tooltip(_("Move up"))
move_up.connect("clicked", self._move_up_cb)
self._playlist_toolbar.insert(move_up, 0)
move_down = ToolButton("go-down")
move_down.set_tooltip(_("Move down"))
move_down.connect("clicked", self._move_down_cb)
self._playlist_toolbar.insert(move_down, 1)
self._playlist_box.pack_end(self._playlist_toolbar, False, False, 0)
self._video_canvas.pack_start(self._playlist_box, False, False, 0)
# Create the player just once
logging.debug('Instantiating GstPlayer')
self.player = GstPlayer()
self.player.connect('eos', self.__player_eos_cb)
self.player.connect('error', self.__player_error_cb)
self.player.connect('play', self.__player_play_cb)
self.control = Controls(self, self._toolbar_box.toolbar,
self._control_toolbar)
self._separator = Gtk.SeparatorToolItem()
self._separator.props.draw = False
self._separator.set_expand(True)
self._separator.show()
self._toolbar_box.toolbar.insert(self._separator, -1)
self._stop = StopButton(self)
#.........这里部分代码省略.........