[meld] Add better tooltips for VC filters and selection (bgo#699039)



commit 3b7f70446e34a74e571f852f7817a12b926ecbf2
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Apr 28 07:35:38 2013 +1000

    Add better tooltips for VC filters and selection (bgo#699039)
    
    In addition to minor fixes for button text, this adds a somewhat more
    useful tooltip when we don't find a VC system for the folder in which
    a VC view is started.

 meld/vc/_null.py |   29 +++++++++++++++++++----------
 meld/vcview.py   |   28 +++++++++++++++++-----------
 po/POTFILES.in   |    1 +
 3 files changed, 37 insertions(+), 21 deletions(-)
---
diff --git a/meld/vc/_null.py b/meld/vc/_null.py
index 361b7ef..5e36279 100644
--- a/meld/vc/_null.py
+++ b/meld/vc/_null.py
@@ -3,7 +3,7 @@
 ### Redistribution and use in source and binary forms, with or without
 ### modification, are permitted provided that the following conditions
 ### are met:
-### 
+###
 ### 1. Redistributions of source code must retain the above copyright
 ###    notice, this list of conditions and the following disclaimer.
 ### 2. Redistributions in binary form must reproduce the above copyright
@@ -21,29 +21,38 @@
 ### (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 ### THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+from gettext import gettext as _
+
 from . import _vc
 
 
 class Vc(_vc.Vc):
 
     CMD = "true"
-    NAME = "Null"
-    VC_DIR = "." # Accept any directory
+    NAME = _("None")
+    # Accept any directory
+    VC_DIR = "."
 
     def commit_command(self, message):
-        return [self.CMD,"commit","-m",message]
+        return [self.CMD, "commit", "-m", message]
+
     def diff_command(self):
-        return [self.CMD,"diff","-u"]
+        return [self.CMD, "diff", "-u"]
+
     def update_command(self):
-        return [self.CMD,"update"]
+        return [self.CMD, "update"]
+
     def add_command(self):
-        return [self.CMD,"add"]
+        return [self.CMD, "add"]
+
     def remove_command(self, force=0):
-        return [self.CMD,"rm","-f"]
+        return [self.CMD, "rm", "-f"]
+
     def revert_command(self):
-        return [self.CMD,"update","-C"]
+        return [self.CMD, "update", "-C"]
+
     def resolved_command(self):
-        return [self.CMD,"resolved"]
+        return [self.CMD, "resolved"]
 
     def lookup_files(self, dirs, files, directory=None):
         "files is array of (name, path). assume all files in same dir"
diff --git a/meld/vcview.py b/meld/vcview.py
index 48799b3..d054a80 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -231,10 +231,10 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
                 _("Flatten directories"),
                 self.on_button_flatten_toggled, False),
             ("VcShowModified", "filter-modified-24", _("_Modified"), None,
-                _("Show modified"),
+                _("Show modified files"),
                 self.on_filter_state_toggled, False),
             ("VcShowNormal", "filter-normal-24", _("_Normal"), None,
-                _("Show normal"),
+                _("Show normal files"),
                 self.on_filter_state_toggled, False),
             ("VcShowNonVC", "filter-nonvc-24", _("Un_versioned"), None,
                 _("Show unversioned files"),
@@ -357,8 +357,6 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
         """Display VC plugin(s) that can handle the location"""
         self.combobox_vcs.lock = True
         self.combobox_vcs.get_model().clear()
-        tooltip_texts = [_("Choose one Version Control"),
-                         _("Only one Version Control in this directory")]
         default_active = -1
         valid_vcs = []
         # Try to keep the same VC plugin active on refresh()
@@ -379,27 +377,35 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
             if not vc_installed(avc.CMD):
                 # TRANSLATORS: this is an error message when a version control
                 # application isn't installed or can't be found
-                err_str = _("%s Not Installed" % avc.CMD)
+                err_str = _("%s not installed" % avc.CMD)
             elif not avc.valid_repo():
                 # TRANSLATORS: this is an error message when a version
                 # controlled repository is invalid or corrupted
-                err_str = _("Invalid Repository")
+                err_str = _("Invalid repository")
             else:
                 valid_vcs.append(idx)
                 if (self.vc is not None and
-                     self.vc.__class__ == avc.__class__):
-                     default_active = idx
+                        self.vc.__class__ == avc.__class__):
+                    default_active = idx
 
             if err_str:
-                self.combobox_vcs.get_model().append( \
-                        [_("%s (%s)") % (avc.NAME, err_str), avc, False])
+                self.combobox_vcs.get_model().append(
+                    [_("%s (%s)") % (avc.NAME, err_str), avc, False])
             else:
                 self.combobox_vcs.get_model().append([avc.NAME, avc, True])
 
         if valid_vcs and default_active == -1:
             default_active = min(valid_vcs)
 
-        self.combobox_vcs.set_tooltip_text(tooltip_texts[len(vcs) == 1])
+        # If we only have the null VC, give a better error message.
+        if len(vcs) == 1 and vcs[0].CMD == "true":
+            tooltip = _("No valid version control system found in this folder")
+        elif len(vcs) == 1:
+            tooltip = _("Only one version control system found in this folder")
+        else:
+            tooltip = _("Choose which version control system to use")
+
+        self.combobox_vcs.set_tooltip_text(tooltip)
         self.combobox_vcs.set_sensitive(len(vcs) > 1)
         self.combobox_vcs.lock = False
         self.combobox_vcs.set_active(default_active)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 48f4f1e..1ee6871 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -25,5 +25,6 @@ meld/ui/findbar.py
 meld/ui/historyentry.py
 meld/ui/notebooklabel.py
 meld/vc/_vc.py
+meld/vc/_null.py
 meld/vc/cvs.py
 meld/vc/git.py


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]