当前位置: 首页>>代码示例>>Python>>正文


Python WindowProperties.getParentWindow方法代码示例

本文整理汇总了Python中pandac.PandaModules.WindowProperties.getParentWindow方法的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties.getParentWindow方法的具体用法?Python WindowProperties.getParentWindow怎么用?Python WindowProperties.getParentWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pandac.PandaModules.WindowProperties的用法示例。


在下文中一共展示了WindowProperties.getParentWindow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getParentWindow [as 别名]
 def set(self, pipe, width, height, fullscreen, embedded):
     self.notify.debugStateCall(self)
     state = False
     self.notify.info('SET')
     if self.restrict_to_embedded:
         fullscreen = 0
         embedded = 1
     if embedded:
         if base.appRunner.windowProperties:
             width = base.appRunner.windowProperties.getXSize()
             height = base.appRunner.windowProperties.getYSize()
     self.current_pipe = base.pipe
     self.current_properties = WindowProperties(base.win.getProperties())
     properties = self.current_properties
     self.notify.debug('DISPLAY PREVIOUS:')
     self.notify.debug('  EMBEDDED:   %s' % bool(properties.getParentWindow()))
     self.notify.debug('  FULLSCREEN: %s' % bool(properties.getFullscreen()))
     self.notify.debug('  X SIZE:     %s' % properties.getXSize())
     self.notify.debug('  Y SIZE:     %s' % properties.getYSize())
     self.notify.debug('DISPLAY REQUESTED:')
     self.notify.debug('  EMBEDDED:   %s' % bool(embedded))
     self.notify.debug('  FULLSCREEN: %s' % bool(fullscreen))
     self.notify.debug('  X SIZE:     %s' % width)
     self.notify.debug('  Y SIZE:     %s' % height)
     if self.current_pipe == pipe and bool(self.current_properties.getParentWindow()) == bool(embedded) and self.current_properties.getFullscreen() == fullscreen and self.current_properties.getXSize() == width and self.current_properties.getYSize() == height:
         self.notify.info('DISPLAY NO CHANGE REQUIRED')
         state = True
     else:
         properties = WindowProperties()
         properties.setSize(width, height)
         properties.setFullscreen(fullscreen)
         properties.setParentWindow(0)
         if embedded:
             if base.appRunner.windowProperties:
                 properties = base.appRunner.windowProperties
         original_sort = base.win.getSort()
         if self.resetWindowProperties(pipe, properties):
             self.notify.debug('DISPLAY CHANGE SET')
             properties = base.win.getProperties()
             self.notify.debug('DISPLAY ACHIEVED:')
             self.notify.debug('  EMBEDDED:   %s' % bool(properties.getParentWindow()))
             self.notify.debug('  FULLSCREEN: %s' % bool(properties.getFullscreen()))
             self.notify.debug('  X SIZE:     %s' % properties.getXSize())
             self.notify.debug('  Y SIZE:     %s' % properties.getYSize())
             if bool(properties.getParentWindow()) == bool(embedded) and properties.getFullscreen() == fullscreen and properties.getXSize() == width and properties.getYSize() == height:
                 self.notify.info('DISPLAY CHANGE VERIFIED')
                 state = True
             else:
                 self.notify.warning('DISPLAY CHANGE FAILED, RESTORING PREVIOUS DISPLAY')
                 self.restoreWindowProperties()
         else:
             self.notify.warning('DISPLAY CHANGE FAILED')
             self.notify.warning('DISPLAY SET - BEFORE RESTORE')
             self.restoreWindowProperties()
             self.notify.warning('DISPLAY SET - AFTER RESTORE')
         base.win.setSort(original_sort)
         base.graphicsEngine.renderFrame()
         base.graphicsEngine.renderFrame()
     return state
开发者ID:gamerdave54321,项目名称:Toontown-House-Code,代码行数:61,代码来源:DisplayOptions.py

示例2: __init__

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getParentWindow [as 别名]
class DisplayOptions:
    notify = DirectNotifyGlobal.directNotify.newCategory('DisplayOptions')
    
    def __init__(self):
        self.restore_failed = False
        self.loadFromSettings()

    
    def loadFromSettings(self):
        return
        Settings.readSettings()
        mode = not Settings.getWindowedMode()
        music = Settings.getMusic()
        sfx = Settings.getSfx()
        toonChatSounds = Settings.getToonChatSounds()
        musicVol = Settings.getMusicVolume()
        sfxVol = Settings.getSfxVolume()
        resList = [
            (640, 480),
            (800, 600),
            (1024, 768),
            (1280, 1024),
            (1600, 1200)]
        res = resList[Settings.getResolution()]
        embed = Settings.getEmbeddedMode()
        self.notify.debug('before prc settings embedded mode=%s' % str(embed))
        self.notify.debug('before prc settings full screen mode=%s' % str(mode))
        if mode == None:
            mode = 1
        
        if res == None:
            res = (800, 600)
        
        if not Settings.doSavedSettingsExist():
            self.notify.info('loadFromSettings: No settings; isDefaultEmbedded=%s' % self.isDefaultEmbedded())
            embed = self.isDefaultEmbedded()
        
        if embed and not self.isEmbeddedPossible():
            self.notify.warning('Embedded mode is not possible.')
            embed = False
        
        if not mode and not self.isWindowedPossible():
            self.notify.warning('Windowed mode is not possible.')
            mode = True
        
        loadPrcFileData('toonBase Settings Window Res', 'win-size %s %s' % (res[0], res[1]))
        self.notify.debug('settings resolution = %s' % str(res))
        loadPrcFileData('toonBase Settings Window FullScreen', 'fullscreen %s' % mode)
        self.notify.debug('settings full screen mode=%s' % str(mode))
        loadPrcFileData('toonBase Settings Music Active', 'audio-music-active %s' % music)
        loadPrcFileData('toonBase Settings Sound Active', 'audio-sfx-active %s' % sfx)
        loadPrcFileData('toonBase Settings Music Volume', 'audio-master-music-volume %s' % musicVol)
        loadPrcFileData('toonBase Settings Sfx Volume', 'audio-master-sfx-volume %s' % sfxVol)
        loadPrcFileData('toonBase Settings Toon Chat Sounds', 'toon-chat-sounds %s' % toonChatSounds)
        self.settingsFullScreen = mode
        self.settingsWidth = res[0]
        self.settingsHeight = res[1]
        self.settingsEmbedded = embed
        self.notify.debug('settings embedded mode=%s' % str(self.settingsEmbedded))
        self.notify.info('settingsFullScreen = %s, embedded = %s width=%d height=%d' % (self.settingsFullScreen, self.settingsEmbedded, self.settingsWidth, self.settingsHeight))

    
    def restrictToEmbedded(self, restrict, change_display = True):
        if base.appRunner is None or base.appRunner.windowProperties is None:
            restrict = 0
        
        self.restrict_to_embedded = choice(restrict, 1, 0)
        self.notify.debug('restrict_to_embedded: %s' % self.restrict_to_embedded)
        if change_display:
            self.set(base.pipe, self.settingsWidth, self.settingsHeight, self.settingsFullScreen, self.settingsEmbedded)
        

    
    def set(self, pipe, width, height, fullscreen, embedded):
        self.notify.debugStateCall(self)
        state = False
        self.notify.info('SET')
        if self.restrict_to_embedded:
            fullscreen = 0
            embedded = 1
        
        if embedded:
            if base.appRunner.windowProperties:
                width = base.appRunner.windowProperties.getXSize()
                height = base.appRunner.windowProperties.getYSize()
            
        
        self.current_pipe = base.pipe
        self.current_properties = WindowProperties(base.win.getProperties())
        properties = self.current_properties
        self.notify.debug('DISPLAY PREVIOUS:')
        self.notify.debug('  EMBEDDED:   %s' % bool(properties.getParentWindow()))
        self.notify.debug('  FULLSCREEN: %s' % bool(properties.getFullscreen()))
        self.notify.debug('  X SIZE:     %s' % properties.getXSize())
        self.notify.debug('  Y SIZE:     %s' % properties.getYSize())
        self.notify.debug('DISPLAY REQUESTED:')
        self.notify.debug('  EMBEDDED:   %s' % bool(embedded))
        self.notify.debug('  FULLSCREEN: %s' % bool(fullscreen))
        self.notify.debug('  X SIZE:     %s' % width)
        self.notify.debug('  Y SIZE:     %s' % height)
#.........这里部分代码省略.........
开发者ID:OldToontown,项目名称:OldToontown,代码行数:103,代码来源:DisplayOptions.py

示例3: resetWindowProperties

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getParentWindow [as 别名]
 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 and 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:
             NametagGlobals = NametagGlobals
             import libotp
             NametagGlobals.setCamera(base.cam)
             NametagGlobals.setMouseWatcher(base.mouseWatcherNode)
         
     else:
         self.notify.debug('Adjusting properties')
         base.win.requestProperties(properties)
         base.graphicsEngine.renderFrame()
     return 1
开发者ID:OldToontown,项目名称:OldToontown,代码行数:41,代码来源:DisplayOptions.py


注:本文中的pandac.PandaModules.WindowProperties.getParentWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。