Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/extensions/tutoriusremote.py33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/extensions/tutoriusremote.py b/src/extensions/tutoriusremote.py
index 912e968..dfe6f37 100755
--- a/src/extensions/tutoriusremote.py
+++ b/src/extensions/tutoriusremote.py
@@ -71,17 +71,45 @@ class TPalette(Palette):
self._creator_item.connect('activate', self._start_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):
- default_creator().start_authoring(tutorial=None)
+ 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()
+ 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()
+
+ 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()
def _list_tutorials(self, widget):
dlg = gtk.Dialog('Run a tutorial',
@@ -104,6 +132,7 @@ class TPalette(Palette):
dlg.show_all()
result = dlg.run()
+ dlg.destroy()
if result == gtk.RESPONSE_ACCEPT:
row = combo.get_active_item()
@@ -116,8 +145,6 @@ class TPalette(Palette):
service = ServiceProxy()
service.launch(guid)
-
- dlg.destroy()
def setup(tray):
tray.add_device(TutoriusRemote(default_creator()))