Beremiz.py
changeset 1475 de4ee16f7c6c
parent 1451 94e620cbd9de
child 1483 004f9c52f7d8
equal deleted inserted replaced
1474:28e9d479aa65 1475:de4ee16f7c6c
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24 
    24 
    25 
    25 
    26 updateinfo_url = None
    26 updateinfo_url = None
    27 
    27 
    28 import os, sys, getopt, wx
    28 import os, sys, getopt
    29 import __builtin__
    29 import __builtin__
    30 from wx.lib.agw.advancedsplash import AdvancedSplash
       
    31 import tempfile
    30 import tempfile
    32 import shutil
    31 import shutil
    33 import random
    32 import random
    34 import time
    33 import time
    35 from types import ListType
    34 from types import ListType
    36 
    35 
    37 CWD = os.path.split(os.path.realpath(__file__))[0]
    36 beremiz_dir = os.path.dirname(os.path.realpath(__file__))
       
    37 
       
    38 import wxversion
       
    39 wxversion.select('2.8')
       
    40 import wx
       
    41 from wx.lib.agw.advancedsplash import AdvancedSplash
    38 
    42 
    39 def Bpath(*args):
    43 def Bpath(*args):
    40     return os.path.join(CWD,*args)
    44     return os.path.join(beremiz_dir,*args)
    41 
    45 
    42 if __name__ == '__main__':
    46 if __name__ == '__main__':
    43     def usage():
    47     def usage():
    44         print "\nUsage of Beremiz.py :"
    48         print "\nUsage of Beremiz.py :"
    45         print "\n   %s [Projectpath] [Buildpath]\n"%sys.argv[0]
    49         print "\n   %s [Projectpath] [Buildpath]\n"%sys.argv[0]
   109         updateinfoThread.join(2)
   113         updateinfoThread.join(2)
   110         splash.SetText(text=updateinfo)
   114         splash.SetText(text=updateinfo)
   111         wx.Yield()
   115         wx.Yield()
   112 
   116 
   113     from util.misc import InstallLocalRessources
   117     from util.misc import InstallLocalRessources
   114     InstallLocalRessources(CWD)
   118     InstallLocalRessources(beremiz_dir)
   115 
   119 
   116     # Load extensions
   120     # Load extensions
   117     for extfilename in extensions:
   121     for extfilename in extensions:
   118         from util.TranslationCatalogs import AddCatalog
   122         from util.TranslationCatalogs import AddCatalog
   119         from util.BitmapLibrary import AddBitmapFolder
   123         from util.BitmapLibrary import AddBitmapFolder
   632                 confnode = self.CTR.GetChildByName(page_infos[1])
   636                 confnode = self.CTR.GetChildByName(page_infos[1])
   633             return notebook.GetPageIndex(confnode._OpenView(*page_infos[2:]))
   637             return notebook.GetPageIndex(confnode._OpenView(*page_infos[2:]))
   634         else:
   638         else:
   635             return IDEFrame.LoadTab(self, notebook, page_infos)
   639             return IDEFrame.LoadTab(self, notebook, page_infos)
   636 
   640 
       
   641     # Strange hack required by WAMP connector, using twisted.
       
   642     # Twisted reactor needs to be stopped only before quit,
       
   643     # since it cannot be restarted
       
   644     ToDoBeforeQuit = []
       
   645     def AddToDoBeforeQuit(self, Thing):
       
   646         self.ToDoBeforeQuit.append(Thing)
       
   647 
   637     def OnCloseFrame(self, event):
   648     def OnCloseFrame(self, event):
   638         for evt_type in [wx.EVT_SET_FOCUS,
   649         for evt_type in [wx.EVT_SET_FOCUS,
   639                          wx.EVT_KILL_FOCUS,
   650                          wx.EVT_KILL_FOCUS,
   640                          wx.stc.EVT_STC_UPDATEUI]:
   651                          wx.stc.EVT_STC_UPDATEUI]:
   641             self.LogConsole.Unbind(evt_type)
   652             self.LogConsole.Unbind(evt_type)
   643             if self.CTR is not None:
   654             if self.CTR is not None:
   644                 self.CTR.KillDebugThread()
   655                 self.CTR.KillDebugThread()
   645             self.KillLocalRuntime()
   656             self.KillLocalRuntime()
   646 
   657 
   647             self.SaveLastState()
   658             self.SaveLastState()
       
   659 
       
   660             for Thing in self.ToDoBeforeQuit :
       
   661                 Thing()
       
   662             self.ToDoBeforeQuit = []
   648 
   663 
   649             event.Skip()
   664             event.Skip()
   650         else:
   665         else:
   651             event.Veto()
   666             event.Veto()
   652 
   667