def OnInit(self): koko.APP = weakref.proxy(self) koko.TASKS = TaskBot() self._mode = 'cad' # Open a file from the command line if len(sys.argv) > 1: d, self.filename = os.path.split(sys.argv[1]) self.directory = os.path.abspath(d) else: self.filename = '' self.directory = os.getcwd() # Create frame koko.FRAME = MainFrame(self) # Create a set of GUI primitives koko.PRIMS = PrimSet() # This is a brand new file self.saved = False self.reeval_required = True self.render_required = True # Snap the view to cad file bounds self.first_render = True # Show the application! koko.FRAME.Show() koko.CANVAS.SetFocus() # Start with the OpenGL window open to force OpenGL to # initialize itself, then switch back to the heightmap self.render_mode('3D') koko.GLCANVAS.init_GL() self.render_mode('2D') if self.filename: wx.CallAfter(self.load) return True