Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/BatallaNaval.activity/BatallaNavalActivity.py
blob: 1c7741656f9d632fb10d1b560150f1cd52f8f114 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from sugar.activity.activity import Activity, ActivityToolbox
import BatallaNaval
from Collaboration import CollaborationWrapper

class BatallaNavalActivity(Activity):
    def __init__(self, handle):
        Activity.__init__(self, handle)
        self.connect('destroy', self._cleanup_cb)
    
        self.gamename = 'BatallaNaval'
        self.set_title("Batalla Naval")
    
        # connect to the in/out events
        self.connect('focus_in_event', self._focus_in)
        self.connect('focus_out_event', self._focus_out)
        
        self.colaboracion = CollaborationWrapper(self, None, None, None)
        self.connect('shared', self.colaboracion._shared_cb)
        if self._shared_activity:
            # We are joining the activity
            self.connect('joined', self.colaboracion._joined_cb)
            if self.get_shared():
                # We've already joined
                self.colaboracion._joined_cb()
        
        # The activity is a subclass of Window, so it passses itself to the init function
        BatallaNaval.init(False, self)
        # It never returns, gtk.main()
    
    def _cleanup_cb(self, data=None):
        return
    
    # We could use these methods to conserve power by having the activity stop processing when it is in the background.
    def _focus_in(self, event, data=None):
        return
    
    def _focus_out(self, event, data=None):
        return