Python PyQt5.QtWidgets.QSizePolicy.Minimum() Examples

The following are 9 code examples of PyQt5.QtWidgets.QSizePolicy.Minimum(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtWidgets.QSizePolicy , or try the search function .
Example #1
Source File: collectionEditor.py    From openMotor with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, buttons=False):
        super(CollectionEditor, self).__init__(QWidget(parent))

        self.preferences = None

        self.propertyEditors = {}
        self.setLayout(QVBoxLayout())
        self.layout().setSpacing(0)

        self.form = QFormLayout()
        self.layout().addLayout(self.form)

        self.stats = QVBoxLayout()
        self.layout().addLayout(self.stats)


        self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.layout().addItem(self.verticalSpacer)

        self.buttons = buttons
        if self.buttons:
            self.addButtons() 
Example #2
Source File: keyhintwidget.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, win_id, parent=None):
        super().__init__(parent)
        self.setTextFormat(Qt.RichText)
        self._win_id = win_id
        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
        self.hide()
        self._show_timer = usertypes.Timer(self, 'keyhint_show')
        self._show_timer.timeout.connect(self.show)
        self._show_timer.setSingleShot(True)
        stylesheet.set_register(self) 
Example #3
Source File: textbase.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None, elidemode=Qt.ElideRight):
        super().__init__(parent)
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum)
        self._elidemode = elidemode
        self._elided_text = '' 
Example #4
Source File: playerframe.py    From dunya-desktop with GNU General Public License v3.0 5 votes vote down vote up
def __set_design(self):
        """
        Sets general settings of frame widget, adds dock area and dock widgets.
        """
        self.setWindowTitle('Player')
        self.resize(1200, 550)

        self.dock_area = DockAreaWidget()

        # dock fixed waveform
        dock_waveform = pgdock.Dock(name="Waveform", area='Top',
                                    hideTitle=True, closable=False,
                                    autoOrientation=False)
        dock_waveform.setMinimumHeight(100)
        dock_waveform.layout.setSizeConstraint(QLayout.SetMinimumSize)
        dock_waveform.widgetArea.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,
                                                           QSizePolicy.Minimum))

        # initializing waveform widget
        self.waveform_widget = WaveformWidget()

        # adding waveform widget to waveform dock
        dock_waveform.addWidget(self.waveform_widget)
        dock_waveform.allowedAreas = ['top']
        dock_waveform.setAcceptDrops(False)
        # adding waveform dock to dock area
        self.dock_area.addDock(dock_waveform, position='top')

        # adding dock area to frame
        layout = QVBoxLayout(self)
        layout.addWidget(self.dock_area) 
Example #5
Source File: page_widget.py    From linux-show-player with GNU General Public License v3.0 5 votes vote down vote up
def init_layout(self):
        for row in range(0, self.__rows):
            self.layout().setRowStretch(row, 1)
            # item = QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding)
            # self.layout().addItem(item, row, 0)

        for column in range(0, self.__columns):
            self.layout().setColumnStretch(column, 1)
            # item = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
            # self.layout().addItem(item, 0, column) 
Example #6
Source File: settings.py    From guppy-proxy with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        QWidget.__init__(self, *args, **kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.listenerlist = ListenerList()
        self.listenerlist.listenersUpdated.connect(self.listenersUpdated)
        self.layout().addWidget(self.listenerlist)

        self.hostinput = QLineEdit()
        self.hostinput.setText("127.0.0.1")
        self.hostinput.returnPressed.connect(self.add_listener)
        self.portinput = QLineEdit()
        self.portinput.setMaxLength(5)
        self.portinput.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        self.portinput.returnPressed.connect(self.add_listener)
        self.addbutton = QToolButton()
        self.addbutton.setText("+")
        self.removebutton = QToolButton()
        self.removebutton.setText("-")
        editbar = QHBoxLayout()
        editbar.addWidget(self.addbutton)
        editbar.addWidget(self.removebutton)
        editbar.addWidget(QLabel("Interface:"))
        editbar.addWidget(self.hostinput)
        editbar.addWidget(QLabel("Port:"))
        editbar.addWidget(self.portinput)

        self.removebutton.clicked.connect(self.listenerlist.delete_selected)
        self.addbutton.clicked.connect(self.add_listener)

        self.layout().addLayout(editbar) 
Example #7
Source File: collectionEditor.py    From openMotor with GNU General Public License v3.0 5 votes vote down vote up
def loadProperties(self, obj):
        self.cleanup()
        for prop in obj.props:
            self.propertyEditors[prop] = PropertyEditor(self, obj.props[prop], self.preferences)
            self.propertyEditors[prop].valueChanged.connect(self.propertyUpdate)
            label = QLabel(obj.props[prop].dispName + ':')
            label.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)
            self.form.addRow(label, self.propertyEditors[prop])
        if self.buttons:
            self.applyButton.show()
            self.cancelButton.show()
        self.propertyUpdate() 
Example #8
Source File: repeater.py    From guppy-proxy with MIT License 4 votes vote down vote up
def __init__(self, client):
        QWidget.__init__(self)
        self.client = client
        self.history = []
        self.history_pos = 0

        self.setLayout(QVBoxLayout())
        self.layout().setSpacing(0)
        self.layout().setContentsMargins(0, 0, 0, 0)
        buttons = QHBoxLayout()
        buttons.setContentsMargins(0, 0, 0, 0)
        buttons.setSpacing(8)

        submitButton = QPushButton("Submit")
        submitButton.clicked.connect(self.submit)
        self.dest_host_input = QLineEdit()
        self.dest_port_input = QLineEdit()
        self.dest_port_input.setMaxLength(5)
        self.dest_port_input.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        self.dest_usetls_input = QCheckBox()
        
        self.back_button = QToolButton()
        self.back_button.setText("<")
        self.back_button.clicked.connect(self.back)
        self.forward_button = QToolButton()
        self.forward_button.setText(">")
        self.forward_button.clicked.connect(self.forward)

        buttons.addWidget(self.back_button)
        buttons.addWidget(self.forward_button)
        buttons.addWidget(submitButton)
        buttons.addWidget(QLabel("Host:"))
        buttons.addWidget(self.dest_host_input)
        buttons.addWidget(QLabel("Port:"))
        buttons.addWidget(self.dest_port_input)
        buttons.addWidget(QLabel("Use TLS:"))
        buttons.addWidget(self.dest_usetls_input)
        buttons.addStretch()

        self.reqview = ReqViewWidget(tag_tab=True)
        self.reqview.set_read_only(False)
        self.reqview.set_tags_read_only(False)
        self.layout().addLayout(buttons)
        self.layout().addWidget(self.reqview)

        self.req = None
        self.dest_host = ""
        self.dest_port = 80
        self.use_tls = False
        self._update_buttons() 
Example #9
Source File: titlebar.py    From equant with GNU General Public License v2.0 4 votes vote down vote up
def _initViews(self):
        self.setFixedHeight(TITLE_BAR_HEIGHT)

        palette = self.palette()
        palette.setColor(palette.Window, QColor(240, 240, 240))
        self.setPalette(palette)
        # 布局
        layout = QHBoxLayout(self, spacing=0)
        layout.setContentsMargins(0, 0, 0, 0)
        # 窗口图标
        self.iconLabel = QLabel(self, objectName='iconLabel')
        # 窗口标题
        self.titleLabel = QLabel(self, objectName='titleLabel')
        self.titleLabel.setMargin(5)

        # 利用webdings字体来显示图标
        font = self.font() or QFont()
        font.setFamily('Webdings')
        # 最小化按钮
        self.buttonMinimum = QPushButton('0', self, font=font, objectName='buttonMinimum')
        # 最大化/还原按钮
        self.buttonMaximum = QPushButton('1', self, font=font, objectName='buttonMaximum')
        # 关闭按钮
        self.buttonClose = QPushButton('r', self, font=font, objectName='buttonClose')

        self.theseSelect = QPushButton()
        self.theseSelect.setObjectName("theseSelect")
        self.theseSelect.setIcon(QIcon("icon/whitethese.png"))
        self.theseSelect.clicked.connect(self._theseCallback)

        self.buttonMinimum.setFixedSize(TITLE_BUTTON_SIZE, TITLE_BUTTON_SIZE)
        self.buttonMaximum.setFixedSize(TITLE_BUTTON_SIZE, TITLE_BUTTON_SIZE)
        self.buttonClose.setFixedSize(TITLE_BUTTON_SIZE, TITLE_BUTTON_SIZE)

        self.iconLabel.setFixedSize(TITLE_LABEL_SIZE, TITLE_LABEL_SIZE)
        self.titleLabel.setFixedHeight(TITLE_LABEL_SIZE)
        self.iconLabel.setAlignment(Qt.AlignCenter)
        self.titleLabel.setAlignment(Qt.AlignCenter)

        self.buttonMinimum.clicked.connect(self.win.showMinimized)
        self.buttonMaximum.clicked.connect(self.showMaximized)
        self.buttonClose.clicked.connect(self.closeWindow)

        layout.addWidget(self.iconLabel)
        layout.addWidget(self.titleLabel)
        # 中间伸缩条
        layout.addSpacerItem(QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))

        layout.addWidget(self.theseSelect)
        layout.addWidget(self.buttonMinimum)
        layout.addWidget(self.buttonMaximum)
        layout.addWidget(self.buttonClose)
        layout.setSpacing(2)
        # self.setHeight()