peng3d/peng.py
def createWindow(self,cls=None,caption_t=None,*args,**kwargs):
        """
        createWindow(cls=window.PengWindow, *args, **kwargs)
        
        Creates a new window using the supplied ``cls``\ .
        
        If ``cls`` is not given, :py:class:`peng3d.window.PengWindow()` will be used.
        
        Any other positional or keyword arguments are passed to the class constructor.
        
        Note that this method currently does not support using multiple windows.
        
        .. todo::
           
           Implement having multiple windows.
        """
        if cls is None:
            from . import window
            cls = window.PengWindow
        if self.window is not None:
            raise RuntimeError("Window already created!")
        self.sendEvent("peng3d:window.create.pre",{"peng":self,"cls":cls})
        if caption_t is not None:
            kwargs["caption"] = "Peng3d Application"
        self.window = cls(self,*args,**kwargs)
        self.sendEvent("peng3d:window.create.post",{"peng":self,"window":self.window})
        if self.cfg["rsrc.enable"] and self.resourceMgr is None:
            self.sendEvent("peng3d:rsrc.init.pre",{"peng":self,"basepath":self.cfg["rsrc.basepath"]})
            self.resourceMgr = resource.ResourceManager(self,self.cfg["rsrc.basepath"])
            self.rsrcMgr = self.resourceMgr
            self.sendEvent("peng3d:rsrc.init.post",{"peng":self,"rsrcMgr":self.resourceMgr})
            if self.cfg["i18n.enable"] and self.i18n is None:
                self.sendEvent("peng3d:i18n.init.pre",{"peng":self})
                self.i18n = i18n.TranslationManager(self)
                self._t = self.i18n.t
                self._tl = self.i18n.tl
                self.sendEvent("peng3d:i18n.init.post",{"peng":self,"i18n":self.i18n})
        if caption_t is not None:
            self.window.set_caption(self.t(caption_t))
            def f():
                self.window.set_caption(self.t(caption_t))
            self.i18n.addAction("setlang",f)
        return self.window
def createWindow(self,cls=None,caption_t=None,*args,**kwargs):
        """
        createWindow(cls=window.PengWindow, *args, **kwargs)
        
        Creates a new window using the supplied ``cls``\ .
        
        If ``cls`` is not given, :py:class:`peng3d.window.PengWindow()` will be used.
        
        Any other positional or keyword arguments are passed to the class constructor.
        
        Note that this method currently does not support using multiple windows.
        
        .. todo::
           
           Implement having multiple windows.
        """
        if cls is None:
            from . import window
            cls = window.PengWindow
        if self.window is not None:
            raise RuntimeError("Window already created!")
        self.sendEvent("peng3d:window.create.pre",{"peng":self,"cls":cls})
        if caption_t is not None:
            kwargs["caption"] = "Peng3d Application"
        self.window = cls(self,*args,**kwargs)
        self.sendEvent("peng3d:window.create.post",{"peng":self,"window":self.window})
        if self.cfg["rsrc.enable"] and self.resourceMgr is None:
            self.sendEvent("peng3d:rsrc.init.pre",{"peng":self,"basepath":self.cfg["rsrc.basepath"]})
            self.resourceMgr = resource.ResourceManager(self,self.cfg["rsrc.basepath"])
            self.rsrcMgr = self.resourceMgr
            self.sendEvent("peng3d:rsrc.init.post",{"peng":self,"rsrcMgr":self.resourceMgr})
            if self.cfg["i18n.enable"] and self.i18n is None:
                self.sendEvent("peng3d:i18n.init.pre",{"peng":self})
                self.i18n = i18n.TranslationManager(self)
                self._t = self.i18n.t
                self._tl = self.i18n.tl
                self.sendEvent("peng3d:i18n.init.post",{"peng":self,"i18n":self.i18n})
        if caption_t is not None:
            self.window.set_caption(self.t(caption_t))
            def f():
                self.window.set_caption(self.t(caption_t))
            self.i18n.addAction("setlang",f)
        return self.window
def createWindow ( self , cls = None , caption_t = None , * args , * * kwargs ) : if cls is None : from . import window cls = window . PengWindow if self . window is not None : raise RuntimeError ( "Window already created!" ) self . sendEvent ( "peng3d:window.create.pre" , { "peng" : self , "cls" : cls } ) if caption_t is not None : kwargs [ "caption" ] = "Peng3d Application" self . window = cls ( self , * args , * * kwargs ) self . sendEvent ( "peng3d:window.create.post" , { "peng" : self , "window" : self . window } ) if self . cfg [ "rsrc.enable" ] and self . resourceMgr is None : self . sendEvent ( "peng3d:rsrc.init.pre" , { "peng" : self , "basepath" : self . cfg [ "rsrc.basepath" ] } ) self . resourceMgr = resource . ResourceManager ( self , self . cfg [ "rsrc.basepath" ] ) self . rsrcMgr = self . resourceMgr self . sendEvent ( "peng3d:rsrc.init.post" , { "peng" : self , "rsrcMgr" : self . resourceMgr } ) if self . cfg [ "i18n.enable" ] and self . i18n is None : self . sendEvent ( "peng3d:i18n.init.pre" , { "peng" : self } ) self . i18n = i18n . TranslationManager ( self ) self . _t = self . i18n . t self . _tl = self . i18n . tl self . sendEvent ( "peng3d:i18n.init.post" , { "peng" : self , "i18n" : self . i18n } ) if caption_t is not None : self . window . set_caption ( self . t ( caption_t ) ) def f ( ) : self . window . set_caption ( self . t ( caption_t ) ) self . i18n . addAction ( "setlang" , f ) return self . window
createWindow(cls=window.PengWindow, *args, **kwargs)
        
        Creates a new window using the supplied ``cls``\ .
        
        If ``cls`` is not given, :py:class:`peng3d.window.PengWindow()` will be used.
        
        Any other positional or keyword arguments are passed to the class constructor.
        
        Note that this method currently does not support using multiple windows.
        
        .. todo::
           
           Implement having multiple windows.
createWindow ( cls = window . PengWindow * args ** kwargs ) Creates a new window using the supplied cls \ . If cls is not given : py : class : peng3d . window . PengWindow () will be used . Any other positional or keyword arguments are passed to the class constructor . Note that this method currently does not support using multiple windows . .. todo :: Implement having multiple windows .