← Back to team overview

gtg team mailing list archive

[Merge] lp:~pcabido/gtg/hackathon into lp:gtg

 

Paulo Cabido has proposed merging lp:~pcabido/gtg/hackathon into lp:gtg.

Requested reviews:
  Gtg developers (gtg)
Related bugs:
  Bug #565572 in Getting Things GNOME!: "Preference setting cannot be saved"
  https://bugs.launchpad.net/gtg/+bug/565572
  Bug #577111 in Getting Things GNOME!: "Some plugins has zero-sized About Window"
  https://bugs.launchpad.net/gtg/+bug/577111

For more details, see:
https://code.launchpad.net/~pcabido/gtg/hackathon/+merge/83483

This branch has some bug fixes including two critical bugs: bug #577111 and fixed bug #565572
-- 
https://code.launchpad.net/~pcabido/gtg/hackathon/+merge/83483
Your team Gtg developers is requested to review the proposed merge of lp:~pcabido/gtg/hackathon into lp:gtg.
=== modified file 'GTG/gtk/preferences.py'
--- GTG/gtk/preferences.py	2011-11-19 21:41:08 +0000
+++ GTG/gtk/preferences.py	2011-11-26 18:19:23 +0000
@@ -83,7 +83,8 @@
     # get lists
     modules = plugin.missing_modules
     dbus = plugin.missing_dbus
-
+    text = ""
+    
     # convert to strings
     if modules:
         modules = "<small><b>%s</b></small>" % ', '.join(modules)
@@ -137,7 +138,7 @@
         """Constructor."""
         self.config_obj = config_obj
         self.req = req
-        self.config = self.config_obj.conf_dict
+        self.config = self.config_obj.conf_dict            
         self.builder = gtk.Builder()
         self.builder.add_from_file(ViewConfig.PREFERENCES_GLADE_FILE)
         # store references to some objects
@@ -158,6 +159,20 @@
         #FIXME: this is not needed and should be removed
 #        self.tb = taskbrowser
         self.pengine = PluginEngine()
+        #plugin config initiation, if never used
+        if self.config.has_key("plugins"):
+            if self.config["plugins"].has_key("enabled") == False:
+                self.config["plugins"]["enabled"] = []
+            
+            if self.config["plugins"].has_key("disabled") == False:
+                self.config["plugins"]["disabled"] = []
+        else:
+            if self.pengine.get_plugins():
+                self.config["plugins"] = {}
+                self.config["plugins"]["disabled"] = \
+                  [p.module_name for p in self.pengine.get_plugins("disabled")]
+                self.config["plugins"]["enabled"] = \
+                  [p.module_name for p in self.pengine.get_plugins("enabled")]
         # initialize tree models
         self._init_backend_tree()
         # this can't happen yet, due to the order of things in
@@ -165,6 +180,9 @@
         # self._init_plugin_tree()
         pref_signals_dic = self.get_signals_dict()
         self.builder.connect_signals(pref_signals_dic)
+        
+        #this line enables the about dialog widget to be reused
+        self.plugin_about_dialog.connect("delete-event", lambda w, e: self.plugin_about_dialog.hide() or True)
 
     def _init_backend_tree(self):
         """Initialize the BackendTree gtk.TreeView."""
@@ -304,15 +322,6 @@
     def on_close(self, widget, data = None):
         """Close the preferences dialog."""
 
-        if self.pengine.get_plugins():
-            self.config["plugins"] = {}
-            self.config["plugins"]["disabled"] = \
-              [p.module_name for p in self.pengine.get_plugins("disabled")]
-            self.config["plugins"]["enabled"] = \
-              [p.module_name for p in self.pengine.get_plugins("enabled")]
-
-        self.config_obj.save()
-
         self.dialog.hide()
         return True
 
@@ -327,6 +336,7 @@
             return
         plugin_id = self.plugin_store.get_value(iter, PLUGINS_COL_ID)
         p = self.pengine.get_plugin(plugin_id)
+        
         pad = self.plugin_about_dialog
         pad.set_name(p.full_name)
         pad.set_version(p.version)
@@ -341,6 +351,10 @@
     def on_plugin_about_close(self, widget, *args):
         """Close the PluginAboutDialog."""
         self.plugin_about_dialog.hide()
+        
+    def on_plugin_about_close_foo(self, widget, *args):
+        print "catched foo!"
+        self.plugin_about_dialog.hide()
 
     def on_plugin_configure(self, widget):
         """Configure a plugin."""
@@ -371,10 +385,18 @@
         p.enabled = not self.plugin_store.get_value(iter, PLUGINS_COL_ENABLED)
         if p.enabled:
             self.pengine.activate_plugins([p])
+            self.config["plugins"]["enabled"].append(p.module_name)
+            if p.module_name in self.config["plugins"]["disabled"]:
+                self.config["plugins"]["disabled"].remove(p.module_name)
         else:
             self.pengine.deactivate_plugins([p])
+            self.config["plugins"]["disabled"].append(p.module_name)
+            if p.module_name in self.config["plugins"]["enabled"]:
+                self.config["plugins"]["enabled"].remove(p.module_name)
         self.plugin_store.set_value(iter, PLUGINS_COL_ENABLED, p.enabled)
         self._update_plugin_configure(p)
+        
+        self.config_obj.save()
 
     def toggle_preview(self, widget):
         """Toggle previews in the task view on or off."""

=== modified file 'GTG/plugins/bugzilla/bug.py'
--- GTG/plugins/bugzilla/bug.py	2009-12-03 09:59:33 +0000
+++ GTG/plugins/bugzilla/bug.py	2011-11-26 18:19:23 +0000
@@ -14,11 +14,11 @@
 # You should have received a copy of the GNU General Public License along with
 # this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from bugz import Bugz
+from bugz import bugzilla
 
 class Bug:
     def __init__(self, base, nb):
-        self.bug = Bugz(base).get(nb)
+        self.bug = bugzilla.Bugz(base).get(nb)
         if self.bug is None:
             raise Exception('Failed to create bug')
 

=== modified file 'GTG/plugins/notification_area/notification_area.py'
--- GTG/plugins/notification_area/notification_area.py	2011-08-07 08:57:59 +0000
+++ GTG/plugins/notification_area/notification_area.py	2011-11-26 18:19:23 +0000
@@ -85,7 +85,7 @@
         if self.__indicator:
             self.__indicator.set_status(appindicator.STATUS_PASSIVE)
         else:
-            self.__status_icon.set_visible(False)
+            self.status_icon.set_visible(False)
 
 ## Helper methods ##############################################################