[GRASS-SVN] r30233 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 18 10:13:55 EST 2008


Author: martinl
Date: 2008-02-18 10:13:55 -0500 (Mon, 18 Feb 2008)
New Revision: 30233

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm.py
   grass/trunk/gui/wxpython/gui_modules/gcmd.py
Log:
wxGUI: use specific DBMError

Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-02-18 15:03:42 UTC (rev 30232)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-02-18 15:13:55 UTC (rev 30233)
@@ -2015,8 +2015,8 @@
 
         if len(self.defaultDriver) == 0 or \
                len(self.defaultDatabase) == 0:
-            raise gcmd.GException(_('Unable to determine default DB connection settings. '
-                                   'Please define DB connection using db.connect module.'))
+            raise gcmd.DBMError(_('Unable to determine default DB connection settings. '
+                                  'Please define DB connection using db.connect module.'))
         
         self.defaultTables = self.__getTables(self.defaultDriver, self.defaultDatabase)
         try:

Modified: grass/trunk/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcmd.py	2008-02-18 15:03:42 UTC (rev 30232)
+++ grass/trunk/gui/wxpython/gui_modules/gcmd.py	2008-02-18 15:13:55 UTC (rev 30233)
@@ -48,13 +48,14 @@
 
 class GException(Exception):
     """Generic exception"""
-    def __init__(self, message, parent=None):
+    def __init__(self, message, title=_("Error"), parent=None):
         self.message = message
         self.parent = parent
-
+        self.title = title
+        
     def __str__(self):
         wx.MessageBox(parent=self.parent,
-                      caption=_("Error"),
+                      caption=self.title,
                       message=self.message,
                       style=wx.ICON_ERROR | wx.CENTRE)
 
@@ -65,44 +66,25 @@
 
     See Command class (command exits with EXIT_FAILURE,
     G_fatal_error() is called)."""
-    def __init(self, cmd, message):
-        GException.__init__(message)
+    def __init__(self, cmd, message):
+        GException.__init__(self, message, title=_("Error in command execution"))
 
-    def __str__(self):
-        wx.MessageBox(parent=self.parent,
-                      caption=_("Error in command execution"),
-                      message=self.message,
-                      style=wx.ICON_ERROR | wx.CENTRE)
-        
-        return '' 
-
 class SettingsError(GException):
     """Exception used for GRASS settings, see
     gui_modules/preferences.py."""
-    def __init(self, message):
-        GException.__init__(message)
+    def __init__(self, message):
+        GException.__init__(self, message, title=_("Preferences error"))
 
-    def __str__(self):
-        wx.MessageBox(parent=self.parent,
-                      caption=_("Preferences error"),
-                      message=self.message,
-                      style=wx.ICON_ERROR | wx.CENTRE)
-        
-        return '' 
-
 class DigitError(GException):
     """Exception raised during digitization session"""
-    def __init(self, message):
-        GException.__init__(message)
+    def __init__(self, message):
+        GException.__init__(self, message, title=_("Error in digitization tool"))
 
-    def __str__(self):
-        wx.MessageBox(parent=None,
-                      caption=_("Error in digitization tool"),
-                      message=self.message,
-                      style=wx.ICON_ERROR)
+class DBMError(GException):
+    """Exception raised for Attribute Table Manager"""
+    def __init__(self, message):
+        GException.__init__(self, message, title=_("Error in Attribute Table Manager"))
 
-        return ''
-
 class Popen(subprocess.Popen):
     """Subclass subprocess.Popen"""
     def recv(self, maxsize=None):



More information about the grass-commit mailing list