當前位置: 首頁>>代碼示例>>Python>>正文


Python ToolbarBox.size_request方法代碼示例

本文整理匯總了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",
#.........這裏部分代碼省略.........
開發者ID:mpaolino,項目名稱:cuadraditosxo,代碼行數:103,代碼來源:ui.py


注:本文中的sugar.graphics.toolbarbox.ToolbarBox.size_request方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。