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


Python QDesktopWidget.width方法代码示例

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


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

示例1: popUp

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

		"""Popup from the tray"""

		# Reposition the window
		r = QDesktopWidget().availableGeometry()
		s = self.size()
		pos = getConfig(u"pos")
		if pos == u"Top right":
			x = r.left() + r.width()-s.width()
			y = r.top()
		elif pos == u"Top left":
			x = r.left()
			y = r.top()
		elif pos == u"Bottom right":
			x = r.left() + r.width()-s.width()
			y = r.top() + r.height()-s.height()
		elif pos == u"Bottom left":
			x = r.left()
			y = r.top() + r.height()-s.height()
		else:
			x = r.left() + r.width()/2 - s.width()/2
			y = r.top() + r.height()/2 - s.height()/2
		self.move(x, y)

		# Show it
		self.show()
		QCoreApplication.processEvents()
		self.raise_()
		self.activateWindow()

		# Focus the search box
		self.ui.lineEditQuery.selectAll()
		self.ui.lineEditQuery.setFocus()
开发者ID:Coshibu,项目名称:qnotero,代码行数:36,代码来源:qnotero.py

示例2: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
    def __init__(self, title='Popup', message='', params={}, parent=None):
        QtGui.QWidget.__init__(self, parent)

        width = 300
        height = 200

        resolution = QDesktopWidget().screenGeometry()
        self.setGeometry(resolution.width() - width, resolution.height() - height, width, height)

        pos_x = resolution.width() / 2 - width / 2
        pos_y = resolution.height() / 2 - height / 2
        self.move(pos_x, pos_y)

        self.setWindowTitle(title)
        self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)

        self.setToolTip(title)
        self.setObjectName("toolTipWindow")
        self.setStyleSheet(Resources.read(join('assets', 'styles', 'tooltip.pss')))

        self.CComamnd = QtGui.QLabel(message)
        #self.CComamnd.setFixedHeight(50)
        self.CComamnd.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft)
        self.CComamnd.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        self.CComamnd.setObjectName('command')

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.CComamnd)
        self.setLayout(layout)
        QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
        self.show()
开发者ID:andrey-ladygin-loudclear,项目名称:milana,代码行数:33,代码来源:Popup.py

示例3: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
 def __init__(self, in_file, parent=None):
     self.in_file = in_file
     try:
         s = open(self.in_file, 'r').read()
         bits = s.split('\n')
         ln = 0
         for lin in bits:
             if len(lin) > ln:
                 ln = len(lin)
         ln2 = len(bits)
     except:
         if self.in_file[self.in_file.rfind('.'):] == '.ini':
             s = ''
         else:
             s = ''
         ln = 36
         ln2 = 5
     QtGui.QDialog.__init__(self, parent)
     self.saveButton = QtGui.QPushButton(self.tr('&Save'))
     self.cancelButton = QtGui.QPushButton(self.tr('Cancel'))
     buttonLayout = QtGui.QHBoxLayout()
     buttonLayout.addStretch(1)
     buttonLayout.addWidget(self.saveButton)
     buttonLayout.addWidget(self.cancelButton)
     self.connect(self.saveButton, QtCore.SIGNAL('clicked()'), self,
                  QtCore.SLOT('accept()'))
     self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
                  self, QtCore.SLOT('reject()'))
     self.widget = QtGui.QPlainTextEdit()
     highlight = inisyntax.IniHighlighter(self.widget.document())
     if sys.platform == 'linux2':
         self.widget.setFont(QtGui.QFont('Ubuntu Mono 13', 12))
     else:
         self.widget.setFont(QtGui.QFont('Courier New', 12))
     fnt = self.widget.fontMetrics()
     ln = (ln + 5) * fnt.maxWidth()
     ln2 = (ln2 + 4) * fnt.height()
     screen = QDesktopWidget().availableGeometry()
     if ln > screen.width() * .67:
         ln = int(screen.width() * .67)
     if ln2 > screen.height() * .67:
         ln2 = int(screen.height() * .67)
     self.widget.resize(ln, ln2)
     self.widget.setPlainText(s)
     layout = QtGui.QVBoxLayout()
     layout.addWidget(self.widget)
     layout.addLayout(buttonLayout)
     self.setLayout(layout)
     self.setWindowTitle('SIREN - Edit - ' + self.in_file[self.in_file.rfind('/') + 1:])
     self.setWindowIcon(QtGui.QIcon('sen_icon32.ico'))
     size = self.geometry()
     self.setGeometry(1, 1, ln + 10, ln2 + 35)
     size = self.geometry()
     self.move((screen.width() - size.width()) / 2,
         (screen.height() - size.height()) / 2)
     self.widget.show()
开发者ID:ozsolarwind,项目名称:siren,代码行数:58,代码来源:editini.py

示例4: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
 def __init__(self, new_version = 0, update_link = None):
     super(MainForm, self).__init__()
     uic.loadUi('UI/LeechMain.ui', self)
     dw = QDesktopWidget()
     x = dw.width() * 0.7
     y = dw.height() * 0.7
     self.session = requests.session()
     self.btn_start.clicked.connect(self.start_leech)
     self.btn_start.setIcon(QtGui.QIcon('UI/start.png'))
     self.btn_start.setIconSize(QtCore.QSize(24, 24))
     # self.download_table.cellClicked.connect(self.show_download_folder)
     self.download_index = 0
     self.upload_index = 0
     self.download_table.setSelectionBehavior(Qt.QAbstractItemView.SelectRows)
     self.upload_table.setSelectionBehavior(Qt.QAbstractItemView.SelectRows)
     self.btn_stop.clicked.connect(self.stop_leech)
     self.btn_stop.setIcon(QtGui.QIcon('UI/delete.png'))
     self.btn_stop.setIconSize(QtCore.QSize(24, 24))
     self.setFixedSize(x, y)
     self.current_folder = os.getcwd()
     self.btn_new_version.clicked.connect(self.normal_update)
     self.new_version = new_version
     self.update_link = update_link
     if float(self.new_version) == 0:
         self.btn_new_version.setText("Program is up to date")
     else:
         self.update_link = update_link
         self.btn_new_version.setText("Update to version " + str(new_version))
开发者ID:yeungocanh,项目名称:python3-tool,代码行数:30,代码来源:leech.py

示例5: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)
        self.setWindowFlags(Qt.Window)

        self._mdi_area = QMdiArea()
        self._mdi_area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self._mdi_area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.setCentralWidget(self._mdi_area)
        # set the size of mid_area and DocumentViewManager based on the
        # screen size.
        screen = QDesktopWidget().availableGeometry()
        self._mdi_area.resize(screen.width() - 30, screen.height() - 80)
        self.resize(self._mdi_area.size())
        self._mdi_area.subWindowActivated.connect(self.update_actions)
        self._viewer_mapper = QSignalMapper(self)
        self._viewer_mapper.mapped[QWidget].connect(self.set_active_sub_window)

        win_title = QApplication.translate(
            "DocumentViewManager",
            "Document Viewer"
        )
        self.setWindowTitle(win_title)
        self.setUnifiedTitleAndToolBarOnMac(True)
        self.statusBar().showMessage(
            QApplication.translate(
                "DocumentViewManager",
                "Ready"
            )
        )
        self._doc_viewers = {}

        self._create_menu_actions()
        self.update_actions()
开发者ID:gltn,项目名称:stdm,代码行数:35,代码来源:document_viewer.py

示例6: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
    def __init__(self):
        """ The Settings constructor initializes the default settings
        values, which is provided as a fallback, should the config file
        somehow go missing. We use the ``qApp`` instance of The running
        ``QApplication`` to register organization and application name,
        as well as the application version.
        """
        QSettings.__init__(self)

        # This is the path prefix where we store all luma related
        # files (serverlist, templates, filter bookmarks etc.)
        self.__configPrefix = ''

        # Defaults for section: mainwindow
        self.__maximize = False
        self.__size = QSize(750, 500)
        screen = QDesktopWidget().screenGeometry()
        self.__position = QPoint((screen.width() - self.__size.width()) / 2,
                                 (screen.height() - self.__size.height()) / 2)
        # Defaults for section: i18n
        self.__language = u'en'
        # Defaults for section: logger
        self.__showLoggerOnStart = False
        self.__showLogger = False
        self.__showErrors = True
        self.__showDebug = True
        self.__showInfo = True
开发者ID:einaru,项目名称:luma,代码行数:29,代码来源:Settings.py

示例7: _center_on_screen

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
    def _center_on_screen(self):
        assert isinstance(self, QWidget)

        desktop = QDesktopWidget().availableGeometry()
        self.move(
            (desktop.width() / 2) - (self.frameSize().width() / 2),
            (desktop.height() / 2) - (self.frameSize().height() / 2),
        )
开发者ID:goc9000,项目名称:baon,代码行数:10,代码来源:CenterOnScreenMixin.py

示例8: setup

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
 def setup(self, jid, talks, messages):
     self.ui = Ui_conversationWindow()
     self.talks = talks
     self.messages = messages
     self.ui.setupUi(jid, self)
     desktopSize=QDesktopWidget().screenGeometry()
     top=(desktopSize.height()/2)-(450/2)
     left=(desktopSize.width()/2)-(300/2)
     self.move(left, top)
开发者ID:wojciechowskip,项目名称:SIK-XMPP,代码行数:11,代码来源:conversationui.py

示例9: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
 def __init__(self, parent=None):
     super(MainWindow, self).__init__(parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     desktopSize = QDesktopWidget().screenGeometry()
     top=(desktopSize.height()/2)-(450/2)
     left=(desktopSize.width()/2)-(300/2)
     self.move(left, top)
     self.connect(self.ui.friendsListWidget, QtCore.SIGNAL('itemDoubleClicked (QListWidgetItem *)'), self.openConversation)
     self.talks = dict()
     self.messages = collections.defaultdict(list)
开发者ID:wojciechowskip,项目名称:SIK-XMPP,代码行数:13,代码来源:client.py

示例10: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
    def __init__(self, parent):
        super(aboutWidget, self).__init__()
        #Set popup
        self.setWindowFlags(Qt.Popup)
        self.resize(parent.meter.width(), 307)
        self.setWindowOpacity(0.5)

        #Move aboutWidget
        if parent.isFullScreen():
            resolution = QDesktopWidget().screenGeometry()
            self.move((resolution.width() / 2) - (self.frameSize().width() / 2),
                    (resolution.height() / 2) - (self.frameSize().height() / 2))
        else:
            point = parent.meter.rect().topRight()
            global_point = parent.meter.mapToGlobal(point)
            self.move(global_point - QPoint(self.width(), 0))

        #Create vertical layout
        vbox = QVBoxLayout(self)

        #Set align and margins
        if parent.isFullScreen():
            vbox.setAlignment(Qt.AlignLeft)
            vbox.setContentsMargins(150, 0, 0, 0)
        else:
            vbox.setAlignment(Qt.AlignHCenter)
            vbox.setContentsMargins(0, 0, 0, 0)

        vbox.setSpacing(0)

        #LABELS
        #name and version
        label_name = QLabel('%s (%s)' % (__prj__, __version__))
        label_name.setObjectName('name')

        #label_url
        label_url = QLabel(
            'Source: <a style="color:orange" href="%s">Github repository</a>' % (__source__))

        #label_license
        label_license = QLabel('License: %s' % (__license__))

        #label_author
        label_author = QLabel(__author__)
        label_author.setObjectName('author')

        #Add widget to vbox
        vbox.addWidget(label_name)
        vbox.addWidget(label_license)
        vbox.addWidget(label_url)
        vbox.addWidget(label_author)

        self.setLayout(vbox)
开发者ID:LuqueDaniel,项目名称:Divergence-Meter,代码行数:55,代码来源:about_popup.py

示例11: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
    def __init__(self, title='Tooltip', command='', res='This is a QWidget', id=None, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.id = id

        #self.t = ToolTipAnimation()
        #self.t.start()

        width = 300
        height = 200

        resolution = QDesktopWidget().screenGeometry()
        self.setGeometry(resolution.width() - width, resolution.height() - height, width, height)

        pos_x = resolution.width() - width * (TooltipManage.getCountToolTips() / 3 + 1)
        pos_y = resolution.height() - height * (TooltipManage.getCountToolTips() % 3 + 1)
        self.move(pos_x, pos_y)

        self.setWindowTitle(title)
        self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
        self.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
        self.setToolTip('This is a QWidget')
        self.setObjectName("toolTipWindow")
        self.setStyleSheet(Resources.read(join('resources', 'styles', 'tooltip.pss')))

        self.CComamnd = QtGui.QLabel(command+':')
        self.CComamnd.setFixedHeight(50)
        self.CComamnd.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft)
        self.CComamnd.setObjectName('command')

        self.CLineView = QtGui.QLabel(res)
        self.CLineView.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft)
        self.CLineView.setContentsMargins(15, 0, 0, 0)
        self.CLineView.setObjectName('commandResult')

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.CComamnd)
        layout.addWidget(self.CLineView)
        self.setLayout(layout)
        QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
开发者ID:andrey-ladygin-loudclear,项目名称:milana,代码行数:41,代码来源:Tooltip.py

示例12: center

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
 def center(self):
     """
     Move the Document viewer to the center of the screen.
     """
     # Get the current screens' dimensions...
     screen = QDesktopWidget().availableGeometry()
     # ... and get this windows' dimensions
     mdi_area_size = self.frameGeometry()
     # The horizontal position
     hpos = (screen.width() - mdi_area_size.width()) / 2
     # vertical position
     vpos = (screen.height() - mdi_area_size.height()) / 2
     # repositions the window
     self.move(hpos, vpos)
开发者ID:gltn,项目名称:stdm,代码行数:16,代码来源:document_viewer.py

示例13: centerWindow

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
def centerWindow(window):
    rect   = QDesktopWidget().screenGeometry()
    width  = 0
    heigth = 0

    if rect.width <= 640: width = 620
    elif rect.width <= 800: width = 720
    else: width = 960

    if rect.height <= 480: height = 450
    elif rect.height <= 600: height = 520
    else: height = 680

    window.resize(width, height)
    window.move(rect.width()/2 - window.width()/2, rect.height()/2 - window.height()/2)
开发者ID:PisiLinuxRepos,项目名称:project,代码行数:17,代码来源:tools.py

示例14: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
    def __init__(self, parent=None):

        super(Client, self).__init__(parent)
        self.tab_widget = TabClass.TabWidget(self)

        self.setWindowTitle('Book Library')
        self.setCentralWidget(self.tab_widget)
        dw = QDesktopWidget()

        x = dw.width() * 0.7
        y = dw.height() * 0.7
        self.resize(x, y)
        self.make_menu()

        self.show()
开发者ID:christerjakobsson,项目名称:School-labs,代码行数:17,代码来源:ClientClass.py

示例15: __init__

# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import width [as 别名]
    def __init__(self, parent, diffText):
        QDialog.__init__(self, parent)
        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(self.currLocale.OmitGroupSeparator | self.currLocale.RejectGroupSeparator)
       
        self.vBoxSizer = QVBoxLayout()
        self.browser = QTextBrowser()
        self.browser.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

      
        self.browser.append(diffText)
        self.browser.verticalScrollBar().setValue(self.browser.verticalScrollBar().minimum())

        cursor = self.browser.textCursor();
        cursor.setPosition(0);
        self.browser.setTextCursor(cursor);
        
        font = QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.browser.setFont(font)
        
        self.vBoxSizer.addWidget(self.browser)

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
        buttonBox.accepted.connect(self.accept)
        self.vBoxSizer.addWidget(buttonBox)
        
        self.setLayout(self.vBoxSizer)
        self.setWindowTitle(self.tr("Diff"))

        screen = QDesktopWidget().screenGeometry()
        wd = screen.width()/4
        ht = screen.height()/3
        self.resize(wd, ht)
        self.show()
开发者ID:sam81,项目名称:pychoacoustics,代码行数:39,代码来源:dialog_show_par_diff.py


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