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


Python Window类代码示例

本文整理汇总了Python中Window的典型用法代码示例。如果您正苦于以下问题:Python Window类的具体用法?Python Window怎么用?Python Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: open_it

	def open_it(self):
		Window.activateFakewin(self.fakewin.winId())
		self.plugin=False
		self.sys_win.close()
		self.open_win.close()
		self.dock_options_win.close()
		while self.pos_x<self.s_width/3-5:
			self.current_state='nothing'
			if self.pos_x<self.s_width/7:
				self.pos_x=self.s_width/7
			else:
				self.pos_x+=float(self.conf["animation-speed"])
			self.setGeometry(0,self.top_pos,self.s_width/3+5,self.s_height)
			self.update()
			QtGui.QApplication.processEvents()
		if self.pos_x!=self.s_width/3-2 :
			self.pos_x=self.s_width/3-2
		self.current_state="open"
		if self.activity=="apps":
			self.allApps=Apps.info(self.current_text)
		self.setAttribute(QtCore.Qt.WA_X11NetWmWindowTypeDock,False)
		self.windowActivationChange(True)
		self.resetInputContext()
		self.webview.setEnabled(True)
		self.webview.setFocus(True)
		self.webview.resetInputContext()
		self.update()
		self.windowActivationChange(True)
		QtGui.QApplication.processEvents()
开发者ID:harj0,项目名称:launcher,代码行数:29,代码来源:Main.py

示例2: __init__

	def __init__(self):
		QtGui.QMainWindow.__init__(self,None,QtCore.Qt.WindowStaysOnTopHint|QtCore.Qt.FramelessWindowHint)
		self.setAttribute(QtCore.Qt.WA_TranslucentBackground,True)
		self.setAttribute(QtCore.Qt.WA_X11NetWmWindowTypeDock,True)
		self.setWindowTitle("ducklauncher!!")#recognisable by wnck
		self.activateWindow()
		#screen size
		d = QtGui.QDesktopWidget()
		self.top_pos=0
		self.s_width = d.availableGeometry().width()
		self.s_height =d.availableGeometry().height()
		self.top_pos= d.availableGeometry().y()
		#Config values
		conf=Config.get()
		self.conf=conf
		self.HALF_OPEN_POS=int(conf['size'])
		self.ICO_TOP=self.HALF_OPEN_POS-5
		self.OPEN_STATE_TOP=self.ICO_TOP*4+5
		self.SIZE = 14
		#Geometry
		self.setGeometry(0,self.top_pos,self.HALF_OPEN_POS+9,self.s_height)
		#Values
		self.ICON_SIZE=int(conf['icon-size'])
		self.apps_per_row = math.trunc(((self.s_width/3)-50)/ int(self.conf["icon-size"]))
		self.apps_per_col = math.trunc(((self.s_height)-90)/ int(self.conf["icon-size"]))
		self.apps_per_page=self.apps_per_col*self.apps_per_row
		self.app_page_state=0
		self.appRect=None		
		self.drawAppRect=False
		self.pos_x=self.HALF_OPEN_POS-2
		self.move=False
		self.current_state="half_open"
		self.activity="apps"
		self.dock_apps = Apps.find_info(self.conf['dock-apps'])	
		self.current_text=''
		self.allApps=Apps.info(self.current_text)
		self.plugin=False
		self.pl_rect_pos=0
		self.pl_logo=None
		self.fg_color=(int(self.conf['r']),int(self.conf['g']),int(self.conf['b']))
		self.font_color=(int(self.conf['font-r']),int(self.conf['font-g']),int(self.conf['font-b']))
		##Windows
		#Enables the server which gets open windows
		self.op_thread=Window.openWindowsThread()
		self.op_thread.start()
		self.connect(self.op_thread,QtCore.SIGNAL("new-window"),self.addOpenWindow)
		self.connect(self.op_thread,QtCore.SIGNAL("remove-window"),self.updateOpenWindows)
		self.open_windows=Window.get_open_windows()
		self.ow_in_dock=[]
		#Dock Apps Options Window
		self.dock_options_win=DockAppsOptions.Window(parent=self)
		#Webview (for plugins, files, and settings view)
		self.webview=Widgets.pluginView(self)
		self.webview.setGeometry(2,60,self.s_width/3-20,self.s_height-60)
		#System window
		self.sys_win=System.Window()
		#Fake window, required to capture keyboard events
		self.fakewin = Fakewin(10,10, self)
		self.fakewin.show()
		XlibStuff.fix_window(self.winId(),self.HALF_OPEN_POS+3,0,0,0)
开发者ID:descentos,项目名称:launcher,代码行数:60,代码来源:Main.py

示例3: __init__

	def __init__(self):
		QtGui.QMainWindow.__init__(self, None,QtCore.Qt.WindowStaysOnTopHint|QtCore.Qt.FramelessWindowHint)#| QtCore.Qt.X11BypassWindowManagerHint)
		self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
		self.setWindowTitle("ducklauncher")#recognisable by wnck
		#screen size
		d = QtGui.QDesktopWidget()
		self.top_pos=0
		self.s_width = d.availableGeometry().width()
		self.s_height =d.availableGeometry().height()
		d.resized.connect(self.updateSize)
		#Config
		conf=Config.get()
		self.conf=conf
		self.HALF_OPEN_POS=int(conf['size'])
		self.ICO_TOP=self.HALF_OPEN_POS-5
		self.OPEN_STATE_TOP=self.ICO_TOP*4+5
		self.SIZE = 15
		self.R=int(conf['r'])
		self.G=int(conf['g'])
		self.B=int(conf['b'])
		self.ICON_SIZE=int(conf['icon-size'])
		#Geometry
		self.setGeometry(0,0,self.HALF_OPEN_POS+4,self.s_height)
		#reserve wndow space
		#self.activateWindow()
		xwin = XlibStuff.fix_window(self.winId(),self.HALF_OPEN_POS+5,0,0,0)
		#
		#Values
		self.apps_per_row = math.trunc(((self.s_width/3)-30)/self.ICON_SIZE)
		self.apps_per_col = math.trunc(((self.s_height)-30)/self.ICON_SIZE)
		self.apps_per_page=self.apps_per_col*self.apps_per_row
		self.app_page_state=0
		self.files_page_state=0
		self.Files = Files.getFiles()
		self.pos_x=self.HALF_OPEN_POS
		self.move=False
		self.current_state="half_open"
		self.activity="apps"
		self.dock_apps = Apps.find_info(self.conf['dock-apps'])
		self.current_text=''
		#Update open windows
		self.timer=QtCore.QTimer()
		self.timer.setInterval(2000)
		self.timer.start()
		self.timer.timeout.connect(self.updateOpenWindows)
		#
		self.open_windows=window.get_open_windows()
		self.open_win = window.open_windows()
		self.open_state=False
		#
		self.settings_win = Settings.Window(self)
开发者ID:xcool,项目名称:launcher,代码行数:51,代码来源:Main.py

示例4: open_it

	def open_it(self):
		Window.activateFakewin(self.fakewin.winId())
		self.sys_win.close()
		self.open_win.close()
		while self.pos_x<self.s_width/3:
			self.current_state='nothing'
			if self.pos_x<self.s_width/7:
				self.pos_x=self.s_width/7
			else:
				self.pos_x+=1.5
			self.setGeometry(0,self.top_pos,self.s_width/3+5,self.s_height)
			self.update()
			QtGui.QApplication.processEvents()
		self.current_state="open"
		if self.activity=="apps":
			self.allApps=Apps.info(self.current_text)
		self.update()
开发者ID:archlinux2002,项目名称:launcher,代码行数:17,代码来源:Main.py

示例5: onClick

    def onClick(self, sender):
        if (sender == self.signOutLink):
            Window.alert("If this were implemented, you would be signed out now.")
        elif (sender == self.aboutLink):
            # When the 'About' item is selected, show the AboutDialog.
            # Note that showing a dialog box does not block -- execution continues
            # normally, and the dialog fires an event when it is closed.
            dlg = AboutDialog()

            # Position it roughly in the middle of the screen.
            left = (Window.getClientWidth() - 512) / 2
            top = (Window.getClientHeight() - 256) / 2
            #Logger("TopPanel", "left: " + left)
            #Logger("TopPanel", "top: " + top)
            dlg.setPopupPosition(left, top)

            dlg.show()
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:17,代码来源:TopPanel.py

示例6: onSave

 def onSave(self):
     """
     Handle the save click and pass it onto the listeners
     """
     console.log("onSave() in %s", Window.getLocation().getHref())
     for listener in self.saveListeners:
         if listener.onSave: listener.onSave(self)
         else: listener(self)
     return False
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:9,代码来源:RichTextEditor.py

示例7: __reset

 def __reset(self):
     """
     Resets the game and all its objects
     :return:
     """
     self.map = None
     self.mapFile = self.__loadMap()
     self.window = Window(len(self.mapFile[0]) * BaseTile.WIDTH, len(self.mapFile) * BaseTile.HEIGHT)
     self.renderMenu = True
     self.enemies.empty()
开发者ID:divid3byzero,项目名称:zompy,代码行数:10,代码来源:Controller.py

示例8: updateOpenWindows

	def updateOpenWindows(self):
		self.open_windows=Window.get_open_windows()
		try:
			if self.conf["size"]!=self.HALF_OPEN_POS:
				XlibStuff.fix_window(self.winId(),self.HALF_OPEN_POS+5,0,0,0)
		except:
			pass
		self.update()
		QtGui.QApplication.processEvents()
		Config.check_dict(self.conf)
开发者ID:harj0,项目名称:launcher,代码行数:10,代码来源:Main.py

示例9: wheelEvent

	def wheelEvent(self,e):
		Window.activateFakewin(self.fakewin.winId())
		if self.activity == 'apps':
			value= int(e.delta()/120)
			max_pages=math.trunc((len(self.allApps)-1)/self.apps_per_page)
			if value>0 and self.app_page_state>0:
				self.app_page_state-=1
			if value<0 and self.app_page_state<max_pages:
				self.app_page_state+=1
			self.update()
			QtGui.QApplication.processEvents()
		if self.activity == 'files':
			value= int(e.delta()/120)
			max_pages=math.trunc(len(self.Files.all())/self.apps_per_page)
			if value>0 and self.files_page_state>0:
				self.files_page_state-=1
			if value<0 and self.files_page_state<max_pages:
				self.files_page_state+=1
			self.update()
			QtGui.QApplication.processEvents()
开发者ID:archlinux2002,项目名称:launcher,代码行数:20,代码来源:Main.py

示例10: onModuleLoad

    def onModuleLoad(self):
        self.singleton = self

        topPanel = TopPanel()
        rightPanel = VerticalPanel()
        self.mailDetail = MailDetail()
        self.shortcuts = Shortcuts()

        topPanel.setWidth("100%")

        # MailList uses Mail.get() in its constructor, so initialize it after
        # 'singleton'.
        mailList = MailList(self.singleton)
        mailList.setWidth("100%")
        
        # Create the right panel, containing the email list & details.
        rightPanel.add(mailList)
        rightPanel.add(self.mailDetail)
        mailList.setWidth("100%")
        self.mailDetail.setWidth("100%")

        # Create a dock panel that will contain the menu bar at the top,
        # the shortcuts to the left, and the mail list & details taking the rest.
        outer = DockPanel()
        outer.add(topPanel, DockPanel.NORTH)
        outer.add(self.shortcuts, DockPanel.WEST)
        outer.add(rightPanel, DockPanel.CENTER)
        outer.setWidth("100%")

        outer.setSpacing(4)
        outer.setCellWidth(rightPanel, "100%")

        # Hook the window resize event, so that we can adjust the UI.
        #FIXME need implementation # Window.addWindowResizeListener(this)
        #Window.addWindowResizeListener(self)

        # Get rid of scrollbars, and clear out the window's built-in margin,
        # because we want to take advantage of the entire client area.
        Window.enableScrolling(False)
        Window.setMargin("0px")
        
        # Finally, add the outer panel to the RootPanel, so that it will be
        # displayed.
        #RootPanel.get().add(outer) # FIXME get#
        RootPanel().add(outer)
        RootPanel().add(Logger())
        
        # Call the window resized handler to get the initial sizes setup. Doing
        # this in a deferred command causes it to occur after all widgets' sizes
        # have been computed by the browser.

        # FIXME - need implementation#
        #     DeferredCommand.add(onWindowResized(Window.getClientWidth(), Window.getClientHeight()))

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
开发者ID:AwelEshetu,项目名称:cwm,代码行数:55,代码来源:Mail.py

示例11: __init__

    def __init__(self):
        super(GLTD, self).__init__()
        
        self.totalEnemies = 1
        
        self.window = Window()
        self.window.addActor(GridActor(0, 0, 600, 600))
        self.window.board = BoardActor(0, 0, 600, 600)
        self.window.addActor(self.window.board)
        
        self.window.addActor(masterParticleClock) # TODO: unmessify. IMPORTANT
        
        #anim = Animation(20, [], LINEAR)
        #self.px = 10.0
        #self.py = 10
        #anim.onCompletion(self.createNewParticles)
        #anim.loop = True
        #self.window.addAnimation(anim)
        #anim.start()

        anim = Animation(1864, [], LINEAR)
        anim.onCompletion(self.createNewEnemy)
        anim.loop = True
        self.window.addAnimation(anim)
        anim.start()
        
        #tower = RedL1TowerActor(4,7)
        #self.window.addTower(tower)
        #tower.start()
        #
        #tower = RedL1TowerActor(10,5)
        #tower.range = 150
        #tower.reloadSpeed = 300
        #tower.damage = 1000
        #tower.shake = 2
        #self.window.addTower(tower)
        #tower.start()
        
        towerChooser = TowerChooser(600, 300, 200, 300)
        self.window.addActor(towerChooser)
        
        tower = RedL1TowerActor(0, 0)
        tower.active = False
        tower.x = tower.y = 40.0
        towerChooser.addActor(tower)

        glutMainLoop()
开发者ID:hortont424,项目名称:gltd,代码行数:47,代码来源:main.py

示例12: onModuleLoad

 def onModuleLoad(self):
     slot = RootPanel("calendar")
     Window.alert("slot:" + slot)
     if slot:
         calendar = SchoolCalendarWidget(15)
         Window.alert(len(slot.children))
         Window.alert(slot.children)
         slot.add(calendar)
         
         slot = RootPanel("days")
         if slot:
             filterWidget = DayFilterWidget(calendar)
             slot.add(filterWidget)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:13,代码来源:DynaTable.py

示例13: __init__

 def __init__(self):
     """
     The Constructor of the Controller
     """
     self.themeFactory = None
     self.mapFile = self.__loadMap()
     self.map = None
     self.window = Window(len(self.mapFile[0]) * BaseTile.WIDTH, len(self.mapFile) * BaseTile.HEIGHT)
     self.jukebox = Jukebox()
     self.player = None
     self.clock = pygame.time.Clock()
     self.enemies = pygame.sprite.RenderPlain()
     self.bullets = pygame.sprite.RenderPlain()
     self.walls = pygame.sprite.RenderPlain()
     self.pathfinder = Pathfinder()
     self.players = pygame.sprite.RenderPlain()
     self.collisionDetector = None
     self.renderMenu = True
     self.userInterface = None
开发者ID:divid3byzero,项目名称:zompy,代码行数:19,代码来源:Controller.py

示例14: main

def main():
	#random.seed(0)
	#environment = Environment(gridSize=32, cellSize=10, terrainResolution=128)
	environment = Environment(gridSize=32, cellSize=10, terrainResolution=128)
	window = Window(environment)
	window.start()
开发者ID:ianholst,项目名称:LifeOfPy,代码行数:6,代码来源:Main.py

示例15: Controller

class Controller(object):
    """
    The Controller of the game
    """
    def __init__(self):
        """
        The Constructor of the Controller
        """
        self.themeFactory = None
        self.mapFile = self.__loadMap()
        self.map = None
        self.window = Window(len(self.mapFile[0]) * BaseTile.WIDTH, len(self.mapFile) * BaseTile.HEIGHT)
        self.jukebox = Jukebox()
        self.player = None
        self.clock = pygame.time.Clock()
        self.enemies = pygame.sprite.RenderPlain()
        self.bullets = pygame.sprite.RenderPlain()
        self.walls = pygame.sprite.RenderPlain()
        self.pathfinder = Pathfinder()
        self.players = pygame.sprite.RenderPlain()
        self.collisionDetector = None
        self.renderMenu = True
        self.userInterface = None

    def start(self):
        """
        Starts the game by "starting" the infinite loop
        :return:
        """
        self.jukebox.playSound("menu")
        while True:
            # PROCESS INPUT
            self.__handle_events()

            # LOGIC STUFF
            if self.renderMenu:
                self.jukebox.playSound("menu")
                self.__renderMenu()

            elif self.player.life <= 0:
                self.jukebox.playSound("dead")
                self.userInterface.drawLostScreen()


            else:
                self.jukebox.playSound("game")
                if self.player is not None:
                    self.player.move()

                if pygame.time.get_ticks() % (1000 / self.map.amountHorizontal) is 0:
                    self.__spawnEnemy()
                self.enemies.update(self.player, self.map)
                self.bullets.update()
                self.collisionDetector.checkCollisions()

                # DRAW EVERYTHING
                self.userInterface.draw()
                self.__drawWorld()

            pygame.display.flip()
            self.clock.tick(30)

    def __drawWorld(self):
        """
        Draws all game objects
        """
        self.map.sprites.draw(self.window.screen)
        self.players.draw(self.window.screen)
        self.enemies.draw(self.window.screen)
        self.bullets.draw(self.window.screen)
        self.userInterface.draw()

    def __loadMap(self):
        """
        Loads and generates the map
        :return: the generated map
        """
        mapGenerator = MapGenerator()
        return mapGenerator.generateMap()

    def __initPlayer(self):
        """
        Builds the Player
        :return: the player object
        """
        tile = self.map.getWalkableTile()
        player = self.themeFactory.createThemeElement("pl")
        player.setCoordinates(tile.row, tile.col)
        self.players.add(player)
        return player

    def __spawnEnemy(self):
        """
        Spawns the enemy at a random spawn point
        """
        tile = self.map.getSpawnPoint()
        enemy = Enemy()
        enemy.setCoordinates(tile.row, tile.col)
        self.enemies.add(enemy)

#.........这里部分代码省略.........
开发者ID:divid3byzero,项目名称:zompy,代码行数:101,代码来源:Controller.py


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