nukescripts.pyWxAppUtils

Package nukescripts :: Module pyWxAppUtils |
[hide private]
[frames] | no frames]

# Source Code for Module nukescripts.pyWxAppUtils

     1  # Copyright (c) 2009 The Foundry Visionmongers Ltd.  All Rights Reserved.
     2
     3  from nukescripts import pyAppUtils
     4
     5 -class pyWxAppHelper(pyAppUtils.pyAppHelper):
     6    """ Helper class to initialise wxWidgets in a separate thread """
     7
     8 -  def __init__(self, wxApp, start = None):
     9      super(pyWxAppHelper, self).__init__(start)
    10      self.__pyWxAppType = wxApp
    11      self.__pyWxApp = None
    12      if start:
    13        self.start()
    14
    15 -  def getApplication(self):
    16      import wx
    17      if self.__pyWxApp is None:
    18        self.__pyWxApp = self.__pyWxAppType()
    19        import nuke
    20        if not nuke.env['MACOS']:
    21          self.__pyWxApp.MainLoop()
    22      return self.__pyWxApp
    23
    24 -  def start(self):
    25      super(pyWxAppHelper, self).initiate()
    26      self.run(self.getApplication)
    27