From b8c9419f0381c1864035af76853ed1c02ad434cc Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 30 Nov 2009 22:24:58 +0000 Subject: Remote : Adding comments --- (limited to 'src/extensions/tutoriusremote.py') diff --git a/src/extensions/tutoriusremote.py b/src/extensions/tutoriusremote.py index 50fd736..918f3da 100755 --- a/src/extensions/tutoriusremote.py +++ b/src/extensions/tutoriusremote.py @@ -84,39 +84,51 @@ class TPalette(Palette): # default_creator().start_authoring(tutorial=None) def _list_tutorials(self, widget): + # Create the selection dialog dlg = gtk.Dialog('Run a tutorial', None, gtk.DIALOG_MODAL, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) - dlg.vbox.pack_start(gtk.Label(_('Which tutorial do you want to run?'))) + # Write the user prompt + dlg.vbox.pack_start(gtk.Label(_('Which tutorial do you want to run?\n'))) + # Fetchthe current activity name activity = get_model().get_active_activity() - act_name = activity.get_activity_name() + + # Query the vault to get the tutorials related to this activity tutorial_dict = Vault.list_available_tutorials(act_name) # Build the combo box combo = ComboBox() + + # Insert all the related tutorials for (tuto_name, tuto_guid) in tutorial_dict.items(): combo.append_item(tuto_name, tuto_guid) dlg.vbox.pack_end(combo) dlg.show_all() + # Show the dialog to the user result = dlg.run() + # If the user cliked OK if result == gtk.RESPONSE_ACCEPT: + # Get the current active item in the row = combo.get_active_item() if row: + # Fetch the name and Guid guid = row[0] name = row[1] + LOGGER.debug("TPalette :: Got message to launch tutorial %s with guid %s"%(str(name), str(guid))) + # Send a DBus message to the Engine to run this tutorial from sugar.tutorius.service import ServiceProxy service = ServiceProxy() - service.launch(guid) + # Close the dialog dlg.destroy() def setup(tray): -- cgit v0.9.1