Python PyQt5.QtCore.QSize() Examples

The following are code examples for showing how to use PyQt5.QtCore.QSize(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: examples   Author: pyqt   File: borderlayout.py    (license) View Source Project 15 votes vote down vote up
def calculateSize(self, sizeType):
        totalSize = QSize()

        for wrapper in self.list:
            position = wrapper.position
            itemSize = QSize()

            if sizeType == self.MinimumSize:
                itemSize = wrapper.item.minimumSize()
            else: # sizeType == self.SizeHint
                itemSize = wrapper.item.sizeHint()

            if position in (self.North, self.South, self.Center):
                totalSize.setHeight(totalSize.height() + itemSize.height())

            if position in (self.West, self.East, self.Center):
                totalSize.setWidth(totalSize.width() + itemSize.width())

        return totalSize 
Example 2
Project: examples   Author: pyqt   File: textbutton.py    (license) View Source Project 13 votes vote down vote up
def __init__(self, text, align=LEFT, userCode=0, parent=None, type=SIDEBAR):
        super(TextButton, self).__init__(parent)

        # Prevent a circular import.
        from menumanager import MenuManager
        self._menu_manager = MenuManager.instance()

        self.menuString = text
        self.buttonLabel = text
        self.alignment = align
        self.buttonType = type
        self.userCode = userCode
        self.scanAnim = None
        self.bgOn = None
        self.bgOff = None
        self.bgHighlight = None
        self.bgDisabled = None
        self.state = TextButton.OFF

        self.setAcceptHoverEvents(True)
        self.setCursor(Qt.PointingHandCursor)

        # Calculate the button size.
        if type in (TextButton.SIDEBAR, TextButton.PANEL):
            self.logicalSize = QSize(TextButton.BUTTON_WIDTH, TextButton.BUTTON_HEIGHT)
        else:
            self.logicalSize = QSize(int((TextButton.BUTTON_WIDTH / 2.0) - 5), int(TextButton.BUTTON_HEIGHT * 1.5))

        self._prepared = False 
Example 3
Project: tvlinker   Author: ozmartian   File: downloader.py    (license) View Source Project 11 votes vote down vote up
def __init__(self, link_url: str, dl_path: str, parent=None):
        super(Downloader, self).__init__(parent)
        self.parent = parent
        self.dltool_cmd = find_executable(self.download_cmd)
        self.download_link = link_url
        self.download_path = dl_path
        if self.dltool_cmd.strip():
            self.dltool_args = self.dltool_args.format(dl_path=self.download_path, dl_link=self.download_link)
            self.console = QTextEdit(self.parent)
            self.console.setWindowTitle('%s Downloader' % qApp.applicationName())
            self.proc = QProcess(self.parent)
            layout = QVBoxLayout()
            layout.addWidget(self.console)
            self.setLayout(layout)
            self.setFixedSize(QSize(400, 300))
        else:
            QMessageBox.critical(self.parent, 'DOWNLOADER ERROR', '<p>The <b>aria2c</b> executable binary could not ' +
                                 'be found in your installation folders. The binary comes packaged with this ' +
                                 'application so it is likely that it was accidentally deleted via human ' +
                                 'intervntion or incorrect file permissions are preventing access to it.</p>' +
                                 '<p>You may either download and install <b>aria2</b> manually yourself, ensuring ' +
                                 'its installation location is globally accessible via PATH environmnt variables or ' +
                                 'simply reinstall this application again. If the issue is not resolved then try ' +
                                 'to download the application again incase the orignal you installed already was ' +
                                 'corrupted/broken.', buttons=QMessageBox.Close) 
Example 4
Project: Milis-Yukleyici   Author: sonakinci41   File: son.py    (license) View Source Project 9 votes vote down vote up
def __init__(self, ebeveyn=None):
        super(Son, self).__init__(ebeveyn)
        self.e = ebeveyn
        self.kapanacak_mi =False

        kutu = QGridLayout()
        self.setLayout(kutu)

        milis_logo = QLabel()
        milis_logo.setAlignment(Qt.AlignCenter)
        milis_logo.setPixmap(QPixmap("./resimler/milis-logo.svg"))
        kutu.addWidget(milis_logo,0,0,1,2)

        self.veda_label = QLabel()
        self.veda_label.setAlignment(Qt.AlignCenter)
        self.veda_label.setWordWrap(True)
        kutu.addWidget(self.veda_label,1,0,1,2)

        self.denemeye_devam = QRadioButton()
        self.denemeye_devam.setIcon(QIcon("./resimler/cik.svg"))
        self.denemeye_devam.setIconSize(QSize(50,50))
        self.denemeye_devam.toggled.connect(self.degisti)
        kutu.addWidget(self.denemeye_devam,2,0,1,1)
        self.kapat = QRadioButton()
        self.kapat.setIcon(QIcon("./resimler/yeniden-baslat.svg"))
        self.kapat.setIconSize(QSize(50,50))
        self.kapat.toggled.connect(self.degisti)
        kutu.addWidget(self.kapat,2,1,1,1)

        self.denemeye_devam.setChecked(True) 
Example 5
Project: Enibar   Author: ENIB   File: notes_management_window.py    (license) View Source Project 7 votes vote down vote up
def add_photo(self):
        """ Function called to add a photo. Open a QFileDialog and fill
            self.photo with the selected image
        """
        self.photo_selected = QtWidgets.QFileDialog(self).getOpenFileUrl(
            self, "Selectionnez une image", settings.IMG_BASE_DIR,
            "Image Files (*.png *.jpg *.bmp)")[0].path()

        if self.photo_selected:
            image = QtGui.QPixmap(self.photo_selected)

            if not image.isNull():
                self.photo.setPixmap(image.scaled(QtCore.QSize(120, 160)))
                self.on_change() 
Example 6
Project: pytc-gui   Author: harmslab   File: experiment_widget.py    (license) View Source Project 6 votes vote down vote up
def layout(self):
        """
        Layout the row for this experiment.
        """

        self._main_layout = QW.QGridLayout(self)

        # Construct the header for the experiment
        self._main_layout.addWidget(QW.QLabel(self._expt_label),0,0)
 
        # -------------- Buttons --------------------

        # Button to show experiment options
        self._show_options_button = QW.QPushButton("", self)
        self._show_options_button.clicked.connect(self._options_callback)
        self._show_options_button.setIcon(QG.QIcon(os.path.join(self._image_base,"icons","more-info.png")))
        self._show_options_button.setIconSize(QC.QSize(21,21))
        self._show_options_button.setFixedWidth(30)
        self._main_layout.addWidget(self._show_options_button,0,1)

        # Button to remove experiment
        self._remove_button = QW.QPushButton("", self)
        self._remove_button.clicked.connect(self._remove_callback)
        self._remove_button.setIcon(QG.QIcon(os.path.join(self._image_base,"icons","delete-icon.png")))
        self._remove_button.setIconSize(QC.QSize(21,21))
        self._remove_button.setFixedWidth(30)
        self._main_layout.addWidget(self._remove_button,0,2)

        self.setFrameShape(QW.QFrame.StyledPanel)

        if self._experiment is None:
            self._show_options_button.setDisabled(True)
            self._remove_button.setDisabled(True) 
Example 7
Project: activity-browser   Author: LCA-ActivityBrowser   File: menu_bar.py    (license) View Source Project 6 votes vote down vote up
def about(self):
        text = '''
Activity Browser - a graphical interface for Brightway2.<br><br>
All development happens on <a href="https://github.com/LCA-ActivityBrowser/activity-browser">github</a>.<br><br>
Main developers:<br>
- Bernhard Steubing (CML Leiden University, [email protected])<br>
- Chris Mutel (Paul Scherer Institut, [email protected])<br>
- Adrian Haas (ETH Zurich, [email protected])<br><br>
Copyright (c) 2015, Bernhard Steubing and ETH Zurich<br>
Copyright (c) 2016, Chris Mutel and Paul Scherrer Institut<br>
Copyright (c) 2017, Adrian Haas (ETH Zurich) and Bernhard Steubing (Leiden University)<br>
<br>
LICENSE:<br>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.<br><br>
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.<br><br>
You should have received a copy of the GNU General Public License along with this program.  If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
'''
        msgBox = QtWidgets.QMessageBox()
        msgBox.setWindowTitle('About the Activity Browser')
        pixmap = self.window.icon.pixmap(QtCore.QSize(150, 150))
        msgBox.setIconPixmap(pixmap)
        msgBox.setWindowIcon(self.window.icon)
        msgBox.setText(text)
        msgBox.exec_() 
Example 8
Project: PyNoder   Author: johnroper100   File: graph_view.py    (license) View Source Project 6 votes vote down vote up
def __init__(self, parent=None):
        super(GraphView, self).__init__(parent)
        self.setObjectName('graphView')

        self.__graphViewWidget = parent

        self.setRenderHint(QtGui.QPainter.Antialiasing)
        self.setRenderHint(QtGui.QPainter.TextAntialiasing)

        self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)

        # Explicitly set the scene rect. This ensures all view parameters will be explicitly controlled
        # in the event handlers of this class.
        size = QtCore.QSize(600, 400)
        self.resize(size)
        self.setSceneRect(-size.width() * 0.5, -size.height() * 0.5, size.width(), size.height())

        self.setAcceptDrops(True)
        self.reset() 
Example 9
Project: TabPad   Author: nitg16   File: TabPadUi.py    (license) View Source Project 6 votes vote down vote up
def clickUI(self, click_types, clickstack):
		layout = QVBoxLayout()
		widget = QWidget()
		hbox = QHBoxLayout()

		for name in click_types:
			cbtn = QPushButton(name)
			cbtn.setMinimumSize(QtCore.QSize(100, 50))
			cbtn.setStyleSheet(self.btnstyle)
			cbtn.clicked.connect(partial(self.all_keys_list, name, cbtn, 'click'))
			layout.addWidget(cbtn)
		
		widget.setLayout(layout)
		hbox.addStretch(1)
		hbox.addWidget(widget)
		hbox.addStretch(1)
		clickstack.setLayout(hbox) 
Example 10
Project: Qyoutube-dl   Author: lzambella   File: about.py    (license) View Source Project 6 votes vote down vote up
def setupUi(self, About):
        About.setObjectName("About")
        About.resize(401, 117)
        About.setMinimumSize(QtCore.QSize(401, 117))
        About.setMaximumSize(QtCore.QSize(401, 117))
        self.buttonBox = QtWidgets.QDialogButtonBox(About)
        self.buttonBox.setGeometry(QtCore.QRect(10, 80, 381, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setCenterButtons(True)
        self.buttonBox.setObjectName("buttonBox")
        self.label = QtWidgets.QLabel(About)
        self.label.setGeometry(QtCore.QRect(0, 20, 401, 21))
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(About)
        self.label_2.setGeometry(QtCore.QRect(0, 40, 401, 20))
        self.label_2.setAlignment(QtCore.Qt.AlignCenter)
        self.label_2.setObjectName("label_2")

        self.retranslateUi(About)
        self.buttonBox.clicked['QAbstractButton*'].connect(About.close)
        QtCore.QMetaObject.connectSlotsByName(About) 
Example 11
Project: scm-workbench   Author: barry-scott   File: wb_main_window.py    (license) View Source Project 6 votes vote down vote up
def __init__( self, app, debug_fn, parent=None ):
        self.app = app
        self.log = self.app.log
        self.debugLog = app.debug_options.debugLogMainWindow

        super().__init__( parent )

        self.icon_size = QtCore.QSize( 32, 32 )

        # list of all the WbActionState for the menus and toolbars
        self.__action_state_manager = WbActionStateManager( self.debugLog )

        self.__focus_is_in = self.focus_is_in_names[0]

        # Often the rest of init has to be done after the widgets are rendered
        # for example to set focus on a widget
        self.__timer_init = QtCore.QTimer()
        self.__timer_init.timeout.connect( self.__completeInit )
        self.__timer_init.setSingleShot( True )
        self.__timer_init.start( 0 ) 
Example 12
Project: StarCraft-Casting-Tool   Author: teampheenix   File: __init__.py    (license) View Source Project 6 votes vote down vote up
def main_window(app, translator, cntlr=None):
    """Run the main exectuable."""
    from PyQt5.QtCore import QSize
    from PyQt5.QtGui import QIcon
    from scctool.controller import MainController
    from scctool.view.main import MainWindow

    try:
        """Run the main program."""
        icon = QIcon()
        icon.addFile(getAbsPath('src/scct.ico'), QSize(32, 32))
        icon.addFile(getAbsPath('src/scct.png'), QSize(256, 256))
        app.setWindowIcon(icon)
        if cntlr is None:
            cntlr = MainController()
        MainWindow(cntlr, app, translator)
        logger.info("Starting...")
        return cntlr

    except Exception as e:
        logger.exception("message")
        raise 
Example 13
Project: Crawler_UI_New   Author: crystalhsj   File: Ui_Login.py    (license) View Source Project 6 votes vote down vote up
def setupUi(self, Login):
        Login.setObjectName("Login")
        Login.resize(300, 400)
        Login.setMinimumSize(QtCore.QSize(300, 400))
        Login.setMaximumSize(QtCore.QSize(300, 400))
        self.pushButton = QtWidgets.QPushButton(Login)
        self.pushButton.setGeometry(QtCore.QRect(100, 320, 99, 27))
        self.pushButton.setObjectName("pushButton")
        self.label_2 = QtWidgets.QLabel(Login)
        self.label_2.setGeometry(QtCore.QRect(28, 190, 68, 17))
        self.label_2.setObjectName("label_2")
        self.lineEdit_2 = QtWidgets.QLineEdit(Login)
        self.lineEdit_2.setGeometry(QtCore.QRect(120, 190, 151, 27))
        self.lineEdit_2.setEchoMode(QtWidgets.QLineEdit.Password)
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.label = QtWidgets.QLabel(Login)
        self.label.setGeometry(QtCore.QRect(28, 120, 68, 17))
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(Login)
        self.lineEdit.setGeometry(QtCore.QRect(120, 120, 151, 27))
        self.lineEdit.setObjectName("lineEdit")

        self.retranslateUi(Login)
        QtCore.QMetaObject.connectSlotsByName(Login) 
Example 14
Project: Vector-Tiles-Reader-QGIS-Plugin   Author: geometalab   File: dlg_about_qt5.py    (license) View Source Project 6 votes vote down vote up
def setupUi(self, DlgAbout):
        DlgAbout.setObjectName("DlgAbout")
        DlgAbout.resize(382, 372)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(DlgAbout.sizePolicy().hasHeightForWidth())
        DlgAbout.setSizePolicy(sizePolicy)
        self.gridLayout = QtWidgets.QGridLayout(DlgAbout)
        self.gridLayout.setObjectName("gridLayout")
        self.btnClose = QtWidgets.QPushButton(DlgAbout)
        self.btnClose.setMinimumSize(QtCore.QSize(80, 0))
        self.btnClose.setObjectName("btnClose")
        self.gridLayout.addWidget(self.btnClose, 1, 0, 1, 1, QtCore.Qt.AlignRight)
        self.txtAbout = QtWidgets.QTextBrowser(DlgAbout)
        self.txtAbout.setMinimumSize(QtCore.QSize(350, 240))
        self.txtAbout.setOpenExternalLinks(True)
        self.txtAbout.setObjectName("txtAbout")
        self.gridLayout.addWidget(self.txtAbout, 0, 0, 1, 1)

        self.retranslateUi(DlgAbout)
        self.btnClose.clicked.connect(DlgAbout.reject)
        QtCore.QMetaObject.connectSlotsByName(DlgAbout) 
Example 15
Project: Cite   Author: siudej   File: citeWindow.py    (license) View Source Project 6 votes vote down vote up
def __init__(self):
        """ Initialize main window. """
        QMainWindow.__init__(self)
        self.setupUi(self)
        self.resize(QSize(settings.get('citewidth'),
                          settings.get('citeheight')))
        self.move(QPoint(settings.get('citex'),
                         settings.get('citey')))
        self.tabWidget.tabBar().setCurrentIndex(0)
        self.searchTab.setFocus()
        self.setWindowTitle('Cite')
        self.show()
        self.raise_()

        self.linkSettings()

        self.searchQuery.installEventFilter(self)
        self.text = self.bibtext = self.lastquery = ""
        self.batchBibtext = self.batchText = ""
        self.neverOpened = True

        self.helpText.setSource(QUrl('doc/help.html')) 
Example 16
Project: gpvdm   Author: roderickmackenzie   File: ribbon_database.py    (license) View Source Project 6 votes vote down vote up
def __init__(self):
		QToolBar.__init__(self)

		self.setToolButtonStyle( Qt.ToolButtonTextUnderIcon)
		self.setIconSize(QSize(42, 42))
		
		self.materials = QAction(QIcon_load("organic_material"), _("Materials\ndatabase"), self)
		self.materials.triggered.connect(self.callback_view_materials)
		self.addAction(self.materials)

		self.spectra_file = QAction(QIcon_load("spectra_file"), _("Optical\ndatabase"), self)
		self.spectra_file.triggered.connect(self.callback_view_optical)
		self.addAction(self.spectra_file)

		if enable_betafeatures()==True:
			self.tb_import_pvlighthouse = QAction(QIcon_load("sync"), _("Update materials\nfrom PVLighthouse"), self)
			self.tb_import_pvlighthouse.triggered.connect(self.callback_pvlighthouse)
			self.addAction(self.tb_import_pvlighthouse)

			self.tb_import_refractiveindex = QAction(QIcon_load("sync"), _("Update materials\nfrom refractiveindex.info"), self)
			self.tb_import_refractiveindex.triggered.connect(self.callback_refractiveindex)
			self.addAction(self.tb_import_refractiveindex) 
Example 17
Project: gpvdm   Author: roderickmackenzie   File: ribbon.py    (license) View Source Project 6 votes vote down vote up
def file(self):
		toolbar = QToolBar()
		toolbar.setToolButtonStyle( Qt.ToolButtonTextUnderIcon)
		toolbar.setIconSize(QSize(42, 42))
		
		self.home_new = QAction(QIcon_load("document-new"), _("New simulation").replace(" ","\n"), self)
		#self.home_new.setText(_("New\nsimulation"))
		toolbar.addAction(self.home_new)

		self.home_open = QAction(QIcon_load("document-open"), _("Open\nsimulation"), self)
		toolbar.addAction(self.home_open)

		self.home_export = QAction(QIcon_load("document-export"), _("Export\ndata"), self)
		toolbar.addAction(self.home_export)

		spacer = QWidget()
		spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
		toolbar.addWidget(spacer)

		self.home_help = QAction(QIcon_load("internet-web-browser"), _("Help"), self)
		toolbar.addAction(self.home_help)

		return toolbar 
Example 18
Project: gpvdm   Author: roderickmackenzie   File: information_webkit.py    (license) View Source Project 6 votes vote down vote up
def __init__(self):
		QWidget.__init__(self)

		self.setMinimumSize(1000,500)
		self.html = QWebView()

		vbox=QVBoxLayout()

		toolbar=QToolBar()
		toolbar.setIconSize(QSize(48, 48))

		back = QAction(QIcon_load("go-previous.png"),  _("back"), self)
		back.triggered.connect(self.html.back)
		toolbar.addAction(back)

		home = QAction(QIcon_load("user-home.png"),  _("home"), self)
		home.triggered.connect(self.home)
		toolbar.addAction(home)

		self.tb_url=QLineEdit()
		self.tb_url.returnPressed.connect(self.browse)
		toolbar.addWidget(self.tb_url)
		
		vbox.addWidget(toolbar)

		self.default_url = "http://www.gpvdm.com/welcome.html"
		self.tb_url.setText(self.default_url)
		self.browse()

		vbox.addWidget(self.html)

		self.setLayout(vbox)
		return 
Example 19
Project: pyqt5   Author: yurisnm   File: ScreenRecorder.py    (license) View Source Project 6 votes vote down vote up
def init_timer(self):
        self.interval_timer = 10
        self.timer = QTimer()
        self.timer.timeout.connect(self.update_time_elapsed)
        self.hours_elapsed = 0
        self.mins_elapsed = 0
        self.segs_elapsed = 0
        self.msegs_elapsed = 0
        self.lbl_time_elapsed = QLabel()
        self.update_timer_elapsed()

        self.lbl_time_elapsed.setFixedSize(QSize(100, 30))
        self.lbl_time_elapsed.setStyleSheet("""
            color: white;
            background-color: #080f1c;
        """)
        self.layout_timer.addWidget(self.lbl_time_elapsed)
        self.layout_timer.addStretch(-1) 
Example 20
Project: pyqt5   Author: yurisnm   File: KeyboardKey.py    (license) View Source Project 6 votes vote down vote up
def set_up_button(self, style, str_icon_on, str_icon_off, auto_repeat,
                      size, receiver, key, str_key):
        self.__size = size
        self.__style = style
        self.__icon_on = str_icon_on
        self.__icon_off = str_icon_off
        self.__auto_repeat = auto_repeat
        self.__receiver = receiver
        self.__key = key
        self.__str_key = str_key
        if str_key not in ['KB', 'A?', '?', '?', 'backspace']:
            self.setText(str_key)

        self.setFixedSize(size[0], size[1])
        self.setStyleSheet(style)
        self.setIconSize(QSize(size[0], size[1]))
        self.setIcon(QIcon(self.__path + str_icon_off + ".png"))
        self.setAutoRepeat(auto_repeat)
        # pix_map = QPixmap(self.__path + str_icon_off + ".png")
        # self.setMask(pix_map.mask())
        self.pressed.connect(self.key_pressed)
        self.released.connect(self.key_released) 
Example 21
Project: defconQt   Author: trufont   File: glyphCellView.py    (license) View Source Project 6 votes vote down vote up
def sizeHint(self):
        parent = self.parent()
        width = parent.width() if parent is not None else self.width()
        if self._glyphs:
            columnCount = int(width / self._cellWidth)
            if columnCount == 0:
                columnCount = 1
            if columnCount > len(self._glyphs):
                columnCount = len(self._glyphs)
            rowCount = len(self._glyphs) // columnCount
            if columnCount * rowCount < len(self._glyphs):
                rowCount += 1
            newWidth = self._cellWidth * columnCount
            newHeight = self._cellHeight * rowCount
        else:
            columnCount = 0
            rowCount = 0
            newWidth = newHeight = 0
        self._columnCount = columnCount
        self._rowCount = rowCount
        return QSize(newWidth, newHeight) 
Example 22
Project: pysport   Author: sportorg   File: main.py    (license) View Source Project 6 votes vote down vote up
def _setup_ui(self):
        geometry = ConfigFile.GEOMETRY
        x = Configuration().parser.getint(geometry, 'x', fallback=480)
        y = Configuration().parser.getint(geometry, 'y', fallback=320)
        width = Configuration().parser.getint(geometry, 'width', fallback=880)
        height = Configuration().parser.getint(geometry, 'height', fallback=474)

        self.setMinimumSize(QtCore.QSize(480, 320))
        self.setGeometry(x, y, 480, 320)
        self.setWindowIcon(QtGui.QIcon(config.ICON))
        self.set_title()
        self.resize(width, height)
        self.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.setDockNestingEnabled(False)
        self.setDockOptions(QtWidgets.QMainWindow.AllowTabbedDocks
                            | QtWidgets.QMainWindow.AnimatedDocks
                            | QtWidgets.QMainWindow.ForceTabbedDocks) 
Example 23
Project: Py2DSpectroscopy   Author: SvenBo90   File: colormapDialogUi.py    (license) View Source Project 6 votes vote down vote up
def __init__(self, colormap_dialog):

        # set window title, object name and window size
        colormap_dialog.setWindowTitle("Choose Colormap")
        colormap_dialog.setObjectName("ColormapDialog")
        colormap_dialog.setFixedWidth(455)
        colormap_dialog.setFixedHeight(100)

        # button box
        self.button_box = QDialogButtonBox(colormap_dialog)
        self.button_box.setEnabled(True)
        self.button_box.setGeometry(QRect(10, 60, 435, 30))
        self.button_box.setOrientation(Qt.Horizontal)
        self.button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
        self.button_box.setObjectName("button_box")

        # colormap selector
        self.colormap_combobox = QComboBox(colormap_dialog)
        self.colormap_combobox.setGeometry(QRect(10, 10, 435, 30))
        self.colormap_combobox.setIconSize(QSize(435, 20))

        # connect accept and reject
        self.button_box.accepted.connect(colormap_dialog.accept)
        self.button_box.rejected.connect(colormap_dialog.reject) 
Example 24
Project: pypog   Author: cro-ki   File: qt_listview.py    (license) View Source Project 6 votes vote down vote up
def setupUi(self, window):
        window.setObjectName("window")
        window.resize(380, 477)
        window.setModal(True)
        self.verticalLayout = QtWidgets.QVBoxLayout(window)
        self.verticalLayout.setObjectName("verticalLayout")
        self.txt_list = QtWidgets.QTextEdit(window)
        self.txt_list.setMinimumSize(QtCore.QSize(183, 0))
        self.txt_list.setAcceptRichText(False)
        self.txt_list.setObjectName("txt_list")
        self.verticalLayout.addWidget(self.txt_list)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setContentsMargins(-1, -1, -1, 10)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.btn_cancel = QtWidgets.QPushButton(window)
        self.btn_cancel.setAutoDefault(False)
        self.btn_cancel.setObjectName("btn_cancel")
        self.horizontalLayout.addWidget(self.btn_cancel)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.btn_ok = QtWidgets.QPushButton(window)
        self.btn_ok.setAutoDefault(True)
        self.btn_ok.setObjectName("btn_ok")
        self.horizontalLayout.addWidget(self.btn_ok)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.retranslateUi(window)
        QtCore.QMetaObject.connectSlotsByName(window) 
Example 25
Project: Mac-Python-3.X   Author: L1nwatch   File: borderlayout.py    (license) View Source Project 6 votes vote down vote up
def calculateSize(self, sizeType):
        totalSize = QSize()

        for wrapper in self.list:
            position = wrapper.position
            itemSize = QSize()

            if sizeType == self.MinimumSize:
                itemSize = wrapper.item.minimumSize()
            else: # sizeType == self.SizeHint
                itemSize = wrapper.item.sizeHint()

            if position in (self.North, self.South, self.Center):
                totalSize.setHeight(totalSize.height() + itemSize.height())

            if position in (self.West, self.East, self.Center):
                totalSize.setWidth(totalSize.width() + itemSize.width())

        return totalSize 
Example 26
Project: Mac-Python-3.X   Author: L1nwatch   File: svgviewer.py    (license) View Source Project 6 votes vote down vote up
def openFile(self, path=None):
        if not path:
            path, _ = QFileDialog.getOpenFileName(self, "Open SVG File",
                    self.currentPath, "SVG files (*.svg *.svgz *.svg.gz)")

        if path:
            svg_file = QFile(path)
            if not svg_file.exists():
                QMessageBox.critical(self, "Open SVG File",
                        "Could not open file '%s'." % path)

                self.outlineAction.setEnabled(False)
                self.backgroundAction.setEnabled(False)
                return

            self.view.openFile(svg_file)

            if not path.startswith(':/'):
                self.currentPath = path
                self.setWindowTitle("%s - SVGViewer" % self.currentPath)

            self.outlineAction.setEnabled(True)
            self.backgroundAction.setEnabled(True)

            self.resize(self.view.sizeHint() + QSize(80, 80 + self.menuBar().height())) 
Example 27
Project: Mac-Python-3.X   Author: L1nwatch   File: icons.py    (license) View Source Project 6 votes vote down vote up
def changeSize(self, checked=True):
        if not checked:
            return

        if self.otherRadioButton.isChecked():
            extent = self.otherSpinBox.value()
        else:
            if self.smallRadioButton.isChecked():
                metric = QStyle.PM_SmallIconSize
            elif self.largeRadioButton.isChecked():
                metric = QStyle.PM_LargeIconSize
            elif self.toolBarRadioButton.isChecked():
                metric = QStyle.PM_ToolBarIconSize
            elif self.listViewRadioButton.isChecked():
                metric = QStyle.PM_ListViewIconSize
            elif self.iconViewRadioButton.isChecked():
                metric = QStyle.PM_IconViewIconSize
            else:
                metric = QStyle.PM_TabBarIconSize

            extent = QApplication.style().pixelMetric(metric)

        self.previewArea.setSize(QSize(extent, extent))
        self.otherSpinBox.setEnabled(self.otherRadioButton.isChecked()) 
Example 28
Project: examples   Author: pyqt   File: svgviewer.py    (license) View Source Project 6 votes vote down vote up
def openFile(self, path=None):
        if not path:
            path, _ = QFileDialog.getOpenFileName(self, "Open SVG File",
                    self.currentPath, "SVG files (*.svg *.svgz *.svg.gz)")

        if path:
            svg_file = QFile(path)
            if not svg_file.exists():
                QMessageBox.critical(self, "Open SVG File",
                        "Could not open file '%s'." % path)

                self.outlineAction.setEnabled(False)
                self.backgroundAction.setEnabled(False)
                return

            self.view.openFile(svg_file)

            if not path.startswith(':/'):
                self.currentPath = path
                self.setWindowTitle("%s - SVGViewer" % self.currentPath)

            self.outlineAction.setEnabled(True)
            self.backgroundAction.setEnabled(True)

            self.resize(self.view.sizeHint() + QSize(80, 80 + self.menuBar().height())) 
Example 29
Project: examples   Author: pyqt   File: icons.py    (license) View Source Project 6 votes vote down vote up
def changeSize(self, checked=True):
        if not checked:
            return

        if self.otherRadioButton.isChecked():
            extent = self.otherSpinBox.value()
        else:
            if self.smallRadioButton.isChecked():
                metric = QStyle.PM_SmallIconSize
            elif self.largeRadioButton.isChecked():
                metric = QStyle.PM_LargeIconSize
            elif self.toolBarRadioButton.isChecked():
                metric = QStyle.PM_ToolBarIconSize
            elif self.listViewRadioButton.isChecked():
                metric = QStyle.PM_ListViewIconSize
            elif self.iconViewRadioButton.isChecked():
                metric = QStyle.PM_IconViewIconSize
            else:
                metric = QStyle.PM_TabBarIconSize

            extent = QApplication.style().pixelMetric(metric)

        self.previewArea.setSize(QSize(extent, extent))
        self.otherSpinBox.setEnabled(self.otherRadioButton.isChecked()) 
Example 30
Project: binja_dynamics   Author: nccgroup   File: __init__.py    (license) View Source Project 5 votes vote down vote up
def update_registers(self, registers):
        """ Takes a dict of registers - 'name' : (value, width). Mostly just a wrapper around update_single_registers"""
        self._table.setRowCount(len(registers))
        for register in registers:
            self.update_single_register(register, registers[register][0], registers[register][1])
        self.resize(QSize(self._layout.sizeHint().width(), self._table.viewportSizeHint().height() + self._picker.sizeHint().height() + self._table.sizeHint().height())) 
Example 31
Project: satellite-tracker   Author: lofaldli   File: map.py    (MIT License) View Source Project 5 votes vote down vote up
def sizeHint(self):
        return QSize(800, 400) 
Example 32
Project: satellite-tracker   Author: lofaldli   File: qtgui.py    (MIT License) View Source Project 5 votes vote down vote up
def sizeHint(self):
        return QSize(400, 100) 
Example 33
Project: activity-browser   Author: LCA-ActivityBrowser   File: table.py    (license) View Source Project 5 votes vote down vote up
def sizeHint(self):
        """ Could be implemented like this to return the width and heights of the table. """
        if self.rowCount() > 0:
            height = self.rowHeight(0) * (self.rowCount() + 1) + self.autoScrollMargin()
            # print("Size Hint:", height)
            return QtCore.QSize(self.width(), height)
        else:
            return QtCore.QSize(self.width(), 50) 
Example 34
Project: Pyquino   Author: kmolLin   File: test.py    (license) View Source Project 5 votes vote down vote up
def minimumSizeHint(self):
        return QSize(50, 50) 
Example 35
Project: Pyquino   Author: kmolLin   File: test.py    (license) View Source Project 5 votes vote down vote up
def sizeHint(self):
        return QSize(400, 400) 
Example 36
Project: QtPropertyBrowserV2.6-for-pyqt5   Author: theall   File: qttreepropertybrowser.py    (license) View Source Project 5 votes vote down vote up
def init(self, parent):
        layout = QHBoxLayout(parent)
        layout.setContentsMargins(0, 0, 0, 0)
        self.m_treeWidget = QtPropertyEditorView(parent)
        self.m_treeWidget.setEditorPrivate(self)
        self.m_treeWidget.setIconSize(QSize(18, 18))
        layout.addWidget(self.m_treeWidget)
        parent.setFocusProxy(self.m_treeWidget)

        self.m_treeWidget.setColumnCount(2)
        labels = QList()
        labels.append(QCoreApplication.translate("QtTreePropertyBrowser", "Property"))
        labels.append(QCoreApplication.translate("QtTreePropertyBrowser", "Value"))
        self.m_treeWidget.setHeaderLabels(labels)
        self.m_treeWidget.setAlternatingRowColors(True)
        self.m_treeWidget.setEditTriggers(QAbstractItemView.EditKeyPressed)
        self.m_delegate = QtPropertyEditorDelegate(parent)
        self.m_delegate.setEditorPrivate(self)
        self.m_treeWidget.setItemDelegate(self.m_delegate)
        self.m_treeWidget.header().setSectionsMovable(False)
        self.m_treeWidget.header().setSectionResizeMode(QHeaderView.Stretch)

        self.m_expandIcon = drawIndicatorIcon(self.q_ptr.palette(), self.q_ptr.style())

        self.m_treeWidget.collapsed.connect(self.slotCollapsed)
        self.m_treeWidget.expanded.connect(self.slotExpanded)
        self.m_treeWidget.currentItemChanged.connect(self.slotCurrentTreeItemChanged) 
Example 37
Project: QtPropertyBrowserV2.6-for-pyqt5   Author: theall   File: qttreepropertybrowser.py    (license) View Source Project 5 votes vote down vote up
def sizeHint(self, option, index):
        return super(QtPropertyEditorDelegate, self).sizeHint(option, index) + QSize(3, 4) 
Example 38
Project: QtPropertyBrowserV2.6-for-pyqt5   Author: theall   File: qtbuttonpropertybrowser.py    (license) View Source Project 5 votes vote down vote up
def createButton(self, parent=None):
        button = QToolButton(parent)
        button.setCheckable(True)
        button.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed))
        button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        button.setArrowType(Qt.DownArrow)
        button.setIconSize(QSize(3, 16))
        ###
        #QIcon icon
        #icon.addPixmap(self.style().standardPixmap(QStyle.SP_ArrowDown), QIcon.Normal, QIcon.Off)
        #icon.addPixmap(self.style().standardPixmap(QStyle.SP_ArrowUp), QIcon.Normal, QIcon.On)
        #button.setIcon(icon)
        ###
        return button 
Example 39
Project: TabPad   Author: nitg16   File: TabPadUi.py    (license) View Source Project 5 votes vote down vote up
def keyUI(self, syms, keystack):
		layout = QGridLayout()
		scroll = QScrollArea()
		scroll.setWidgetResizable(True)
		widget = QWidget()
		vbox = QVBoxLayout()
		widget.setLayout(layout)
		btn_list = []
		positions = [(i,j) for i in range(int(len(syms)/4)+1) for j in range(4)]
		for position, name in zip(positions, syms):
			kbtn = QPushButton(name)
			kbtn.setMinimumSize(QtCore.QSize(50, 50))
			kbtn.setStyleSheet(self.btnstyle)
			layout.addWidget(kbtn, *position)
			kbtn.clicked.connect(partial(self.all_keys_list, name, kbtn, 'key'))
		scroll.setWidget(widget)

		qs = QScroller.scroller(scroll.viewport())
		props = qs.scrollerProperties()
		props.setScrollMetric(QScrollerProperties.DecelerationFactor, 0.35)
		props.setScrollMetric(QScrollerProperties.DragStartDistance, .001)
		qs.setScrollerProperties(props)
		qs.grabGesture(scroll.viewport(), QScroller.TouchGesture)
		
		vbox.addWidget(scroll)
		keystack.setLayout(vbox) 
Example 40
Project: tvlinker   Author: ozmartian   File: settings.py    (license) View Source Project 5 votes vote down vote up
def __init__(self, settings: QSettings):
        super(FavoritesTab, self).__init__()
        self.settings = settings
        faves_formLayout = QFormLayout(labelAlignment=Qt.AlignRight)
        self.faves_lineEdit = QLineEdit(self)
        self.faves_lineEdit.returnPressed.connect(self.add_item)
        self.faves_lineEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        faves_addItemButton = QPushButton(parent=self, flat=False, cursor=Qt.PointingHandCursor, text='Add',
                                          icon=QIcon(':assets/images/plus.png'), toolTip='Add item',
                                          clicked=self.add_item)
        faves_addItemButton.setIconSize(QSize(12, 12))
        faves_deleteItemButton = QPushButton(parent=self, flat=False, cursor=Qt.PointingHandCursor, text='Delete',
                                             icon=QIcon(':assets/images/minus.png'), toolTip='Delete selected item',
                                             clicked=self.delete_items)
        faves_deleteItemButton.setIconSize(QSize(12, 12))
        faves_buttonLayout = QHBoxLayout()
        faves_buttonLayout.addWidget(faves_addItemButton)
        faves_buttonLayout.addWidget(faves_deleteItemButton)
        faves_formLayout.addRow('Item Label:', self.faves_lineEdit)
        faves_formLayout.addRow(faves_buttonLayout)
        faves_formLayout.addRow(self.get_notes())
        self.faves_listWidget = QListWidget(self)
        self.faves_listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.faves_listWidget.setSortingEnabled(True)
        self.add_items(self.settings.value('favorites', ''))

        tab_layout = QHBoxLayout()
        tab_layout.addLayout(faves_formLayout)
        tab_layout.addWidget(self.faves_listWidget)

        self.setLayout(tab_layout) 
Example 41
Project: kaptan   Author: KaOSx   File: tabwidget.py    (license) View Source Project 5 votes vote down vote up
def createTabIconSet(self):
        self.tabIconSet = QWidget()
        self.tabIconSet.setObjectName("tabIconSet")

        self.verticalLayout_3 = QVBoxLayout(self.tabIconSet)
        self.verticalLayout_3.setObjectName("verticalLayout_3")

        self.listWidgetIconSet = QListWidget(self.tabIconSet)
        self.listWidgetIconSet.setResizeMode(QListView.Adjust)
        self.listWidgetIconSet.setObjectName("listWidgetIconSet")
        self.listWidgetIconSet.setViewMode(QListView.IconMode)
        self.listWidgetIconSet.setIconSize(QSize(370, 64))
        
        item = QListWidgetItem(self.listWidgetIconSet)
        item.setIcon(QIcon(":/data/images/midna-set.png"))
        item.setText("Midna")
        
        item = QListWidgetItem(self.listWidgetIconSet)
        item.setIcon(QIcon(":/data/images/midna-dark-set.png"))
        item.setText("MidnaDark")
        
        item = QListWidgetItem(self.listWidgetIconSet)
        item.setIcon(QIcon(":/data/images/breeze-set.png"))
        item.setText("Breeze")

        item = QListWidgetItem(self.listWidgetIconSet)
        item.setIcon(QIcon(":/data/images/oxygen-set.png"))
        item.setText("Oxygen")

        self.verticalLayout_3.addWidget(self.listWidgetIconSet)

        self.addTab(self.tabIconSet, self.tr("Icon Set")) 
Example 42
Project: git-annex-metadata-gui   Author: alpernebbi   File: auto_size_line_edit.py    (license) View Source Project 5 votes vote down vote up
def sizeHint(self):
        height = super().sizeHint().height()
        min_width = self.minimumSizeHint().width()
        text_width = self.fontMetrics().width(self.text())

        width = text_width + min_width
        if not self.isVisible() and self.isClearButtonEnabled():
            width += 26

        return QtCore.QSize(width, height) 
Example 43
Project: FuME   Author: fupadev   File: app.py    (license) View Source Project 5 votes vote down vote up
def alreadyReservedMessageBox(self, text):
        msgBox = QtWidgets.QMessageBox()
        msgBox.setIcon(QtWidgets.QMessageBox.Information)
        msgBox.setBaseSize(QtCore.QSize(600, 300))
        msgBox.setText("Bereits reservierte Spiele gefunden!")
        msgBox.setInformativeText(text)
        msgBox.exec() 
Example 44
Project: FuME   Author: fupadev   File: UpdateDialog.py    (license) View Source Project 5 votes vote down vote up
def installUpdates(self):
        if platform == "win32":
            url = self.data['url-windows']
            os = 'Windows'
        else:
            url = self.data['url-mac']
            os = 'macOS'

        text = """
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li {{ white-space: pre-wrap; }}
</style></head><body style=" font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;">

Die neuste Version für {platform} kannst du unter folgendem Link herunterladen: <br />
<a href='{url}'>{url}</a><br /><br />
Lade das Update herunter, schließe FuME, installiere die Datei und öffne FuME erneut.<br /><br />
Mit einem klick auf OK erlaubst du FuME, den obigen Link in deinem Browser zu öffnen.<br /><br />

</body></html>
        """.format(platform=os, url=url)

        msgBox = QtWidgets.QMessageBox(self)
        msgBox.setIcon(QtWidgets.QMessageBox.Information)
        msgBox.setWindowTitle("Software-Update")
        msgBox.setText("Software-Update")
        msgBox.setInformativeText(text)
        msgBox.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok)
        msgBox.setDefaultButton(QtWidgets.QMessageBox.Ok)
        msgBox.setBaseSize(QtCore.QSize(550, 275))
        ret = msgBox.exec()

        if ret == QtWidgets.QMessageBox.Ok:
            webbrowser.open(url)
            self.close() 
Example 45
Project: MusicNet   Author: vidursatija   File: window.py    (license) View Source Project 5 votes vote down vote up
def drawUI(self):
		self.play = QPushButton(self)
		self.play.setIconSize(QSize(40, 40))
		self.play.setIcon(QIcon(QPixmap("play.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
		self.play.setStyleSheet("background-color: rgba(0, 0, 0, 0);")
		self.play.clicked.connect(lambda:self.playpause(self.play))
		self.resize(50, 50) 
Example 46
Project: MusicNet   Author: vidursatija   File: window.py    (license) View Source Project 5 votes vote down vote up
def drawUI(self):
		self.play = QPushButton(self)
		self.play.setIconSize(QSize(40, 20))
		self.play.setIcon(QIcon(QPixmap("fastforward.png").scaled(40, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
		self.play.setStyleSheet("background-color: rgba(0, 0, 0, 0);")
		self.play.clicked.connect(lambda:self.forward())
		self.resize(80, 40) 
Example 47
Project: MusicNet   Author: vidursatija   File: window.py    (license) View Source Project 5 votes vote down vote up
def drawUI(self):
		self.play = QPushButton(self)
		self.play.setIconSize(QSize(40, 20))
		self.play.setIcon(QIcon(QPixmap("rewind.png").scaled(40, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
		self.play.setStyleSheet("background-color: rgba(0, 0, 0, 0);")
		self.play.clicked.connect(lambda:self.rewind())
		self.resize(80, 40) 
Example 48
Project: acbDecrypter   Author: Rieksee   File: ui_main.py    (license) View Source Project 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(830, 333)
        Form.setMinimumSize(QtCore.QSize(700, 300))
        self.gridLayout = QtWidgets.QGridLayout(Form)
        self.gridLayout.setObjectName("gridLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setSpacing(20)
        self.verticalLayout.setObjectName("verticalLayout")
        self.listView = QtWidgets.QListView(Form)
        self.listView.setObjectName("listView")
        self.verticalLayout.addWidget(self.listView)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSpacing(30)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.pushButton = QtWidgets.QPushButton(Form)
        self.pushButton.setMinimumSize(QtCore.QSize(0, 50))
        self.pushButton.setObjectName("pushButton")
        self.horizontalLayout.addWidget(self.pushButton)
        self.pushButton_2 = QtWidgets.QPushButton(Form)
        self.pushButton_2.setMinimumSize(QtCore.QSize(0, 50))
        self.pushButton_2.setMaximumSize(QtCore.QSize(230, 16777215))
        self.pushButton_2.setObjectName("pushButton_2")
        self.horizontalLayout.addWidget(self.pushButton_2)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

        self.retranslateUi(Form)
        self.listView.clicked['QModelIndex'].connect(Form.key_selected)
        self.pushButton.clicked.connect(Form.enter)
        self.pushButton_2.clicked.connect(Form.not_use_key)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 49
Project: mhri   Author: mhri   File: QVTKRenderWindowInteractor.py    (license) View Source Project 5 votes vote down vote up
def sizeHint(self):
        return QSize(400, 400) 
Example 50
Project: vidcutter   Author: ozmartian   File: videotoolbar.py    (license) View Source Project 5 votes vote down vote up
def __init__(self, parent=None):
        super(VideoToolBar, self).__init__(parent)
        self.parent = parent
        self.setObjectName('appcontrols')
        self.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        self.setFloatable(False)
        self.setMovable(False)
        self.setIconSize(QSize(50, 53))
        if sys.platform == 'darwin':
            self.setStyle(QStyleFactory.create('Fusion'))