コード例 #1
0
    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)
コード例 #2
0
    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)
コード例 #3
0
ファイル: sugar_tools.py プロジェクト: vikramahuja1001/Pippy
    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()
コード例 #4
0
ファイル: sugar_tools.py プロジェクト: Daksh/Pippy
    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()
コード例 #5
0
    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)
コード例 #6
0
    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)
コード例 #7
0
ファイル: sugar_tools.py プロジェクト: vikramahuja1001/Pippy
    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)
コード例 #8
0
ファイル: sugar_tools.py プロジェクト: Daksh/Pippy
    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)