wxglade_hmi/wxglade_hmi.py
changeset 1688 457155545922
parent 1680 6db967480b7d
child 1730 64d8f52bc8c8
equal deleted inserted replaced
1687:dde952da3aa4 1688:457155545922
    49         if project_path is None:
    49         if project_path is None:
    50             project_path = self.CTNPath()
    50             project_path = self.CTNPath()
    51         # define name for wxGlade gui file
    51         # define name for wxGlade gui file
    52         return os.path.join(project_path, "hmi.wxg")
    52         return os.path.join(project_path, "hmi.wxg")
    53 
    53 
       
    54 
       
    55     def GetWxGladePath(self):
       
    56         path = None
       
    57         try:
       
    58             from wxglade import __file__ as fileName
       
    59             path = os.path.dirname(fileName)         
       
    60             return path
       
    61         except ImportError:
       
    62             pass
       
    63 
       
    64         defLibDir="/usr/share/wxglade"
       
    65         if os.path.isdir(defLibDir):
       
    66             path = defLibDir
       
    67 
       
    68         return path
       
    69     
    54     def launch_wxglade(self, options, wait=False):
    70     def launch_wxglade(self, options, wait=False):
    55         from wxglade import __file__ as fileName
    71         path = self.GetWxGladePath()
    56         path = os.path.dirname(fileName)
       
    57         glade = os.path.join(path, 'wxglade.py')
    72         glade = os.path.join(path, 'wxglade.py')
    58         if wx.Platform == '__WXMSW__':
    73         if wx.Platform == '__WXMSW__':
    59             glade = "\"%s\""%glade
    74             glade = "\"%s\""%glade
    60         mode = {False:os.P_NOWAIT, True:os.P_WAIT}[wait]
    75         mode = {False:os.P_NOWAIT, True:os.P_WAIT}[wait]
    61         os.spawnv(mode, sys.executable, ["\"%s\""%sys.executable] + [glade] + options)
    76         os.spawnv(mode, sys.executable, ["\"%s\""%sys.executable] + [glade] + options)