当前位置: 首页>>代码示例>>Python>>正文


Python Window.set_canvas方法代码示例

本文整理汇总了Python中sugar3.graphics.window.Window.set_canvas方法的典型用法代码示例。如果您正苦于以下问题:Python Window.set_canvas方法的具体用法?Python Window.set_canvas怎么用?Python Window.set_canvas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sugar3.graphics.window.Window的用法示例。


在下文中一共展示了Window.set_canvas方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set_canvas

# 需要导入模块: from sugar3.graphics.window import Window [as 别名]
# 或者: from sugar3.graphics.window.Window import set_canvas [as 别名]
    def set_canvas(self, canvas):
        """Sets the 'work area' of your activity with the canvas of your
        choice.

        One commonly used canvas is Gtk.ScrolledWindow
        """
        Window.set_canvas(self, canvas)
        if not self._read_file_called:
            canvas.connect('map', self.__canvas_map_cb)
开发者ID:svineet,项目名称:sugar-toolkit-gtk3,代码行数:11,代码来源:activity.py

示例2: _initialize_display

# 需要导入模块: from sugar3.graphics.window import Window [as 别名]
# 或者: from sugar3.graphics.window.Window import set_canvas [as 别名]
    def _initialize_display(self):
        main_widget = self.initialize_display()
        Window.set_canvas(self, main_widget)
        self.initialized = True

        if self.shared_activity and not self._processed_share:
            # We are joining a shared activity, but when_shared has not yet
            # been called
            self.when_shared()
            self._processed_share = True
        self.show_all()
        self.after_init()
开发者ID:Daksh,项目名称:Pippy,代码行数:14,代码来源:sugar_tools.py

示例3: set_canvas

# 需要导入模块: from sugar3.graphics.window import Window [as 别名]
# 或者: from sugar3.graphics.window.Window import set_canvas [as 别名]
    def set_canvas(self, canvas):
        '''
        Sets the 'work area' of your activity with the canvas of your choice.

        One commonly used canvas is Gtk.ScrolledWindow

        Args:
            canvas (:class:`Gtk.Widget`): the widget used as canvas
        '''

        Window.set_canvas(self, canvas)
        if not self._read_file_called:
            canvas.connect('map', self.__canvas_map_cb)
开发者ID:godiard,项目名称:sugar-toolkit-gtk3,代码行数:15,代码来源:activity.py

示例4: __init__

# 需要导入模块: from sugar3.graphics.window import Window [as 别名]
# 或者: from sugar3.graphics.window.Window import set_canvas [as 别名]
    def __init__(self, handle):
        # self.initiating indicates whether this instance has initiated sharing
        # it always starts false, but will be set to true if this activity
        # initiates sharing. In particular, if Activity.__init__ calls
        # self.share(), self.initiating will be set to True.
        self.initiating = False
        # self._processed_share indicates whether when_shared() has been called
        self._processed_share = False
        # self.initialized tracks whether the Activity's display is up and running
        self.initialized = False
        
        self.early_setup()
        
        super(GroupActivity, self).__init__(handle)
        self.dbus_name = self.get_bundle_id()
        self.logger = logging.getLogger(self.dbus_name)
        
        self._handle = handle

        ##GObject.threads_init()

        self._sharing_completed = not self.shared_activity
        self._readfile_completed = not handle.object_id

        if self.shared_activity:
            self.message = self.message_joining
        elif handle.object_id:
            self.message = self.message_loading
        else:
            self.message = self.message_preparing

        toolbar_box = ToolbarBox()
        self.activity_button = ActivityToolbarButton(self)
        toolbar_box.toolbar.insert(self.activity_button, 0)
        self.set_toolbar_box(toolbar_box)

        v = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.startup_label = Gtk.Label(label=self.message)
        v.pack_start(self.startup_label, True, True, 0)
        Window.set_canvas(self,v)
        self.show_all()
        
        # The show_all method queues up draw events, but they aren't executed
        # until the mainloop has a chance to process them.  We want to process
        # them immediately, because we need to show the waiting screen
        # before the waiting starts, not after.
        exhaust_event_loop()
        # exhaust_event_loop() provides the possibility that write_file could
        # be called at this time, so write_file is designed to trigger read_file
        # itself if that path occurs.
        
        self.tubebox = groupthink.TubeBox()
        self.timer = groupthink.TimeHandler("main", self.tubebox)
        self.cloud = groupthink.Group(self.tubebox)
        # self.cloud is extremely important.  It is the unified reference point
        # that contains all state in the system.  Everything else is stateless.
        # self.cloud has to be defined before the call to self.set_canvas, because
        # set_canvas can trigger almost anything, including pending calls to read_file,
        # which relies on self.cloud.
        
        # get the Presence Service
        self.pservice = presenceservice.get_instance()
        # Buddy object for you
        owner = self.pservice.get_owner()
        self.owner = owner

        self.connect('shared', self._shared_cb)
        self.connect('joined', self._joined_cb)
        if self.get_shared():
            if self.initiating:
                self._shared_cb(self)
            else:
                self._joined_cb(self)
        
        self.add_events(Gdk.EventMask.VISIBILITY_NOTIFY_MASK)
        self.connect("visibility-notify-event", self._visible_cb)
        self.connect("notify::active", self._active_cb)
        
        if not self._readfile_completed:
            self.read_file(self._jobject.file_path)
        elif not self.shared_activity:
            GObject.idle_add(self._initialize_cleanstart)
开发者ID:Daksh,项目名称:Pippy,代码行数:84,代码来源:sugar_tools.py


注:本文中的sugar3.graphics.window.Window.set_canvas方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。