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


Python QtGui.QDesktopWidget方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QDesktopWidget [as 别名]
def __init__(self,parent=None):
		QtGui.QMainWindow.__init__(self, None,QtCore.Qt.WindowStaysOnTopHint|QtCore.Qt.FramelessWindowHint)#|QtCore.Qt.X11BypassWindowManagerHint)
		self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
		self.setAttribute(QtCore.Qt.WA_X11NetWmWindowTypeDock)
		#Values
		d = QtGui.QDesktopWidget()
		self.top_pos= d.availableGeometry().y()
		self.parent=parent
		self.app={}
		self.conf=self.parent.conf
		self.drawButtonRect=False
		self.buttonRect=None
		self.width=200
		self.height=30*4
		self.y_pos=147
		self.size=int(Config.get()["size"])
		self.r=int(Config.get()["r"])
		self.g=int(Config.get()["g"])
		self.b=int(Config.get()["b"])
		self.state="normal"
		self.move(self.size+10,self.y_pos+self.top_pos)
		self.resize(self.width+10,self.height+10) 
开发者ID:the-duck,项目名称:launcher,代码行数:24,代码来源:DockAppsOptions.py

示例2: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QDesktopWidget [as 别名]
def __init__(self):
		QtGui.QMainWindow.__init__(self, None,QtCore.Qt.WindowStaysOnTopHint|QtCore.Qt.FramelessWindowHint)
		self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
		d = QtGui.QDesktopWidget()
		self.w=350
		self.h=250
		self.height =d.availableGeometry().height()
		self.width =d.availableGeometry().width()
		self.top_pos= d.availableGeometry().y()
		self.r=int(Config.get()["r"])
		self.g=int(Config.get()["g"])
		self.b=int(Config.get()["b"])
		self.state=""
		self.buttonRect=None
		self.drawButtonRect=False
		self.setGeometry(self.width/2-self.w/2,self.height/2-self.h/2+self.top_pos, self.w,self.h) 
开发者ID:the-duck,项目名称:launcher,代码行数:18,代码来源:System.py

示例3: screenOptions

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QDesktopWidget [as 别名]
def screenOptions(self):
        if QtGui.QDesktopWidget().numScreens() == 1:
            self.screenFull = None
            return None
        groupBox = QtGui.QGroupBox("Screen Area")
        groupBox.setAlignment(QtCore.Qt.AlignHCenter)
        groupBox.setFixedHeight(120)
        self.screenGroup = QtGui.QButtonGroup(groupBox)
        self.displays = []
        for x in range(0, QtGui.QDesktopWidget().numScreens()):
            self.displays.append(QtGui.QRadioButton("Monitor %d" % x))
        self.screenFull = QtGui.QRadioButton("All Monitors")
        for screen in self.displays:
            self.screenGroup.addButton(screen)
        self.screenGroup.addButton(self.screenFull)
        screenLayout = QtGui.QVBoxLayout()
        for screen in self.displays:
            screenLayout.addWidget(screen)
        screenLayout.addWidget(self.screenFull)
        screenLayout.addStretch(1)
        self.screenGroup.buttonClicked.connect(self.screenChange)
        groupBox.setLayout(screenLayout)
        return groupBox 
开发者ID:tb2097,项目名称:wacom-gui,代码行数:25,代码来源:options.py

示例4: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QDesktopWidget [as 别名]
def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.setWindowTitle(u'网络嗅探器')
        self.resize(700, 650)
        self.setWindowIcon(QtGui.QIcon('icons/logo.ico'))
        screen = QtGui.QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
        self.initUI() 
开发者ID:HatBoy,项目名称:SimpleSniffer,代码行数:11,代码来源:Sniffer.py

示例5: center

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QDesktopWidget [as 别名]
def center(self):
        # centers the application on the screen
        window = self.frameGeometry()
        screen_center = QtGui.QDesktopWidget().availableGeometry().center()
        window.moveCenter(screen_center)
        self.move(window.topLeft()) 
开发者ID:KanoComputing,项目名称:kano-burners,代码行数:8,代码来源:ui.py

示例6: center

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QDesktopWidget [as 别名]
def center(self):

        qr = self.frameGeometry()
        cp = QtGui.QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft()) 
开发者ID:Warflop,项目名称:Telebix,代码行数:8,代码来源:design.py

示例7: center

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QDesktopWidget [as 别名]
def center(self):
        qr = self.frameGeometry()
        cp = QtGui.QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft()) 
开发者ID:nikan1996,项目名称:nike_purchase_system,代码行数:7,代码来源:nike_register_gui.py

示例8: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QDesktopWidget [as 别名]
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:the-duck,项目名称:launcher,代码行数:63,代码来源:Main.py

示例9: getTabletArea

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QDesktopWidget [as 别名]
def getTabletArea(self):
        # get current tablet area
        tabletInfo = os.popen("xinput list-props \"%s stylus\" | grep Coordinate" % self.tabletStylus).readlines()
        tabletInfo[0] = tabletInfo[0][41:].rstrip('\n')
        tabletInfo[0] = re.sub(",", "", tabletInfo[0])
        tabletScreenCoords = {}
        blarg = tabletInfo[0].split()
        count = 0
        for i in range(0, 3):
            for j in range(0, 3):
                tabletScreenCoords[(i, j)] = blarg[count]
                self.tabletActiveArea = self.tabletActiveArea + " " + blarg[count]
                count += 1
        # check if "full screen"
        fullScreen = True
        for i in range(0, 3):
            for j in range(0, 3):
                if i == j and float(tabletScreenCoords[(i, j)]) != 1.0:
                    fullScreen = False
                    break
                elif i != j and float(tabletScreenCoords[(i, j)]) != 0.0:
                    fullScreen = False
                    break
        if fullScreen:
            self.screenFull.setChecked(1)
        # have to build array then compare... boo
        else:
            for id in range(0, QtGui.QDesktopWidget().numScreens()):
                screen = QtGui.QDesktopWidget().screenGeometry(id)
                cmd = "xdpyinfo | grep dimensions | awk '{print $2}' | awk -Fx '{print $1, $2}'"
                totalResolution = os.popen(cmd).read()
                totalResolution = totalResolution.split()
                display = [[0 for x in xrange(3)] for x in xrange(3)]
                display[2][2] = 1.0
                display[0][0] = float(screen.width()) / float(totalResolution[0])
                # percent of screen height
                display[1][1] = float(screen.height()) / float(totalResolution[1])
                # offset in x
                if float(screen.topLeft().x()) != 0:
                    display[0][2] = float(screen.topLeft().x()) / float(totalResolution[0])
                # offset in y
                if float(screen.topLeft().y()) != 0:
                    display[1][2] = float(screen.topLeft().y()) / float(totalResolution[1])
                valid = True
                for i in range(0, 3):
                    for j in range(0, 3):
                        if float(tabletScreenCoords[(i, j)]) != float(display[i][j]):
                            valid = False
                            break
                if valid:
                    self.displays[id].setChecked(1)
                    break 
开发者ID:tb2097,项目名称:wacom-gui,代码行数:54,代码来源:options.py


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