[meld/VersionControlRework: 93/123] vcview: Remove valid_vc_actions, since it's now obsolete



commit 928267c86495e96848f80c4b49d97c66fcf209c3
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Apr 11 09:34:53 2015 +1000

    vcview: Remove valid_vc_actions, since it's now obsolete
    
    We do calculations based on selected files everywhere, and handle
    not having a selection for the initial load.

 meld/vc/_vc.py |    3 +++
 meld/vcview.py |   15 ---------------
 2 files changed, 3 insertions(+), 15 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index 7e78987..a4eb50c 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -172,6 +172,9 @@ class Vc(object):
         in the version control system. This will return all valid
         version control actions that could reasonably be taken on *all*
         of the paths in path_states.
+
+        If an individual plugin needs special handling, or doesn't
+        implement all standard actions, this should be overridden.
         """
         valid_actions = set()
         states = path_states.values()
diff --git a/meld/vcview.py b/meld/vcview.py
index 58a932c..a2f3bf9 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -219,7 +219,6 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
         self.location = None
         self.location_column.set_visible(self.actiongroup.get_action("VcFlatten").get_active())
         self.vc = None
-        self.valid_vc_actions = tuple()
 
         settings.bind('vc-console-visible',
                       self.actiongroup.get_action('VcConsoleVisible'),
@@ -252,19 +251,6 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
         self._set_external_action_sensitivity(False)
         super(VcView, self).on_container_switch_out_event(ui)
 
-    def update_actions_sensitivity(self):
-        """Disable actions that use not implemented VC plugin methods"""
-        valid_vc_actions = ["VcDeleteLocally"]
-        for action_name, (meth_name, args) in self.action_vc_cmds_map.items():
-            action = self.actiongroup.get_action(action_name)
-            try:
-                getattr(self.vc, meth_name)(*args)
-                action.props.sensitive = True
-                valid_vc_actions.append(action_name)
-            except NotImplementedError:
-                action.props.sensitive = False
-        self.valid_vc_actions = tuple(valid_vc_actions)
-
     def populate_vcs_for_location(self, location):
         """Display VC plugin(s) that can handle the location"""
         vcs_model = self.combobox_vcs.get_model()
@@ -324,7 +310,6 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
             return
         self.vc = combobox_vcs.get_model()[active_iter][1]
         self._set_location(self.vc.location)
-        self.update_actions_sensitivity()
 
     def set_location(self, location):
         self.populate_vcs_for_location(location)


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