← Back to team overview

gtg team mailing list archive

[Merge] lp:~izidor/gtg/small-backend-fixes into lp:gtg

 

Izidor Matušov has proposed merging lp:~izidor/gtg/small-backend-fixes into lp:gtg.

Requested reviews:
  Gtg developers (gtg)
Related bugs:
  Bug #965919 in Getting Things GNOME!: "Launchpad - Error in Translation - string 149."
  https://bugs.launchpad.net/gtg/+bug/965919

For more details, see:
https://code.launchpad.net/~izidor/gtg/small-backend-fixes/+merge/109177

Explicitly disable adding more instances of localfile backend. It doesn't work properly beyond default backend.

Also removed some commented code which has an "untranslatable" string. The code was disabled for long time and could be now implemented differently if needed.  
-- 
https://code.launchpad.net/~izidor/gtg/small-backend-fixes/+merge/109177
Your team Gtg developers is requested to review the proposed merge of lp:~izidor/gtg/small-backend-fixes into lp:gtg.
=== modified file 'GTG/backends/genericbackend.py'
--- GTG/backends/genericbackend.py	2012-05-01 11:04:39 +0000
+++ GTG/backends/genericbackend.py	2012-06-07 16:00:32 +0000
@@ -17,10 +17,10 @@
 # this program.  If not, see <http://www.gnu.org/licenses/>.
 # -----------------------------------------------------------------------------
 
-'''
-This file contains the most generic representation of a backend, the
-GenericBackend class
-'''
+"""
+This file contains the most generic representation of a backend,
+the GenericBackend class
+"""
 
 import os
 import sys
@@ -36,7 +36,6 @@
 from GTG.tools.interruptible     import _cancellation_point
 
 
-
 class GenericBackend(object):
     '''
     Base class for every backend.
@@ -91,10 +90,6 @@
         Optional. 
         NOTE: make sure to call super().initialize()
         '''
-        #NOTE: I'm disabling this since support for runtime checking of the
-        #        presence of the necessary modules is disabled. (invernizzi)
-#        for module_name in self.get_required_modules():
-#            sys.modules[module_name]= __import__(module_name)
         self._parameters[self.KEY_ENABLED] = True
         self._is_initialized = True
         #we signal that the backend has been enabled
@@ -141,21 +136,6 @@
         '''
         pass
 
-#NOTE: task counting is disabled in the UI, so I've disabled it here
-#      (invernizzi)
-#    def get_number_of_tasks(self):
-#        '''
-#        Returns the number of tasks stored in the backend. Doesn't need
-#        to be a fast function, is called just for the UI
-#        '''
-#        raise NotImplemented()
-
-#NOTE: I'm disabling this since support for runtime checking of the
-#        presence of the necessary modules is disabled. (invernizzi)
-#    @staticmethod
-#    def get_required_modules():
-#        return []
-
     def quit(self, disable = False):
         '''
         Called when GTG quits or the user wants to disable the backend.
@@ -689,5 +669,3 @@
                 pass
         self.launch_setting_thread(bypass_quit_request = True)
         self.save_state()
-
-

=== modified file 'GTG/gtk/backends_dialog/addpanel.py'
--- GTG/gtk/backends_dialog/addpanel.py	2012-04-02 15:39:34 +0000
+++ GTG/gtk/backends_dialog/addpanel.py	2012-06-07 16:00:32 +0000
@@ -23,12 +23,6 @@
 from GTG.backends                          import BackendFactory
 from GTG                                   import _, ngettext
 
-#The code for showing the required modules has been disabled since it
-# seems that backends will be packaged separately (as plugins). I'm
-# leaving this here in case we change that decision (invernizzi).
-#from GTG.tools.moduletopackage             import ModuleToPackage
-
-
 
 class AddPanel(gtk.VBox):
     ''' 
@@ -185,32 +179,6 @@
                 (ngettext("Author", "Authors", len(authors)),
                  reduce(lambda a, b: a + "\n" + "   - " + b, authors))
         self.label_author.set_markup(author_txt)
-        #The code for showing the required modules has been disabled since it
-        # seems that backends will be packaged separately (as plugins). I'm
-        # leaving this here in case we change that decision (invernizzi).
-        #self._build_module_list(backend.Backend)
         pixbuf = self.dialog.get_pixbuf_from_icon_name(backend_name, 100, 100)
         self.image_icon.set_from_pixbuf(pixbuf)
         self.show_all()
-
-        #The code for showing the required modules has been disabled since it
-        # seems that backends will be packaged separately (as plugins). I'm
-        # leaving this here in case we change that decision (invernizzi).
-#    def _build_module_list(self, backend):
-#        missing_modules = []
-#        for module in backend.get_required_modules():
-#            try:
-#                __import__(module)
-#            except ImportError:
-#                missing_modules.append(module)
-#        if missing_modules:
-#            text = "<b> Missing modules:</b>\n - "
-#            module2package = ModuleToPackage()
-#            missing_modules = map(lambda a: \
-#                    "<span color='red'>" + \
-#                    module2package.lookup(a) +\
-#                    "</span>", missing_modules)
-#            text += reduce(lambda a, b: a + "\n - " + b, missing_modules)
-#            self.label_modules.set_markup(text)
-#        self.ok_button.set_sensitive(missing_modules == [])
-

=== modified file 'GTG/gtk/backends_dialog/backendscombo.py'
--- GTG/gtk/backends_dialog/backendscombo.py	2012-03-05 15:23:05 +0000
+++ GTG/gtk/backends_dialog/backendscombo.py	2012-06-07 16:00:32 +0000
@@ -71,6 +71,11 @@
         self.liststore.clear()
         backend_types = BackendFactory().get_all_backends()
         for name, module in backend_types.iteritems():
+            # FIXME: Disable adding another localfile backend.
+            # It just produce many warnings, provides no use case
+            # See LP bug #940917 (Izidor)
+            if name == "backend_localfile":
+                continue
             pixbuf = self.dialog.get_pixbuf_from_icon_name(name, 16, 16)
             self.liststore.append((name, \
                                    module.Backend.get_human_default_name(), \

=== modified file 'GTG/gtk/backends_dialog/configurepanel.py'
--- GTG/gtk/backends_dialog/configurepanel.py	2012-04-02 18:06:56 +0000
+++ GTG/gtk/backends_dialog/configurepanel.py	2012-06-07 16:00:32 +0000
@@ -76,19 +76,18 @@
         self.pack_start(align, False)
 
     def _fill_top_hbox(self, hbox):
-        '''
-        Helper function to fill an hbox with an image, a spinner and 
-        three labels
+        """ Fill header with service's icon, name, and a spinner
+        for inidcation of work.
 
         @param hbox: the gtk.HBox to fill
-        '''
-        hbox.set_spacing(10)
+        """
         self.image_icon = gtk.Image()
         self.image_icon.set_size_request(48, 48)
-        vbox = gtk.VBox()
         hbox_top = gtk.HBox()
+
         self.human_name_label = gtk.Label()
         self.human_name_label.set_alignment(xalign = 0, yalign = 0.5)
+
         try:
             self.spinner = gtk.Spinner()
         except AttributeError:
@@ -98,18 +97,11 @@
         self.spinner.set_size_request(32, 32)
         align_spin = gtk.Alignment(xalign = 1, yalign = 0)
         align_spin.add(self.spinner)
-        hbox_top.pack_start(self.human_name_label, True)
-        hbox_top.pack_start(align_spin, False)
-        self.sync_desc_label = gtk.Label()
-        self.sync_desc_label.set_alignment(xalign = 0, yalign = 1)
-        self.sync_desc_label.set_line_wrap(True)
-        vbox.pack_start(hbox_top, True)
-        vbox.pack_start(self.sync_desc_label, True)
+
+        hbox.set_spacing(10)
         hbox.pack_start(self.image_icon, False)
-        align_vbox = gtk.Alignment(xalign = 0, yalign = 0, xscale = 1)
-        align_vbox.set_padding(12, 0, 0, 0)
-        align_vbox.add(vbox)
-        hbox.pack_start(align_vbox, True)
+        hbox.pack_start(self.human_name_label, True)
+        hbox.pack_start(align_spin, False)
 
     def _fill_middle_hbox(self, hbox):
         '''
@@ -148,31 +140,6 @@
                                         self.backend.get_human_name()
         self.human_name_label.set_markup(markup)
     
-    def refresh_number_of_tasks(self):
-        '''refreshes the number of synced tasks by this backend'''
-        #FIXME: disabled for now. I'm not sure that this is nice because the
-        # count is correct only after the backend has synced all the pending
-        # tasks, and this is quite misleading (invernizzi)
-        return
-        #This will have to be changed for import/export..
-        tags = self.backend.get_attached_tags()
-        tasks_number = self.backend.get_number_of_tasks()
-        if GenericBackend.ALLTASKS_TAG in tags:
-            if tasks_number == 0:
-                markup = _("Ready to start syncing")
-            else:
-                markup = ngettext("Syncing your only task", \
-                    "Syncing all %d tasks" % tasks_number, tasks_number)
-        else:
-            tags_txt = get_colored_tags_markup(self.req, tags)
-            if tasks_number == 0:
-                markup = _("There is no task tagged %s") % tags_txt
-            else:
-                markup = ngettext("Syncing a task tagged %s" % tags_txt, \
-                    "Syncing %d tasks tagged %s" % (tasks_number, tags_txt), \
-                              tasks_number) 
-        self.sync_desc_label.set_markup(markup)
-
     def refresh_sync_button(self):
         '''
         Refreshes the state of the button that enables the backend
@@ -204,7 +171,6 @@
         @param sender: not used, here only for signal callback compatibility
         @param data: not used, here only for signal callback compatibility
         '''
-        self.refresh_number_of_tasks()
         self.refresh_sync_button()
         self.refresh_sync_status_label()
     


Follow ups