本文整理汇总了Python中sugar.graphics.toolbarbox.ToolbarBox.size_request方法的典型用法代码示例。如果您正苦于以下问题:Python ToolbarBox.size_request方法的具体用法?Python ToolbarBox.size_request怎么用?Python ToolbarBox.size_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar.graphics.toolbarbox.ToolbarBox
的用法示例。
在下文中一共展示了ToolbarBox.size_request方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar.graphics.toolbarbox.ToolbarBox import size_request [as 别名]
class UI:
log = logging.getLogger('cuadraditos-ui')
def __init__(self, pca):
self.ca = pca
# listen for ctrl+c & escape key
self.ca.connect('key-press-event', self._key_press_event_cb)
self.ACTIVE = False
self.LAUNCHING = True
self.ca.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK)
self.ca.connect("visibility-notify-event", self._visible_notify_cb)
self.control_bar_ht = 60
# True when we're showing live video feed in the primary screen
self.CAPTUREMODE = True
#self.inset = self.__class__.dim_INSET
#init
self.mapped = False
self.setup = False
self.tbars = {Constants.MODE_VIDEO: 1,
Constants.MODE_HELP: 2}
# Use 0.86 toolbar design
self.toolbox = ToolbarBox()
# Buttons added to the Activity toolbar
activity_button = ActivityToolbarButton(self.ca)
self.toolbox.toolbar.insert(activity_button, 0)
activity_button.show()
separator = gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
separator.show()
self.toolbox.toolbar.insert(separator, -1)
# The ever-present Stop Button
stop_button = StopButton(self)
stop_button.props.accelerator = '<Ctrl>Q'
self.toolbox.toolbar.insert(stop_button, -1)
stop_button.show()
self.ca.set_toolbar_box(self.toolbox)
self.toolbox.show()
self.toolbox_ht = self.toolbox.size_request()[1]
self.vh = gtk.gdk.screen_height() - \
(self.toolbox_ht + self.control_bar_ht)
self.vw = int(self.vh / .75)
main_box = gtk.VBox()
self.ca.set_canvas(main_box)
main_box.get_parent().modify_bg(gtk.STATE_NORMAL,
Constants.color_black.gColor)
main_box.show()
self._play_button = PlayButton()
self._play_button.connect('clicked', self._button_play_click)
main_box.pack_start(self._play_button, expand=True)
self._play_button.show()
self.setup_windows()
def _mapEventCb(self, widget, event):
#when your parent window is ready, turn on the feed of live video
self.capture_window.disconnect(self.MAP_EVENT_ID)
self.mapped = True
self.set_up()
def set_up(self):
if (self.mapped and not self.setup):
self.setup = True
gobject.idle_add(self.final_setup)
def final_setup(self):
self.LAUNCHING = False
self.ACTIVE = self.ca.get_property("visible")
self.update_video_components()
if (self.ACTIVE):
self.ca.capture.play()
def setup_windows(self):
self.window_stack = []
self.capture_window = LiveCaptureWindow(Constants.color_black.gColor)
self.add_to_window_stack(self.capture_window, self.ca)
self.capture_window.set_capture(self.ca.capture)
self.capture_window.set_events(gtk.gdk.BUTTON_RELEASE_MASK)
self.capture_window.connect("button_release_event",
self._live_button_release_cb)
self.capture_window.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK)
self.capture_window.connect("visibility-notify-event",
self._visible_notify_cb)
self.capture_window.connect('key-press-event',
self._key_press_event_cb)
self.hide_all_windows()
self.MAP_EVENT_ID = self.capture_window.connect_after("map-event",
#.........这里部分代码省略.........