本文整理汇总了Python中sugar3.graphics.toolbarbox.ToolbarBox.show_all方法的典型用法代码示例。如果您正苦于以下问题:Python ToolbarBox.show_all方法的具体用法?Python ToolbarBox.show_all怎么用?Python ToolbarBox.show_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbarbox.ToolbarBox
的用法示例。
在下文中一共展示了ToolbarBox.show_all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def __init__(self, handle):
"The entry point to the Activity"
activity.Activity.__init__(self, handle)
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, 0)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
stop_button = StopButton(self)
toolbar_box.toolbar.insert(stop_button, -1)
self.set_toolbar_box(toolbar_box)
toolbar_box.show_all()
# Draw the canvas
self._canvas = MyCanvas()
self.set_canvas(self._canvas)
self._canvas.show()
GObject.timeout_add(100, read_accelerometer, self._canvas)
示例2: CollabEditActivity
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
class CollabEditActivity(activity.Activity):
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self.toolbarbox = ToolbarBox()
self.toolbar = self.toolbarbox.toolbar
self.set_toolbar_box(self.toolbarbox)
self.edit = collabedit.CollabEdit(self)
self.edit.connect("cursor-position-changed", self._cursor_positon_changed_cb)
self.set_canvas(self.edit)
self.setup_toolbar()
self.show_all()
def _cursor_positon_changed_cb(self, edit, pos):
self.button_bold.props.active = self.edit.check_tag_at_offset("bold", pos)
self.button_italic.props.active = self.edit.check_tag_at_offset("italic", pos)
self.button_underline.props.active = self.edit.check_tag_at_offset("underline", pos)
def setup_toolbar(self):
activity_button = ActivityToolbarButton(self)
self.toolbar.insert(activity_button, -1)
self.toolbar.insert(Gtk.SeparatorToolItem(), -1)
edit_toolbar = EditToolbar()
self.toolbar.insert(ToolbarButton(page=edit_toolbar, icon_name="toolbar-edit"), -1)
edit_toolbar.insert(Gtk.SeparatorToolItem(), -1)
self.button_bold = ToggleToolButton("format-text-bold")
self.button_bold.set_tooltip(_("Bold"))
self.button_bold.props.accelerator = "<Ctrl>B"
self.button_bold.connect("toggled", lambda button: self.edit.toggle_bold())
edit_toolbar.insert(self.button_bold, -1)
self.button_italic = ToggleToolButton("format-text-italic")
self.button_italic.set_tooltip(_("Italic"))
self.button_italic.props.accelerator = "<Ctrl>I"
self.button_italic.connect("toggled", lambda button: self.edit.toggle_italic())
edit_toolbar.insert(self.button_italic, -1)
self.button_underline = ToggleToolButton("format-text-underline")
self.button_underline.set_tooltip(_("Underline"))
self.button_underline.props.accelerator = "<Ctrl>B"
self.button_underline.connect("toggled", lambda button: self.edit.toggle_underline())
edit_toolbar.insert(self.button_underline, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
self.toolbar.insert(separator, -1)
stop_button = StopButton(self)
self.toolbar.insert(stop_button, -1)
self.toolbarbox.show_all()
edit_toolbar.show_all()
示例3: _setup_toolbarbox
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def _setup_toolbarbox(self):
toolbarbox = ToolbarBox()
self.set_toolbar_box(toolbarbox)
toolbarbox.toolbar.insert(ActivityToolbarButton(self), -1)
toolbarbox.toolbar.insert(Gtk.SeparatorToolItem(), -1)
toolbarbox.toolbar.insert(StopButton(self), -1)
names = ""
parser = SafeConfigParser()
parser.read("config.ini")
for data in [("dic", "A"), ("dic", "E"), ("dic", "I"), ("dic", "O"), ("dic", "U"), ("dic", "Y"), ("dic", "G")]:
names += parser.get(*data) + " "
names = names[:-1]
help_button = HelpButton()
help_button.add_paragraph(_("Para traducir algo, debes escribirlo en la entrada de abajo y luego presionar enter."))
help_button.add_paragraph(_("También puedes ver las traducciones abajo."))
help_button.add_paragraph(_("Al precionar uno de los botones (%s), su texto se insertará en la entrada de escritura" % names))
toolbarbox.toolbar.insert(help_button, 2)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbarbox.toolbar.insert(separator, 3)
toolbarbox.show_all()
toolbarbox.toolbar.show_all()
示例4: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def __init__(self, handle):
print "running activity init", handle
activity.Activity.__init__(self, handle)
print "activity running"
self.set_title('Teach Teacher')
toolbarbox = ToolbarBox()
self.set_toolbar_box(toolbarbox)
toolbar = Gtk.Toolbar()
button = ActivityToolbarButton(self)
toolbarbox.toolbar.insert(button, -1)
self.goBack = ToolButton('go-left')
self.goBack.set_tooltip("Go Back")
self.goBack.connect('clicked', self.back_clicked)
toolbar.insert(self.goBack, -1)
self.home = ToolButton('go-home')
self.home.set_tooltip("Home")
self.home.connect('clicked', self.home_clicked)
toolbar.insert(self.home, -1)
self.xois = ToolButton('computer-xo')
self.xois.set_tooltip("T's XO")
self.xois.connect('clicked', self.xois_clicked)
# toolbar.insert(self.xois, -1)
# self.xois.show()
self.guide = ToolButton('go-next')
self.guide.set_tooltip("T's Guide")
self.guide.connect('clicked', self.guide_clicked)
# toolbar.insert(self.guide, -1)
# self.guide.show()
toolbarbox.toolbar.insert(ToolbarButton(page=toolbar, icon_name='toolbar-edit'), -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbarbox.toolbar.insert(separator, -1)
stop_button = StopButton(self)
toolbarbox.toolbar.insert(stop_button, -1)
scroll = Gtk.ScrolledWindow()
self.set_canvas(scroll)
self.webview = WebView()
self.webview.load_uri('http://147.47.120.20/~tsquare/menu.php')
scroll.add(self.webview)
toolbar.show_all()
toolbarbox.show_all()
toolbarbox.toolbar.show_all()
self.show_all()
print "AT END OF THE CLASS"
示例5: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self._selected_image = None
self.max_participants = 1
toolbarbox = ToolbarBox()
self.set_toolbar_box(toolbarbox)
activity_button = ActivityToolbarButton(self)
toolbarbox.toolbar.insert(activity_button, 0)
activity_button.show()
self.save_button = ToolButton('image-save')
self.save_button.set_tooltip(_('Save to Journal'))
self.save_button.connect('clicked', self._save_to_journal)
self.save_button.set_sensitive(False)
self.save_button.show()
toolbarbox.toolbar.insert(self.save_button, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbarbox.toolbar.insert(separator, -1)
stop_button = StopButton(self)
toolbarbox.toolbar.insert(stop_button, -1)
stop_button.show()
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
self.set_canvas(scrolled_window)
scrolled_window.show()
store = Gtk.ListStore(GdkPixbuf.Pixbuf, str)
icon_view = Gtk.IconView.new_with_model(store)
icon_view.set_selection_mode(Gtk.SelectionMode.SINGLE)
icon_view.connect('selection-changed', self._clipart_selected, store)
icon_view.set_pixbuf_column(0)
rgba = Gdk.RGBA()
rgba.red, rgba.green, rgba.blue, rgba.alpha = 0.67, 0.67, 0.67, 1.0
icon_view.override_background_color(Gtk.StateFlags.NORMAL, rgba)
icon_view.grab_focus()
scrolled_window.add(icon_view)
icon_view.show()
toolbarbox.show_all()
self.show_all()
self.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
self._notify()
GObject.idle_add(_fill_clipart_list, store)
示例6: _setup_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def _setup_toolbar(self):
toolbarbox = ToolbarBox()
self.set_toolbar_box(toolbarbox)
toolbarbox.toolbar.insert(ActivityToolbarButton(self), -1)
toolbarbox.toolbar.insert(StopButton(self), -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbarbox.toolbar.insert(separator, 1)
toolbarbox.show_all()
toolbarbox.toolbar.show_all()
示例7: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def build_toolbar(self, activity):
# Prepare Primary Toolbar Container
toolbar_box = ToolbarBox();
# Create activity button
toolbar_box.toolbar.insert(ActivityButton(activity), -1)
# Video Toggle
video_toggle_button = ToolButton()
video_toggle_button.connect("clicked", self.toggle_video)
toolbar_box.toolbar.insert(video_toggle_button, 1)
self.toggle_video(video_toggle_button)
# Audio Toggle
audio_toggle_button = ToolButton()
audio_toggle_button.connect("clicked", self.toggle_audio)
toolbar_box.toolbar.insert(audio_toggle_button, 2)
self.toggle_audio(audio_toggle_button)
# Toggle Preview Display Button
preview_toggle_button = ToolButton()
preview_toggle_button.connect("clicked", self.toolbar_toggle_preview_visibility)
toolbar_box.toolbar.insert(preview_toggle_button, 3)
self.toolbar_toggle_preview_visibility(preview_toggle_button)
# Forced Refresh
reload_video = ToolButton("view-refresh")
reload_video.set_tooltip_text(_("Reload Video"))
reload_video.connect("clicked", self.force_redraw)
toolbar_box.toolbar.insert(reload_video, -1)
# Push stop button to far right
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
# Create Share Button
toolbar_box.toolbar.insert(ShareButton(activity), -1)
# Create stop button
toolbar_box.toolbar.insert(StopButton(activity), -1)
# Add reference to toolbar items
self.toolbar = toolbar_box.toolbar
# Display all components & Return
toolbar_box.show_all()
return toolbar_box
示例8: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def __init__(self, handle, parent=None, **kwargs):
gvr_gtk_glade.window_main.__init__(self)
self._parent = parent
self._parent.set_canvas(self)
self.logger = logging.getLogger("gvr.gvr_gtk.WindowXO")
# Get and set the sugar toolbar
toolbarbox = ToolbarBox()
self._parent.set_toolbar_box(toolbarbox)
toolbarbox.show_all()
toolbar = toolbarbox.toolbar
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar.insert(separator, -1)
stop_button = StopButton(self._parent)
toolbar.insert(stop_button, -1)
toolbar.show_all()
# remove seperator and 'quit' menu items as we have the sugar toolbox
self.imagemenuitem49.destroy()
# Embed webview as the lessons display
self.WV = WebView()
file = os.path.join(utils.get_rootdir(), 'docs', 'lessons', utils.get_locale()[:2], 'html', 'index.html')
self.logger.debug("Looking for the lessons in %s" % file)
if not os.path.exists(file):
self.logger.debug("%s not found, loading default English lessons" % file)
file = os.path.join(utils.get_rootdir(), 'docs', 'lessons', 'en', 'html', 'index.html')
self.WV.open('file:///%s' % file)
scroll = Gtk.ScrolledWindow()
scroll.add(self.WV)
vbox = Gtk.VBox(False, 4)
vbox.pack_start(Widgets.WebToolbar(self.WV), False, False, 2)
vbox.pack_start(scroll, True, True, 2)
vbox.show_all()
self.eventboxlessons.add(vbox)
self.new()
self.show_all()
示例9: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def build_toolbar(self):
"""Build our Activity toolbar for the Sugar system."""
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, 0)
activity_button.show()
separator = Gtk.SeparatorToolItem()
toolbar_box.toolbar.insert(separator, -1)
separator.show()
easier_button = ToolButton('create-easier')
easier_button.set_tooltip(_('Easier level'))
easier_button.connect('clicked', self._easier_button_cb)
toolbar_box.toolbar.insert(easier_button, -1)
harder_button = ToolButton('create-harder')
harder_button.set_tooltip(_('Harder level'))
harder_button.connect('clicked', self._harder_button_cb)
toolbar_box.toolbar.insert(harder_button, -1)
separator = Gtk.SeparatorToolItem()
toolbar_box.toolbar.insert(separator, -1)
separator.show()
self.show_trail_button = ToggleToolButton('show-trail')
self.show_trail_button.set_tooltip(_('Show trail'))
self.show_trail_button.set_active(True)
self.show_trail_button.connect('toggled', self._toggled_show_trail_cb)
toolbar_box.toolbar.insert(self.show_trail_button, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_size_request(0, -1)
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()
self.set_toolbar_box(toolbar_box)
toolbar_box.show_all()
return toolbar_box
示例10: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def __init__(self, handle):
"The entry point to the Activity"
activity.Activity.__init__(self, handle, False)
self.max_participants = 1
self._sequence = 0
self.selected_book = None
self.queryresults = None
self._getter = None
self.show_images = True
self.languages = {}
self._lang_code_handler = languagenames.LanguageNames()
self.catalogs_configuration = {}
self.catalog_history = []
if os.path.exists('/etc/get-books.cfg'):
self._read_configuration('/etc/get-books.cfg')
else:
self._read_configuration()
toolbar_box = ToolbarBox()
activity_button = ToolButton()
color = profile.get_color()
bundle = ActivityBundle(activity.get_bundle_path())
icon = Icon(file=bundle.get_icon(), xo_color=color)
activity_button.set_icon_widget(icon)
activity_button.show()
toolbar_box.toolbar.insert(activity_button, 0)
self._add_search_controls(toolbar_box.toolbar)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
toolbar_box.toolbar.insert(StopButton(self), -1)
self.set_toolbar_box(toolbar_box)
toolbar_box.show_all()
self._books_toolbar = toolbar_box.toolbar
self._create_controls()
self.using_powerd = os.access(POWERD_INHIBIT_DIR, os.W_OK)
self.__book_downloader = self.__image_downloader = None
示例11: crear_toolbars
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def crear_toolbars(self):
# toolbar with the new toolbar redesign
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, 0)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
stop_button = StopButton(self)
toolbar_box.toolbar.insert(stop_button, -1)
self.set_toolbar_box(toolbar_box)
toolbar_box.show_all()
示例12: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def __init__(self, handle):
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
from gi.repository import Pango
from gi.repository import Vte
super(VteActivity, self).__init__(handle, create_jobject=False)
self.__source_object_id = None
# creates vte widget
self._vte = Vte.Terminal()
if DEBUG_TERMINAL:
toolbox = ToolbarBox(self)
toolbar = toolbox.toolbar
self.set_toolbar_box(toolbox)
self._vte.set_size(30, 5)
self._vte.set_size_request(200, 300)
font = 'Monospace 10'
self._vte.set_font(Pango.FontDescription(font))
self._vte.set_colors(Gdk.color_parse('#E7E7E7'),
Gdk.color_parse('#000000'),
[])
vtebox = Gtk.HBox()
vtebox.pack_start(self._vte, True, True, 0)
vtesb = Gtk.VScrollbar()
vtebox.pack_start(vtesb, False, False, 0)
self.set_canvas(vtebox)
toolbox.show_all()
vtebox.show_all()
# now start subprocess.
self._vte.connect('child-exited', self.on_child_exit)
self._vte.grab_focus()
bundle_path = activity.get_bundle_path()
self._pid = self._vte.spawn_sync(
Vte.PtyFlags.DEFAULT, bundle_path, [
'/bin/sh', '-c', 'python %s/LemonadeStand.py --width=1200 --height=900 --font=36' %
bundle_path], [
"PYTHONPATH=%s/library" %
bundle_path], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None)
示例13: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def __init__(self, handle):
activity.Activity.__init__(self, handle)
#self.set_title('Blender Activity')
os.environ['LD_LIBRARY_PATH'] = "%s:%s" % (os.path.join(bundle_path, ARCH, 'lib'), os.environ.get('LD_LIBRARY_PATH', ''))
#os.environ['PATH'] = "%s:%s" % (os.path.join(bundle_path, ARCH, 'bin'), os.environ.get('PATH', ''))
toolbarbox = ToolbarBox()
self.set_toolbar_box(toolbarbox)
toolbarbox.show_all()
button = ActivityToolbarButton(self)
toolbarbox.toolbar.insert(button, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbarbox.toolbar.insert(separator, -1)
button = StopButton(self)
toolbarbox.toolbar.insert(button, -1)
self.hbox = Gtk.HBox()
self.set_canvas(self.hbox)
self.vt = Vte.Terminal()
self.vt.connect("child-exited", self._child_exited)
self.vt.connect("realize", self.start_all)
self.hbox.pack_start(self.vt, True, True, 0)
self.vt.set_font(Pango.FontDescription("Monospace 13"))
self.vt.set_audible_bell(False)
foreground = Gdk.Color.parse('#000000')[1]
background = Gdk.Color.parse('#E7E7E7')[1]
self.vt.set_colors(Gdk.RGBA.from_color(foreground),
Gdk.RGBA.from_color(background),
[])
scrollbar = Gtk.VScrollbar.new(self.vt.get_vadjustment())
self.hbox.pack_start(scrollbar, False, False, 0)
self.show_all()
示例14: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def build_toolbar(self):
# Prepare Primary Toolbar Container
toolbar_box = ToolbarBox();
# Create activity button
toolbar_box.toolbar.insert(ActivityButton(self.activity), -1)
# Storage for Toggle Buttons
self.settings_buttons = {}
# Video Toggle
self.settings_buttons["toggle_video"] = ToolButton()
self.settings_buttons["toggle_video"].connect("clicked", self.toggle_video)
toolbar_box.toolbar.insert(self.settings_buttons["toggle_video"], -1)
# Audio Toggle
self.settings_buttons["toggle_audio"] = ToolButton()
self.settings_buttons["toggle_audio"].connect("clicked", self.toggle_audio)
toolbar_box.toolbar.insert(self.settings_buttons["toggle_audio"], -1)
# Forced Refresh
reload_video = ToolButton("view-refresh")
reload_video.set_tooltip_text(_("Reload Video"))
reload_video.connect("clicked", self.force_redraw)
toolbar_box.toolbar.insert(reload_video, -1)
# Push stop button to far right
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
# Create stop button
toolbar_box.toolbar.insert(StopButton(self.activity), -1)
# Run Toggles
self.run_toggles()
# Display all components & Return
toolbar_box.show_all()
return toolbar_box
示例15: _make_toolbars
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import show_all [as 别名]
def _make_toolbars(self):
"""Prepare and set the toolbars of the activity.
Load and show icons. Associate them to the call back methods.
"""
self.max_participants = 1
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
activity_button.show()
toolbar_box.toolbar.insert(activity_button, 0)
self._add_clock_controls(toolbar_box.toolbar)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_size_request(0, -1)
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
toolbar_box.toolbar.insert(StopButton(self), -1)
self.set_toolbar_box(toolbar_box)
toolbar_box.show_all()
return toolbar_box