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


Python WindowProperties.setParentWindow方法代码示例

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


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

示例1: setupWindow

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
    def setupWindow(self, windowType, x, y, width, height,
                    parent):
        """ Applies the indicated window parameters to the prc
        settings, for future windows; or applies them directly to the
        main window if the window has already been opened.  This is
        called by the browser. """

        if self.started and base.win:
            # If we've already got a window, this must be a
            # resize/reposition request.
            wp = WindowProperties()
            if x or y or windowType == 'embedded':
                wp.setOrigin(x, y)
            if width or height:
                wp.setSize(width, height)
            if windowType == 'embedded':
                wp.setParentWindow(parent)
            wp.setFullscreen(False)
            base.win.requestProperties(wp)
            self.windowProperties = wp
            return

        # If we haven't got a window already, start 'er up.  Apply the
        # requested setting to the prc file, and to the default
        # WindowProperties structure.

        self.__clearWindowProperties()

        if windowType == 'hidden':
            data = 'window-type none\n'
        else:
            data = 'window-type onscreen\n'

        wp = WindowProperties.getDefault()

        wp.clearParentWindow()
        wp.clearOrigin()
        wp.clearSize()

        wp.setFullscreen(False)
        if windowType == 'fullscreen':
            wp.setFullscreen(True)

        if windowType == 'embedded':
            wp.setParentWindow(parent)

        if x or y or windowType == 'embedded':
            wp.setOrigin(x, y)

        if width or height:
            wp.setSize(width, height)

        self.windowProperties = wp
        self.windowPrc = loadPrcFileData("setupWindow", data)
        WindowProperties.setDefault(wp)

        self.gotWindow = True

        # Send this call to the main thread; don't call it directly.
        messenger.send('AppRunner_startIfReady', taskChain = 'default')
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:62,代码来源:AppRunner.py

示例2: OnInit

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
	def OnInit(self):
		#prepare and start the p3d-wx hybrid-engine mainloop
		self.wxevt_loop = wx.EventLoop()
		self.wxevt_old_loop = wx.EventLoop.GetActive()
		wx.EventLoop.SetActive(self.wxevt_loop)
		base.taskMgr.add(self._mainLoop, "MainLoopTask")
		
		#instantiate and assign the wx UI object
		self.win = P3dWxWindow(size=wx.Size(640, 480))
		self.SetTopWindow(self.win)
		
		#show the wx window
		self.win.Show(True)
		# is essential to let make up wx window before P3D stuff
		self._mainLoop()
		
		#bind wx events
		self.win.Bind(wx.EVT_SIZE, self.onSize)
		self.win.Bind(wx.EVT_CLOSE, self.onClose)
		self.vetoActivate=False
		self.win.Bind(wx.EVT_ACTIVATE, self.onActivate)
		
		#open the p3d window undecorated to use in the wx frame window
		wp=WindowProperties().getDefault()
		wp.setUndecorated(True)
		wp.setOpen(True)
		wp.setParentWindow(self.win.getP3DSurface())
		wp.setOrigin(0,0)
		wp.setForeground(True)
		wp.setSize(*self.win.getP3DSurfaceSize())
		print ">>>opening p3dsurface"
		assert base.openDefaultWindow(props=wp) == True
		#
		return True
开发者ID:crempp,项目名称:psg,代码行数:36,代码来源:Editor.py

示例3: launch_panda_window

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
def launch_panda_window(panda_widget, size) :
    """
    Configure and create Panda window
    Connect to the gtk widget resize event
    Load a panda
    """
    props = WindowProperties().getDefault()
    props.setOrigin(0, 0)
    props.setSize(*size)
    props.setParentWindow(panda_widget.window.xid)
    base.openDefaultWindow(props=props)
    # ==
    panda_widget.connect("size_allocate", resize_panda_window)
    # ==
    panda = loader.loadModel("panda")
    panda.reparentTo(render)
    panda.setPos(0, 40, -5)

    pl = render.attachNewNode( PointLight( "redPointLight" ) )
    pl.node().setColor( Vec4( .9, .8, .8, 1 ) )
    render.setLight(pl)
    pl.node().setAttenuation( Vec3( 0, 0, 0.05 ) ) 


    slight = Spotlight('slight')
    slight.setColor(VBase4(1, 1, 1, 1))
    lens = PerspectiveLens()
    slight.setLens(lens)
    slnp = render.attachNewNode(slight)
    slnp.setPos(2, 20, 0)
    mid = PandaNode('mid')
    panda.attachNewNode(mid)
#    slnp.lookAt(mid)
    render.setLight(slnp)
开发者ID:drewp,项目名称:blockstack,代码行数:36,代码来源:pandagtk.py

示例4: bindToWindow

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
 def bindToWindow(self, windowHandle):
     wp = WindowProperties().getDefault()
     wp.setOrigin(0,0)
     wp.setSize(P3D_WIN_WIDTH, P3D_WIN_HEIGHT)
     wp.setParentWindow(windowHandle)
     base.openDefaultWindow(props=wp)
     self.wp = wp
开发者ID:nano13,项目名称:simulacron,代码行数:9,代码来源:test2.py

示例5: resize_panda_window

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
 def resize_panda_window(self, widget, request) :
     props = WindowProperties().getDefault()
     props = WindowProperties(self.base.win.getProperties())
     props.setOrigin(0, 0)
     props.setSize(request.width, request.height)
     props.setParentWindow(widget.window.xid)
     self.base.win.requestProperties(props)
开发者ID:drewp,项目名称:blockstack,代码行数:9,代码来源:gamescene.py

示例6: bindToWindow

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
 def bindToWindow(self, windowHandle):
     wp = WindowProperties().getDefault()
     wp.setOrigin(self._x, self._y)
     wp.setSize(self._width, self._height)
     wp.setParentWindow(windowHandle)
     base.openDefaultWindow(props=wp)
     self.wp = wp
开发者ID:kit-ipe,项目名称:sensorsEditor,代码行数:9,代码来源:rendererPanda3d.py

示例7: set

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [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

示例8: resize_panda_window

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
def resize_panda_window(widget, request) :
    """ Connected to resize event of the widget Panda is draw on so that the Panda window update its size """
    props = WindowProperties().getDefault()
    props = WindowProperties(base.win.getProperties())
    props.setOrigin(0, 0)
    props.setSize(request.width, request.height)
    props.setParentWindow(widget.window.xid)
    base.win.requestProperties(props)
开发者ID:drewp,项目名称:blockstack,代码行数:10,代码来源:pandagtk.py

示例9: initialize

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
    def initialize(self):
        self.Update()
        wp = WindowProperties()
        wp.setOrigin(0, 0)
        wp.setSize(self.ClientSize.GetWidth(), self.ClientSize.GetHeight())
        assert self.GetHandle() != 0
        wp.setParentWindow(self.GetHandle())

        # initializing panda window
        base.windowType = "onscreen"
        props = WindowProperties.getDefault()
        props.addProperties(wp)
        self.win = base.openWindow(props = props, gsg = ViewportManager.gsg)
        if self.win:
            self.cam2d = base.makeCamera2d(self.win)
            self.cam2d.node().setCameraMask(LE_CAM_MASKS[self.name])

        if ViewportManager.gsg == None:
            ViewportManager.gsg = self.win.getGsg()
        self.cam = base.camList[-1]
        self.camera = render.attachNewNode(self.name)
        #self.camera.setName(self.name)
        #self.camera.reparentTo(render)
        self.cam.reparentTo(self.camera)
        self.camNode = self.cam.node()

        self.camNode.setCameraMask(LE_CAM_MASKS[self.name])

        self.bt = base.setupMouse(self.win, True)
        self.bt.node().setPrefix('_le_%s_'%self.name[:3])
        mw = self.bt.getParent()
        mk = mw.getParent()
        winCtrl = WindowControls(
                    self.win, mouseWatcher=mw,
                    cam=self.camera,
                    camNode = self.camNode,
                    cam2d=None,
                    mouseKeyboard =mk,
                    grid = self.grid)
        base.setupWindowControls(winCtrl)

        self.initialized = True
        if self.lens != None:      self.cam.node().setLens(self.lens)
        if self.camPos != None:    self.camera.setPos(self.camPos)
        if self.camLookAt != None: self.camera.lookAt(self.camLookAt)

        self.camLens = self.camNode.getLens()

        if self.name in ['top', 'front', 'left']:
            x = self.ClientSize.GetWidth() * 0.1
            y = self.ClientSize.GetHeight() * 0.1
            self.camLens.setFilmSize(x, y)

        self.Bind(wx.EVT_SIZE, self.onSize)
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:56,代码来源:ViewPort.py

示例10: addWindow

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
 def addWindow(self, handle=None, width=500, height=500):
     """Create a new window showing the scene. Add it to the windows list
     and return it.
     If handle is not None, it is used as parent window.
     """
     wp = WindowProperties()
     wp.setOrigin(0, 0)
     wp.setSize(width, height)
     if handle is not None:
         wp.setParentWindow(handle)
     self.base.openDefaultWindow(props=wp,
                                 type="onscreen",
                                 requireWindow=True)
     return self.base.winList[-1]
开发者ID:Moqi,项目名称:panity,代码行数:16,代码来源:panda3dinstance.py

示例11: Initialize

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
 def Initialize( self, useMainWin=True ):
     """
     The panda3d window must be put into the wx-window after it has been
     shown, or it will not size correctly.
     """
     assert self.GetHandle() != 0
     wp = WindowProperties()
     wp.setOrigin( 0, 0 )
     wp.setSize( self.ClientSize.GetWidth(), self.ClientSize.GetHeight() )
     wp.setParentWindow( self.GetHandle() )
     if self._win is None:
         if useMainWin:
             base.openDefaultWindow( props=wp, gsg=None )
             self._win = base.win
         else:
             self._win = base.openWindow( props=wp, makeCamera=0 )
     self.Bind( wx.EVT_SIZE, self.OnResize )
开发者ID:Derfies,项目名称:panda3d-editor,代码行数:19,代码来源:wxPanda.py

示例12: initialize

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
 def initialize(self):
     self.Update()
     wp = WindowProperties()
     wp.setOrigin(0, 0)
     wp.setSize(self.ClientSize.GetWidth(), self.ClientSize.GetHeight())
     assert self.GetHandle() != 0
     wp.setParentWindow(self.GetHandle())
     Window.__init__(self, extraProps=wp)
     self.initialized = True
     if self.lens != None:
         self.camera.node().setLens(self.lens)
     if self.camPos != None:
         self.camera.setPos(self.camPos)
     if self.camLookAt != None:
         self.camera.lookAt(self.camLookAt)
     self.Bind(wx.EVT_SIZE, self.onSize)
     self.accept("wheel_down", self.zoomOut)
     self.accept("wheel_up", self.zoomIn)
     self.accept("page_down", self.zoomOut)
     self.accept("page_down-repeat", self.zoomOut)
     self.accept("page_up", self.zoomIn)
     self.accept("page_up-repeat", self.zoomIn)
开发者ID:highattack30,项目名称:panda3d-editor,代码行数:24,代码来源:pViewport.py

示例13: __init__

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
    def __init__(self, gtkParentWidget):
        self.pose = {}
        self.enter = 1 # 0..1 flies in the cubes
        self.currentMessage = self.cornerMessage = None
        self.videoFrame = None
        self.animSeed = 0
        self.cubeNodes = {} # color: NodePath
        self.currentLighting = 'train'
        
        self.gtkParentWidget = gtkParentWidget

        self.base = base # from DirectStart

        props = WindowProperties().getDefault()
        props.setOrigin(0, 0)
        props.setSize(1,1)
        props.setParentWindow(self.gtkParentWidget.window.xid)
        self.base.openDefaultWindow(props=props)

        self.gtkParentWidget.connect("size_allocate", self.resize_panda_window)
        self.originalNodes = self.base.render.getChildren()

        self.init()
开发者ID:drewp,项目名称:blockstack,代码行数:25,代码来源:gamescene.py

示例14: Renderer

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setParentWindow [as 别名]
class Renderer(ShowBase):
    _x = 0
    _y = 0
    _width = 400
    _height = 300

    _windowPropertices = None
    _drawTask = None

    def __init__(self, winId):
        ShowBase.__init__(self)

        self.bindToWindow(winId)
        self.setOrbitCameraControl()

        taskMng = TaskManager.Instance()
        timerIndex = taskMng.addTask(self.step)
        task       = taskMng.getTask(timerIndex)
        self._drawTask = task

        base.disableMouse() # disable default mouse controls

        # a scene
        # environ = self.loader.loadModel('environment')
        # environ.setScale(0.1)
        # environ.setZ(-5)
        # environ.reparentTo(self.render)

        # model for the camera to orbit along
        model = self.loader.loadModel('data/tank')
        model.reparentTo(self.render)
        model.setRenderModeWireframe()

        # dummy node for camera, we will rotate the dummy node fro camera rotation
        self.parentnode = self.render.attachNewNode('camparent')
        self.parentnode.reparentTo(model) # inherit transforms
        self.parentnode.setEffect(CompassEffect.make(self.render)) # NOT inherit rotation

        # the camera
        base.camera.reparentTo(self.parentnode)
        base.camera.lookAt(self.parentnode)
        base.camera.setY(-10) # camera distance from model

        # self.model = self.loader.loadModel('tank')
        # self.model.reparentTo(self.render)
        # self.model.setRenderModeWireframe()
        # self.camera.lookAt(self.model)
        # self.camera.setY(-10)

        # self.accept("escape", sys.exit)

        # self.taskMgr.add(self.spinCameraTask, "SpinCameraTask")

    # Define a procedure to move the camera.
    def spinCameraTask(self, task):
        angleDegrees = task.time * 30.0
        angleRadians = angleDegrees * (math.pi / 180.0)
        self.camera.setPos(10 * math.sin(angleRadians), -10.0 * math.cos(angleRadians), 0)
        self.camera.setHpr(angleDegrees, 0, 0)
        return task.cont

    def step(self):
        self.taskMgr.step()

    def bindToWindow(self, windowHandle):
        self._windowPropertices = WindowProperties().getDefault()
        self._windowPropertices.setOrigin(self._x, self._y)
        self._windowPropertices.setSize(self._width, self._height)
        self._windowPropertices.setParentWindow(windowHandle)
        base.openDefaultWindow(props=self._windowPropertices)

    def setWindowOrigin(self, x, y):
        self._x = x
        self._y = y

        self._windowPropertices.setOrigin(self._x, self._y)
        base.openDefaultWindow(props=self._windowPropertices)

    def setWindowSize(self, width, height):
        self._width = width
        self._height = height

        self._windowPropertices.setSize(self._width, self._height)
        base.openDefaultWindow(props=self._windowPropertices)

    def getWindowOrigin(self):
        return {"x": self._x, "y": self._y}

    def getWindowSize(self):
        return {"width": self._width, "height": self._height}


    def setOrbitCameraControl(self):
        pass
        oc = OrbitCamera(self, base)

    def startDraw(self):
        self._drawTask.start(0)

    def stopDraw(self):
#.........这里部分代码省略.........
开发者ID:kit-ipe,项目名称:sensorsEditor,代码行数:103,代码来源:Renderer.py


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