fix running wxGlade on current Debian systems
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 06 Jun 2017 13:05:30 +0300
changeset 1688 457155545922
parent 1687 dde952da3aa4
child 1689 db7fd90d245c
fix running wxGlade on current Debian systems

wxGlade was moved from python import path to /usr/share/wxglade
wxglade_hmi/wxglade_hmi.py
--- a/wxglade_hmi/wxglade_hmi.py	Fri Jun 02 19:58:27 2017 +0300
+++ b/wxglade_hmi/wxglade_hmi.py	Tue Jun 06 13:05:30 2017 +0300
@@ -51,9 +51,24 @@
         # define name for wxGlade gui file
         return os.path.join(project_path, "hmi.wxg")
 
+
+    def GetWxGladePath(self):
+        path = None
+        try:
+            from wxglade import __file__ as fileName
+            path = os.path.dirname(fileName)         
+            return path
+        except ImportError:
+            pass
+
+        defLibDir="/usr/share/wxglade"
+        if os.path.isdir(defLibDir):
+            path = defLibDir
+
+        return path
+    
     def launch_wxglade(self, options, wait=False):
-        from wxglade import __file__ as fileName
-        path = os.path.dirname(fileName)
+        path = self.GetWxGladePath()
         glade = os.path.join(path, 'wxglade.py')
         if wx.Platform == '__WXMSW__':
             glade = "\"%s\""%glade