def resetWindowProperties(self, pipe, properties): if base.win: currentProperties = WindowProperties(base.win.getProperties()) gsg = base.win.getGsg() else: currentProperties = WindowProperties.getDefault() gsg = None newProperties = WindowProperties(currentProperties) newProperties.addProperties(properties) if base.pipe != pipe: gsg = None if gsg == None or currentProperties.getFullscreen() != newProperties.getFullscreen() or currentProperties.getParentWindow() != newProperties.getParentWindow(): self.notify.debug('window properties: %s' % properties) self.notify.debug('gsg: %s' % gsg) base.pipe = pipe if not base.openMainWindow(props=properties, gsg=gsg, keepCamera=True): self.notify.warning('OPEN MAIN WINDOW FAILED') return 0 self.notify.info('OPEN MAIN WINDOW PASSED') base.graphicsEngine.openWindows() if base.win.isClosed(): self.notify.warning('Window did not open, removing.') base.closeWindow(base.win) return 0 base.disableShowbaseMouse() if 'libotp' in sys.modules: from libotp import NametagGlobals NametagGlobals.setCamera(base.cam) NametagGlobals.setMouseWatcher(base.mouseWatcherNode) else: self.notify.debug('Adjusting properties') base.win.requestProperties(properties) base.graphicsEngine.renderFrame() return 1
def resetWindowProperties(self, pipe, properties): if base.win: currentProperties = WindowProperties(base.win.getProperties()) gsg = base.win.getGsg() else: currentProperties = WindowProperties.getDefault() gsg = None # Check to see if the window properties will change in any # important way. newProperties = WindowProperties(currentProperties) newProperties.addProperties(properties) if base.pipe != pipe: gsg = None if (gsg == None) or \ (currentProperties.getFullscreen() != newProperties.getFullscreen()) or \ (currentProperties.getParentWindow() != newProperties.getParentWindow()): # For now, assume that if we change fullscreen state, we # need to destroy the window and create a new one. self.notify.debug("window properties: %s" % properties) self.notify.debug("gsg: %s" % gsg) base.pipe = pipe if not base.openMainWindow( props=properties, gsg=gsg, keepCamera=True): self.notify.warning("OPEN MAIN WINDOW FAILED") return 0 self.notify.info("OPEN MAIN WINDOW PASSED") base.graphicsEngine.openWindows() if base.win.isClosed(): self.notify.warning("Window did not open, removing.") base.closeWindow(base.win) return 0 base.disableShowbaseMouse() # If we've already imported (and therefore downloaded) # libotp.dll, then we already have a NametagGlobals, and # we should keep it up-to-date with the new MouseWatcher # etc. if 'libotp' in sys.modules: from libotp import NametagGlobals NametagGlobals.setCamera(base.cam) NametagGlobals.setMouseWatcher(base.mouseWatcherNode) else: # If the properties are changing only slightly # (e.g. window size), we can keep the current window and # just adjust its properties directly. self.notify.debug("Adjusting properties") base.win.requestProperties(properties) base.graphicsEngine.renderFrame() return 1
def onSize(self, event=None): '''to resize P3d Surface accordingly to his wx window container and to re-gain keyboard focus ''' wp0=base.win.getProperties() if not wp0.getOpen(): print ">>>[app onSize] win wasn't open: lets quit!" return wp=WindowProperties() wp.addProperties(wp0) wp.setSize(*self.win.getP3DSurfaceSize()) wp.setForeground(True) base.win.requestProperties(wp) if event != None: event.Skip()
def onSize(self, event=None): '''to resize P3d Surface accordingly to his wx window container and to re-gain keyboard focus ''' wp0 = base.win.getProperties() if not wp0.getOpen(): print ">>>[app onSize] win wasn't open: lets quit!" return wp = WindowProperties() wp.addProperties(wp0) wp.setSize(*self.win.getP3DSurfaceSize()) wp.setForeground(True) base.win.requestProperties(wp) if event != None: event.Skip()