Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/extensions/tutoriusremote.py
diff options
context:
space:
mode:
authormike <michael.jmontcalm@gmail.com>2009-12-04 02:00:13 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-12-04 02:00:13 (GMT)
commitfa35ac959122def2dcc6811e47250d12061b577b (patch)
treec5e5eaaa56276a8bc848bf54212d992edcc12210 /src/extensions/tutoriusremote.py
parent5511467f6f7eab041b53563c883f72cd7547402f (diff)
Remote : Code review changes
Diffstat (limited to 'src/extensions/tutoriusremote.py')
-rwxr-xr-xsrc/extensions/tutoriusremote.py45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/extensions/tutoriusremote.py b/src/extensions/tutoriusremote.py
index dfe6f37..fc93659 100755
--- a/src/extensions/tutoriusremote.py
+++ b/src/extensions/tutoriusremote.py
@@ -45,12 +45,7 @@ _ICON_NAME = 'tutortool'
LOGGER = logging.getLogger('remote')
class TutoriusRemote(TrayIcon):
-
- FRAME_POSITION_RELATIVE = 102
-
- def __init__(self, creator):
- self._creator = creator
-
+ def __init__(self):
client = gconf.client_get_default()
self._color = XoColor(client.get_string('/desktop/sugar/user/color'))
@@ -68,48 +63,38 @@ class TPalette(Palette):
super(TPalette, self).__init__(primary_text)
self._creator_item = gtk.MenuItem(_('Create a tutorial'))
- self._creator_item.connect('activate', self._start_creator)
+ self._creator_item.connect('activate', self._toggle_creator)
self._creator_item.show()
- self._stop_creator_item = gtk.MenuItem(_('Stop creating tutorial'))
- self._stop_creator_item.connect('activate', self._stop_creator)
-
self._tut_list_item = gtk.MenuItem(_('Show tutorials'))
self._tut_list_item.connect('activate', self._list_tutorials)
self._tut_list_item.show()
self.menu.append(self._creator_item)
- self.menu.append(self._stop_creator_item)
self.menu.append(self._tut_list_item)
self.set_content(None)
- def _start_creator(self, widget):
+ def _toggle_creator(self, widget):
creator = default_creator()
if creator.is_authoring == False:
# Replace the start creator button by the stop creator
# Allocate a white color for the text
- self._creator_item.hide()
- self._stop_creator_item.show()
+ self._creator_item.props.label = _("Stop this tutorial")
creator.start_authoring(tutorial=None)
- def _stop_creator(self, widget):
- # Close the creator but let the confirmation dialog appear
- # if the user hasn't saved his tutorial
- creator = default_creator()
+ else:
+ # Attempt to close the creator - this will popup a confirmation
+ # dialog if the user has unsaved changes
+ creator._cleanup_cb()
- if creator.is_authoring == False:
- return
-
- creator._cleanup_cb()
-
- # If the creator was not actually closed
- if creator.is_authoring == True:
- return
- # Switch back to start creator entry
- self._stop_creator_item.hide()
- self._creator_item.show()
+ # If the creator was not actually closed - (in case cancel
+ # is implemented one day)
+ if creator.is_authoring == True:
+ return
+ # Switch back to start creator entry
+ self._creator_item.props.label = _("Create a tutorial")
def _list_tutorials(self, widget):
dlg = gtk.Dialog('Run a tutorial',
@@ -147,4 +132,4 @@ class TPalette(Palette):
service.launch(guid)
def setup(tray):
- tray.add_device(TutoriusRemote(default_creator()))
+ tray.add_device(TutoriusRemote())