[GRASS-SVN] r58645 - in grass/trunk/gui/wxpython: lmgr modules xml

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 8 12:36:48 PST 2014


Author: martinl
Date: 2014-01-08 12:36:47 -0800 (Wed, 08 Jan 2014)
New Revision: 58645

Modified:
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/modules/extensions.py
   grass/trunk/gui/wxpython/xml/toolboxes.xml
   grass/trunk/gui/wxpython/xml/wxgui_items.xml
Log:
wxGUI: update extensions wrapper (g.extension.rebuild.all has been removed)


Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2014-01-08 19:38:31 UTC (rev 58644)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2014-01-08 20:36:47 UTC (rev 58645)
@@ -65,7 +65,7 @@
 from psmap.frame           import PsMapFrame
 from core.debug            import Debug
 from gui_core.ghelp        import AboutWindow
-from modules.extensions    import InstallExtensionWindow, UninstallExtensionWindow
+from modules.extensions    import InstallExtensionWindow, ManageExtensionWindow
 from lmgr.toolbars         import LMWorkspaceToolbar, LMDataToolbar, LMToolsToolbar
 from lmgr.toolbars         import LMMiscToolbar, LMVectorToolbar, LMNvizToolbar
 from lmgr.pyshell          import PyShellWindow
@@ -1399,9 +1399,9 @@
         win.CentreOnScreen()
         win.Show()
         
-    def OnUninstallExtension(self, event):
+    def OnManageExtension(self, event):
         """!Uninstall extension"""
-        win = UninstallExtensionWindow(self, size = (650, 300))
+        win = ManageExtensionWindow(self, size = (650, 300))
         win.CentreOnScreen()
         win.Show()
 

Modified: grass/trunk/gui/wxpython/modules/extensions.py
===================================================================
--- grass/trunk/gui/wxpython/modules/extensions.py	2014-01-08 19:38:31 UTC (rev 58644)
+++ grass/trunk/gui/wxpython/modules/extensions.py	2014-01-08 20:36:47 UTC (rev 58645)
@@ -6,7 +6,7 @@
 Classes:
  - extensions::InstallExtensionWindow
  - extensions::ExtensionTreeModelBuilder
- - extensions::UninstallExtensionWindow
+ - extensions::ManageExtensionWindow
  - extensions::CheckListExtension
 
 (C) 2008-2014 by the GRASS Development Team
@@ -26,7 +26,7 @@
 from grass.script import task as gtask
 
 from core             import globalvar
-from core.gcmd        import GError, RunCommand, GException
+from core.gcmd        import GError, RunCommand, GException, GMessage
 from core.utils       import SetAddOnPath, _
 from core.menutree    import TreeModel, ModuleNode
 from gui_core.widgets import GListCtrl, SearchModuleWidget
@@ -348,9 +348,9 @@
                                     'keywords': '',
                                     'description': ''}        
         
-class UninstallExtensionWindow(wx.Frame):
+class ManageExtensionWindow(wx.Frame):
     def __init__(self, parent, id = wx.ID_ANY,
-                 title = _("Uninstall GRASS Addons extensions"), **kwargs):
+                 title = _("Manage installed GRASS Addons extensions"), **kwargs):
         self.parent = parent
         
         wx.Frame.__init__(self, parent = parent, id = id, title = title, **kwargs)
@@ -364,12 +364,15 @@
         self.extList = CheckListExtension(parent = self.panel)
 
         # buttons
-        self.btnUninstall = wx.Button(parent = self.panel, id = wx.ID_ANY,
-                                    label = _("&Uninstall"))
+        self.btnUninstall = wx.Button(parent = self.panel, id = wx.ID_REMOVE)
         self.btnUninstall.SetToolTipString(_("Uninstall selected AddOns extensions"))
+        self.btnUpdate = wx.Button(parent = self.panel, id = wx.ID_REFRESH)
+        self.btnUpdate.SetToolTipString(_("Reinstall selected AddOns extensions"))
+
         self.btnClose = wx.Button(parent = self.panel, id = wx.ID_CLOSE)
         
         self.btnUninstall.Bind(wx.EVT_BUTTON, self.OnUninstall)
+        self.btnUpdate.Bind(wx.EVT_BUTTON, self.OnUpdate)
         self.btnClose.Bind(wx.EVT_BUTTON, lambda evt: self.Close())
         
         self._layout()
@@ -385,6 +388,7 @@
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         btnSizer.Add(item = self.btnClose, proportion = 0,
                      flag = wx.RIGHT, border = 5)
+        btnSizer.Add(item = self.btnUpdate, proportion = 0, flag=wx.RIGHT, border=5)
         btnSizer.Add(item = self.btnUninstall, proportion = 0)
         
         sizer.Add(item = extSizer, proportion = 1,
@@ -397,13 +401,20 @@
         
         self.Layout()
 
+    def _getSelectedExtensions(self):
+        eList = self.extList.GetExtensions()
+        if not eList:
+            GMessage(_("No extension selected. "
+                       "Operation canceled."),
+                     parent = self)
+            return []
+        
+        return eList
+
     def OnUninstall(self, event):
         """!Uninstall selected extensions"""
-        eList = self.extList.GetExtensions()
+        eList = self._getSelectedExtensions()
         if not eList:
-            GError(_("No extension selected for removal. "
-                     "Operation canceled."),
-                   parent = self)
             return
         
         for ext in eList:
@@ -426,7 +437,18 @@
         globalvar.UpdateGRASSAddOnCommands(eList)
         toolboxesOutdated()
 
+    def OnUpdate(self, event):
+        """!Update selected extensions"""
+        eList = self._getSelectedExtensions()
+        if not eList:
+            return
         
+        log = self.parent.GetLogWindow()
+        
+        for ext in eList:
+            log.RunCmd(['g.extension', 'extension=%s' % ext,
+                        'operation=add'])
+        
 class CheckListExtension(GListCtrl):
     """!List of mapset/owner/group"""
     def __init__(self, parent):

Modified: grass/trunk/gui/wxpython/xml/toolboxes.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/toolboxes.xml	2014-01-08 19:38:31 UTC (rev 58644)
+++ grass/trunk/gui/wxpython/xml/toolboxes.xml	2014-01-08 20:36:47 UTC (rev 58645)
@@ -593,10 +593,7 @@
     <label>Addons extensions</label>
     <items>
       <wxgui-item name="InstallExtensionFromAddons"/>
-      <module-item name="g.extension.rebuild.all">
-        <label>Update installed extensions</label>
-      </module-item>
-      <wxgui-item name="UninstallExtension"/>
+      <wxgui-item name="ManageExtension"/>
     </items>
   </toolbox>
   <toolbox name="DevelopRasterMap">

Modified: grass/trunk/gui/wxpython/xml/wxgui_items.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/wxgui_items.xml	2014-01-08 19:38:31 UTC (rev 58644)
+++ grass/trunk/gui/wxpython/xml/wxgui_items.xml	2014-01-08 20:36:47 UTC (rev 58645)
@@ -285,11 +285,11 @@
     <description>Installs new extension from GRASS AddOns SVN repository.</description>
     <keywords>general,installation,extensions</keywords>
   </wxgui-item>
-  <wxgui-item name="UninstallExtension">
-    <label>Uninstall extension</label>
-    <handler>OnUninstallExtension</handler>
+  <wxgui-item name="ManageExtension">
+    <label>Manage installed extension</label>
+    <handler>OnManageExtension</handler>
     <related-module>g.extension</related-module>
-    <description>Removes installed GRASS AddOns extension.</description>
+    <description>Updates or removes installed GRASS AddOns extension(s).</description>
     <keywords>general,installation,extensions</keywords>
   </wxgui-item>
   <wxgui-item name="ManageRasterColorRulesInteractively">



More information about the grass-commit mailing list