Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 3
0
 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()
Exemplo n.º 4
0
 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()
Exemplo n.º 5
0
    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

        # top toolbar with share and close buttons:
        toolbox = ActivityToolbox(self)
        self.set_toolbox(toolbox)
        toolbox.show()
        
        v = gtk.VBox()
        self.startup_label = gtk.Label(self.message)
        v.pack_start(self.startup_label)
        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(gtk.gdk.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)
Exemplo n.º 6
0
    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

        if OLD_TOOLBAR:
            self.toolbox = ActivityToolbox(self)
            self.set_toolbox(self.toolbox)
            self.toolbox.show()
            self.set_toolbox(self.toolbox)
        else:
            toolbar_box = ToolbarBox()
            self.activity_button = ActivityToolbarButton(self)
            toolbar_box.toolbar.insert(self.activity_button, 0)
            self.set_toolbar_box(toolbar_box)

        v = gtk.VBox()
        self.startup_label = gtk.Label(self.message)
        v.pack_start(self.startup_label)
        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(gtk.gdk.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)