Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/addons/WidgetIdentifier.py
blob: 3c559b50ba561e5e522fdc56e42a9d61b1f2f20b (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
from sugar.tutorius.actions import Action
from sugar.tutorius.editor import WidgetIdentifier as WIPrimitive
from sugar.tutorius.services import ObjectStore

class WidgetIdentifier(Action):
    def __init__(self):
        Action.__init__(self)
        self.activity = None
        self._dialog = None

    def do(self):
        os = ObjectStore()
        if os.activity:
            self.activity = os.activity

            self._dialog = WIPrimitive(self.activity)
            self._dialog.show()


    def undo(self):
        if self._dialog:
            # TODO elavoie 2009-07-19 
            # We should disconnect the handlers, however there seems to be an error
            # saying that the size of the dictionary changed during the iteration
            # We should investigate this
            #self._dialog._disconnect_handlers()
            self._dialog.destroy()

__action__ = {
    "name" : "WidgetIdentifier",
    "display_name" : "Widget Identifier",
    "icon" : "message-bubble",
    "class" : WidgetIdentifier,
    "mandatory_props" : []
}