Python PyQt5.QtCore.Qt.AlignCenter() Examples

The following are 30 code examples of PyQt5.QtCore.Qt.AlignCenter(). 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.QtCore.Qt , or try the search function .
Example #1
Source File: audio_pan.py    From linux-show-player with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.panBox = QGroupBox(self)
        self.panBox.setGeometry(0, 0, self.width(), 80)
        self.panBox.setLayout(QHBoxLayout(self.panBox))
        self.layout().addWidget(self.panBox)

        self.panSlider = QSlider(self.panBox)
        self.panSlider.setRange(-10, 10)
        self.panSlider.setPageStep(1)
        self.panSlider.setOrientation(Qt.Horizontal)
        self.panSlider.valueChanged.connect(self.pan_changed)
        self.panBox.layout().addWidget(self.panSlider)

        self.panLabel = QLabel(self.panBox)
        self.panLabel.setAlignment(Qt.AlignCenter)
        self.panBox.layout().addWidget(self.panLabel)

        self.panBox.layout().setStretch(0, 5)
        self.panBox.layout().setStretch(1, 1)

        self.retransaleUi() 
Example #2
Source File: main.py    From PyQt5-Apps with GNU General Public License v3.0 7 votes vote down vote up
def updateTable(self, w):
        """:author : Tich
        update data in the table
        :param w: update data in `w.table`
        """
        try:
            num = cursor.execute("SELECT * FROM words ORDER BY origin;")
            if num:
                w.table.setRowCount(num)
                for r in cursor:
                    # print(r)
                    i = cursor.rownumber - 1
                    for x in range(3):
                        item = QTableWidgetItem(str(r[x]))
                        item.setTextAlignment(Qt.AlignCenter);
                        w.table.setItem(i, x, item)
        except Exception as e:
            # print(e)
            self.messageBox("update table error!\nerror msg: %s"%e.args[1]) 
Example #3
Source File: QLabel_clickable.py    From PyQt5 with MIT License 6 votes vote down vote up
def initUI(self):

      # ==================== WIDGET QLABEL =======================
        
        self.labelImagen = QLabelClickable(self)
        self.labelImagen.setGeometry(15, 15, 118, 130)
        self.labelImagen.setToolTip("Imagen")
        self.labelImagen.setCursor(Qt.PointingHandCursor)

        self.labelImagen.setStyleSheet("QLabel {background-color: white; border: 1px solid "
                                       "#01DFD7; border-radius: 5px;}")

        self.pixmapImagen = QPixmap("Qt.png").scaled(112, 128, Qt.KeepAspectRatio,
                                                     Qt.SmoothTransformation)
        self.labelImagen.setPixmap(self.pixmapImagen)
        self.labelImagen.setAlignment(Qt.AlignCenter)

      # ===================== EVENTO QLABEL ======================

      # Llamar función al hacer clic o doble clic sobre el label
        self.labelImagen.clicked.connect(self.Clic)

  # ======================= FUNCIONES ============================ 
Example #4
Source File: CColorPicker.py    From CustomWidgets with GNU General Public License v3.0 6 votes vote down vote up
def test():
    import sys
    import cgitb
    sys.excepthook = cgitb.enable(1, None, 5, '')
    from PyQt5.QtWidgets import QApplication, QLabel
    app = QApplication(sys.argv)

    def getColor():
        ret, color = CColorPicker.getColor()
        if ret == QDialog.Accepted:
            r, g, b, a = color.red(), color.green(), color.blue(), color.alpha()
            label.setText('color: rgba(%d, %d, %d, %d)' % (r, g, b, a))
            label.setStyleSheet(
                'background: rgba(%d, %d, %d, %d);' % (r, g, b, a))

    window = QWidget()
    window.resize(200, 200)
    layout = QVBoxLayout(window)
    label = QLabel('', window, alignment=Qt.AlignCenter)
    button = QPushButton('点击选择颜色', window, clicked=getColor)
    layout.addWidget(label)
    layout.addWidget(button)
    window.show()

    sys.exit(app.exec_()) 
Example #5
Source File: CPaginationBar.py    From CustomWidgets with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, totalPages, *args, **kwargs):
        super(_CPaginationJumpBar, self).__init__(*args, **kwargs)
        self.setAttribute(Qt.WA_StyledBackground, True)
        layout = QHBoxLayout(self)
        layout.setSpacing(4)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(QLabel('前往', self, alignment=Qt.AlignCenter))
        self.editPage = QSpinBox(self)
        layout.addWidget(self.editPage)
        layout.addWidget(QLabel('页', self, alignment=Qt.AlignCenter))

        self.setTotalPages(totalPages)
        self.editPage.setObjectName('CPaginationBar_editJump')
        self.editPage.setFrame(False)
        self.editPage.setAlignment(Qt.AlignCenter)
        self.editPage.setButtonSymbols(QSpinBox.NoButtons)
        self.editPage.editingFinished.connect(self.onValueChanged)
        # 禁止鼠标滑轮
        self.editPage.wheelEvent = self._wheelEvent 
Example #6
Source File: TestCCountUp.py    From CustomWidgets with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        self.setStyleSheet(Style)
        layout = QVBoxLayout(self)
        layout.addWidget(QLabel('目标值:1234,持续时间:6秒', self))
        self.countLabel = CCountUp(self)
        self.countLabel.setAlignment(Qt.AlignCenter)
        self.countLabel.setMinimumSize(100, 100)
        self.countLabel.setDuration(6000)  # 动画时间 6 秒
        layout.addWidget(self.countLabel)

        cw = QWidget(self)
        layout.addWidget(cw)
        layoutc = QHBoxLayout(cw)
        layoutc.addWidget(QPushButton(
            '开始', cw, clicked=lambda: self.countLabel.setNum(1234)))
        layoutc.addWidget(QPushButton('重置', cw, clicked=self.countLabel.reset))
        layoutc.addWidget(QPushButton('暂停/继续', cw, clicked=self.doContinue))

        layoutc.addWidget(QPushButton(
            '开始负小数-1234.00', cw, clicked=lambda: self.countLabel.setNum(-1234.00))) 
Example #7
Source File: CFontIcon.py    From CustomWidgets with GNU General Public License v3.0 6 votes vote down vote up
def paint(self, painter, rect, mode, state):
        painter.save()
        self.font.setPixelSize(round(0.875 * min(rect.width(), rect.height())))
        painter.setFont(self.font)
        if self.icon:
            if self.icon.animation:
                self.icon.animation.paint(painter, rect)
            ms = self.icon._getMode(mode) * self.icon._getState(state)
            text, color = self.icon.icons.get(ms, (None, None))
            if text == None and color == None:
                return
            painter.setPen(color)
            self.text = text if text else self.text
            painter.drawText(
                rect, int(Qt.AlignCenter | Qt.AlignVCenter), self.text)
        painter.restore() 
Example #8
Source File: botonCircular.py    From PyQt5 with MIT License 6 votes vote down vote up
def paintEvent(self, event):
        ancho, altura = self.width(), self.height()
        icono = self.icono.scaled(ancho, altura, Qt.KeepAspectRatio, Qt.SmoothTransformation)

        pintor = QPainter()
        
        pintor.begin(self)
        pintor.setRenderHint(QPainter.Antialiasing, True)
        pintor.setPen(Qt.NoPen)
        pintor.drawPixmap(0, 0, icono, 0, 0, 0, 0)
        pintor.setPen(Qt.white)
        pintor.drawText(event.rect(), Qt.AlignCenter, self.etiqueta)
        pintor.setPen(Qt.NoPen)
        pintor.setBrush(self.opacidad)
        pintor.drawEllipse(0, 0, ancho, altura)
        pintor.end()

        self.setMask(icono.mask()) 
Example #9
Source File: stackedWidget.py    From PyQt5 with MIT License 6 votes vote down vote up
def initUI(self):

      # ======================= WIDGETS ==========================

        label = QLabel("Esto es una etiqueta (QLabel)")

      # ==================== DISEÑO (LAYOUT) =====================

        disenio = QVBoxLayout()
        disenio.setContentsMargins(0, 0, 0, 0)
        disenio.addWidget(label)
        disenio.setAlignment(label, Qt.AlignCenter)

        self.setLayout(disenio)


# ====================== CLASE ventanaHija ========================= 
Example #10
Source File: mainwinbase.py    From QssStylesheetEditor with GNU General Public License v3.0 6 votes vote down vote up
def createStatusBar(self):
        self.statusbar.showMessage(self.tr("Ready"))
        # self.statusbar.addWidget(QWidget(),1)
        # self.status["date"] = QLabel()
        # self.statusbar.addPermanentWidget(self.status["date"])
        # self.status["date"].setText(QDate.currentDate().toString())
        # self.status["date"].setVisible(False)

        self.status["line"] = QLabel(self.tr("line:0 pos:0"))
        self.status["select"] = QLabel(self.tr("select: none"))
        self.status["coding"] = QLabel(self.tr("coding"))
        self.status["lines"] = QLabel(self.tr("lines:0"))
        self.status["line"].setMinimumWidth(120)
        self.status["select"].setMinimumWidth(150)
        self.status["coding"].setMinimumWidth(80)
        self.status["coding"].setAlignment(Qt.AlignCenter)
        self.status["lines"].setMinimumWidth(60)
        self.status["lines"].setAlignment(Qt.AlignRight)
        self.statusbar.addPermanentWidget(self.status["line"])
        self.statusbar.addPermanentWidget(self.status["select"])
        self.statusbar.addPermanentWidget(self.status["coding"])
        self.statusbar.addPermanentWidget(self.status["lines"]) 
Example #11
Source File: ObjList.py    From KStock with GNU General Public License v3.0 6 votes vote down vote up
def data(self, index, role = Qt.DisplayRole):
        if not index.isValid():
            return None
        obj = self.getObject(index)
        prop = self.getProperty(index)
        if role == Qt.BackgroundRole:
            return color(obj.D)
        if role == Qt.TextAlignmentRole:
            return Qt.AlignCenter
        if (obj is None) or (prop is None):
            return None
        try:
            if role in [Qt.DisplayRole, Qt.EditRole]:
                return getAttrRecursive(obj, prop['attr'])
        except:
            return None
        return None 
Example #12
Source File: file_history_widget.py    From parsec-cloud with GNU Affero General Public License v3.0 6 votes vote down vote up
def __init__(
        self,
        jobs_ctx,
        workspace_fs,
        path,
        reload_timestamped_signal,
        update_version_list,
        close_version_list,
    ):
        super().__init__()
        self.setupUi(self)
        self.jobs_ctx = jobs_ctx
        update_version_list.connect(self.reset_dialog)
        self.get_versions_success.connect(self.on_get_version_success)
        self.get_versions_error.connect(self.on_get_version_error)
        self.button_load_more_entries.clicked.connect(self.load_more)
        self.workspace_fs = workspace_fs
        self.version_lister = workspace_fs.get_version_lister()
        self.spinner = QSvgWidget(":/icons/images/icons/spinner.svg")
        self.spinner.setFixedSize(100, 100)
        self.spinner_layout.addWidget(self.spinner, Qt.AlignCenter)
        self.spinner_layout.setAlignment(Qt.AlignCenter)
        self.set_loading_in_progress(False)
        self.reset_dialog(workspace_fs, self.version_lister, path) 
Example #13
Source File: ebeam_table.py    From ocelot with GNU General Public License v3.0 6 votes vote down vote up
def update_table(self):

        ebp = self.calc_ebparams()

        if ebp is None:
            self.ui.table.setRowCount(1)
            self.ui.table.setSpan(0, 0, 1, 2)

            item = QtWidgets.QTableWidgetItem("No solution")
            item.setTextAlignment(Qt.AlignCenter)
            self.ui.table.setItem(0, 0, item)

            return

        n = len(ebp) 
        self.ui.table.setRowCount(n)
        self.ui.table.clearSpans()
        
        for i in range(n):
            item = QtWidgets.QTableWidgetItem(ebp[i][0])
            self.ui.table.setItem(i, 0, item)

            item = QtWidgets.QTableWidgetItem(str(ebp[i][1]))
            item.setTextAlignment(Qt.AlignCenter)
            self.ui.table.setItem(i, 1, item) 
Example #14
Source File: videosliderwidget.py    From vidcutter with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, slider: VideoSlider):
        super(VideoSliderWidget, self).__init__(parent)
        self.parent = parent
        self.slider = slider
        self.loaderEffect = OpacityEffect()
        self.loaderEffect.setEnabled(False)
        self.setGraphicsEffect(self.loaderEffect)
        self.setContentsMargins(0, 0, 0, 0)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.layout().setStackingMode(QStackedLayout.StackAll)
        self.genlabel = QLabel(self.parent)
        self.genlabel.setContentsMargins(0, 0, 0, 14)
        self.genlabel.setPixmap(QPixmap(':/images/generating-thumbs.png'))
        self.genlabel.setAlignment(Qt.AlignCenter)
        self.genlabel.hide()
        sliderLayout = QGridLayout()
        sliderLayout.setContentsMargins(0, 0, 0, 0)
        sliderLayout.setSpacing(0)
        sliderLayout.addWidget(self.slider, 0, 0)
        sliderLayout.addWidget(self.genlabel, 0, 0)
        sliderWidget = QWidget(self.parent)
        sliderWidget.setLayout(sliderLayout)
        self.addWidget(sliderWidget) 
Example #15
Source File: table.py    From dunya-desktop with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent):
        QDialog.__init__(self, parent=parent)
        self.setMinimumSize(QSize(1200, 600))
        layout = QVBoxLayout(self)

        self.label_collection = QLabel()
        self.label_collection.setAlignment(Qt.AlignCenter)
        layout.addWidget(self.label_collection)

        self.lineedit_filter = QLineEdit(self)
        layout.addWidget(self.lineedit_filter)

        self.coll_table = TableViewCollections(self)
        layout.addWidget(self.coll_table)

        self.model = CollectionTableModel()

        self.proxy_model = SortFilterProxyModel()
        self.proxy_model.setSourceModel(self.model)
        self.proxy_model.setFilterKeyColumn(-1)

        self.coll_table.setModel(self.proxy_model)

        # signals
        self.lineedit_filter.textChanged.connect(self._lineedit_changed) 
Example #16
Source File: table.py    From dunya-desktop with GNU General Public License v3.0 6 votes vote down vote up
def set_status(self, raw, exist=None):
        item = QLabel()
        item.setAlignment(Qt.AlignCenter)

        if exist is 0:
            icon = QPixmap(QUEUE_ICON).scaled(20, 20, Qt.KeepAspectRatio,
                                              Qt.SmoothTransformation)
            item.setPixmap(icon)
            item.setToolTip('Waiting in the download queue...')

        if exist is 1:
            icon = QPixmap(CHECK_ICON).scaled(20, 20, Qt.KeepAspectRatio,
                                              Qt.SmoothTransformation)
            item.setPixmap(icon)
            item.setToolTip('All the features are downloaded...')

        if exist is 2:
            item = QPushButton(self)
            item.setToolTip('Download')
            item.setIcon(QIcon(DOWNLOAD_ICON))
            item.clicked.connect(self.download_clicked)

        self.setCellWidget(raw, 0, item) 
Example #17
Source File: fade_edit.py    From linux-show-player with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, mode=FadeComboBox.Mode.FadeOut, **kwargs):
        super().__init__(*args, **kwargs)
        self.setLayout(QGridLayout())

        self.fadeDurationSpin = QDoubleSpinBox(self)
        self.fadeDurationSpin.setRange(0, 3600)
        self.layout().addWidget(self.fadeDurationSpin, 0, 0)

        self.fadeDurationLabel = QLabel(self)
        self.fadeDurationLabel.setAlignment(Qt.AlignCenter)
        self.layout().addWidget(self.fadeDurationLabel, 0, 1)

        self.fadeTypeCombo = FadeComboBox(self, mode=mode)
        self.layout().addWidget(self.fadeTypeCombo, 1, 0)

        self.fadeTypeLabel = QLabel(self)
        self.fadeTypeLabel.setAlignment(Qt.AlignCenter)
        self.layout().addWidget(self.fadeTypeLabel, 1, 1)

        self.retranslateUi() 
Example #18
Source File: cue_list_item.py    From linux-show-player with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, cue):
        super().__init__()

        self.cue = cue
        self.num_column = 1
        self.name_column = 2

        self._selected = False

        self.cue.changed('name').connect(
            self._update_name, Connection.QtQueued)
        self.cue.changed('index').connect(
            self._update_index, Connection.QtQueued)

        self._update_name(self.cue.name)
        self._update_index(self.cue.index)

        self.setTextAlignment(self.num_column, Qt.AlignCenter) 
Example #19
Source File: MyDialog.py    From WeiboSuperSpider with Apache License 2.0 5 votes vote down vote up
def initUI(self):
        self.setWindowTitle('搜索设置')
        self.setWindowIcon(QIcon('logo.jpg'))
        self.resize(280, 200)

        self.l1 = QLabel(self.info, self)
        self.l1.setGeometry(30, 40, 100, 30)
        self.l1.setAlignment(Qt.AlignCenter)

        self.e1 = QLineEdit(self)
        self.e1.setGeometry(130, 40, 100, 25)

        self.l2 = QLabel('只抓取原创微博', self)
        self.l2.setGeometry(30, 100, 100, 30)
        self.l2.setAlignment(Qt.AlignCenter)

        # 创建复选框1,并默认选中,当状态改变时信号触发事件
        # self.checkBox1 = QCheckBox("&Checkbox1",self)
        self.checkBox1 = QCheckBox(self)
        self.checkBox1.setGeometry(170, 100, 80, 30)
        self.checkBox1.setChecked(True)
        self.checkBox1.stateChanged.connect(self.btnClicked)

        # 确定取消按钮

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setGeometry(120,160,100,30)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel |QDialogButtonBox.Ok)

        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject) 
Example #20
Source File: panel_modules.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def set_symbols(self, symbols):
        """ Fills the SymbolsList with data
        """
        if self.symbols_list is None:
            return

        self.symbols_list.clear()
        for symbol in symbols:
            name = QStandardItem()
            name.setTextAlignment(Qt.AlignLeft)
            if 'name' in symbol:
                name.setText(symbol['name'])

            address = QStandardItem()
            address.setTextAlignment(Qt.AlignCenter)
            str_fmt = '0x{0:X}'
            if not self.uppercase_hex:
                str_fmt = '0x{0:x}'

            if 'address' in symbol:
                address.setText(str_fmt.format(int(symbol['address'], 16)))

            type_ = QStandardItem()
            type_.setTextAlignment(Qt.AlignLeft)
            if 'type' in symbol:
                type_.setText(symbol['type'])

            self.symbols_model.appendRow([name, address, type_])

    # ************************************************************************
    # **************************** Handlers **********************************
    # ************************************************************************ 
Example #21
Source File: dialog_scripts.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(ScriptsTable, self).__init__(parent=parent)

        self._scripts_model = QStandardItemModel(0, 6)
        self._scripts_model.setHeaderData(0, Qt.Horizontal, 'Name')
        self._scripts_model.setHeaderData(1, Qt.Horizontal, 'Author')
        self._scripts_model.setHeaderData(1, Qt.Horizontal, Qt.AlignCenter,
                                          Qt.TextAlignmentRole)
        self._scripts_model.setHeaderData(2, Qt.Horizontal, 'A')
        self._scripts_model.setHeaderData(2, Qt.Horizontal, Qt.AlignCenter,
                                          Qt.TextAlignmentRole)
        self._scripts_model.setHeaderData(3, Qt.Horizontal, 'I')
        self._scripts_model.setHeaderData(3, Qt.Horizontal, Qt.AlignCenter,
                                          Qt.TextAlignmentRole)
        self._scripts_model.setHeaderData(4, Qt.Horizontal, 'W')
        self._scripts_model.setHeaderData(4, Qt.Horizontal, Qt.AlignCenter,
                                          Qt.TextAlignmentRole)
        self._scripts_model.setHeaderData(5, Qt.Horizontal, 'Description')

        self.setModel(self._scripts_model)

        self.header().setSectionResizeMode(0, QHeaderView.ResizeToContents)
        self.header().setSectionResizeMode(1, QHeaderView.ResizeToContents)
        self.header().setSectionResizeMode(2, QHeaderView.ResizeToContents)
        self.header().setSectionResizeMode(3, QHeaderView.ResizeToContents)
        self.header().setSectionResizeMode(4, QHeaderView.ResizeToContents)
        self.doubleClicked.connect(self._item_doubleclicked) 
Example #22
Source File: dialog_scripts.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def _init_list(self):
        for script_name in sorted(self._script_manager.get_scripts().keys()):
            script = self._script_manager.get_script(script_name)
            info = script['info']

            if 'dwarf' in info:
                continue

            _name = QStandardItem()
            _name.setText(script_name)
            _name.setToolTip(info['name'])

            _author = QStandardItem()
            if 'author' in info:
                _author.setTextAlignment(Qt.AlignCenter)
                _author.setText(info['author'])

            _android = QStandardItem()
            if 'android' in info:
                _android.setIcon(self._dot_icon)

            _ios = QStandardItem()
            if 'ios' in info:
                _ios.setIcon(self._dot_icon)

            _windows = QStandardItem()
            if 'windows' in info:
                _windows.setIcon(self._dot_icon)

            _desc = QStandardItem()
            if 'description' in info:
                _desc.setText(info['description'])

            self.table.add_item(
                [_name, _author, _android, _ios, _windows, _desc]) 
Example #23
Source File: process_list.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def _on_add_proc(self, item):
        model = self.process_list.model()
        pid = QStandardItem()
        pid.setText(str(item['pid']))
        pid.setTextAlignment(Qt.AlignCenter)
        name = QStandardItem()
        name.setText(item['name'])
        model.appendRow([pid, name]) 
Example #24
Source File: basic_stack_window.py    From Pythonic with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, even, data, new):

        super().__init__()
        self.setTextAlignment(Qt.AlignCenter)
        self.setText(str(data))

        if even:
            self.setBackground(QBrush(QColor('lightgrey'))) 
Example #25
Source File: panel_modules.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def set_exports(self, exports):
        """ Fills the ExportsList with data
        """
        if self.exports_list is None:
            return

        self.exports_list.clear()
        for export in exports:
            name = QStandardItem()
            name.setTextAlignment(Qt.AlignLeft)
            if 'name' in export:
                name.setText(export['name'])

            address = QStandardItem()
            address.setTextAlignment(Qt.AlignCenter)
            str_fmt = '0x{0:X}'
            if not self.uppercase_hex:
                str_fmt = '0x{0:x}'

            if 'address' in export:
                address.setText(str_fmt.format(int(export['address'], 16)))

            type_ = QStandardItem()
            type_.setTextAlignment(Qt.AlignLeft)
            if 'type' in export:
                type_.setText(export['type'])

            self.exports_model.appendRow([name, address, type_]) 
Example #26
Source File: cuelistdialog.py    From linux-show-player with GNU General Public License v3.0 5 votes vote down vote up
def add_cue(self, cue):
        item = QTreeWidgetItem()
        item.setTextAlignment(0, Qt.AlignCenter)

        for n, prop in enumerate(self._properties):
            try:
                item.setData(n, Qt.DisplayRole, getattr(cue, prop, 'Undefined'))
            except Exception as e:
                elogging.exception('Cannot display {0} property'.format(prop), e,
                                   dialog=False)

        self._cues[cue] = item
        item.setData(0, Qt.UserRole, cue)
        self.list.addTopLevelItem(item) 
Example #27
Source File: CTitleBar.py    From CustomWidgets with GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self):
        """创建UI
        """
        self.setMinimumSize(0, self.Radius)
        self.setMaximumSize(0xFFFFFF, self.Radius)
        layout = QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        # 左侧 添加4个对应的空白占位
        for name in ('widgetMinimum', 'widgetMaximum', 'widgetNormal', 'widgetClose'):
            widget = QWidget(self)
            widget.setMinimumSize(self.Radius, self.Radius)
            widget.setMaximumSize(self.Radius, self.Radius)
            widget.setObjectName('CTitleBar_%s' % name)
            setattr(self, name, widget)
            layout.addWidget(widget)
        layout.addItem(QSpacerItem(
            40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))
        # 标题
        self.labelTitle = QLabel(self, alignment=Qt.AlignCenter)
        self.labelTitle.setObjectName('CTitleBar_labelTitle')
        layout.addWidget(self.labelTitle)
        layout.addItem(QSpacerItem(
            40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))
        # 最小化,最大化,还原,关闭按钮
        for name, text in (('buttonMinimum', '0'), ('buttonMaximum', '1'),
                           ('buttonNormal', '2'), ('buttonClose', 'r')):
            button = QPushButton(text, self, font=QFont('Webdings'))
            button.setMinimumSize(self.Radius, self.Radius)
            button.setMaximumSize(self.Radius, self.Radius)
            button.setObjectName('CTitleBar_%s' % name)
            setattr(self, name, button)
            layout.addWidget(button) 
Example #28
Source File: timecode_settings.py    From linux-show-player with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, cue_class, **kwargs):
        super().__init__(cue_class, **kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.groupBox = QGroupBox(self)
        self.groupBox.setLayout(QGridLayout())
        self.layout().addWidget(self.groupBox)

        # enable / disable timecode
        self.enableCheck = QCheckBox(self.groupBox)
        self.enableCheck.setChecked(False)
        self.groupBox.layout().addWidget(self.enableCheck, 0, 0)

        # Hours can be replaced by cue number h:m:s:frames -> CUE:m:s:frames
        self.useHoursCheck = QCheckBox(self.groupBox)
        self.useHoursCheck.setChecked(True)
        self.groupBox.layout().addWidget(self.useHoursCheck, 1, 0)

        self.trackSpin = QSpinBox(self)
        self.trackSpin.setMinimum(0)
        self.trackSpin.setMaximum(99)
        self.useHoursCheck.stateChanged.connect(self.trackSpin.setEnabled)
        self.groupBox.layout().addWidget(self.trackSpin, 2, 0)

        self.trackLabel = QLabel(self.groupBox)
        self.trackLabel.setAlignment(Qt.AlignCenter)
        self.groupBox.layout().addWidget(self.trackLabel, 2, 1)

        self.layout().addSpacing(50)

        self.warnLabel = QLabel(self)
        self.warnLabel.setAlignment(Qt.AlignCenter)
        self.warnLabel.setStyleSheet('color: #FFA500; font-weight: bold')
        self.layout().addWidget(self.warnLabel)

        self.retranslateUi() 
Example #29
Source File: mostrarImagen.py    From PyQt5 with MIT License 5 votes vote down vote up
def initUI(self):

      # ==================== WIDGET QLABEL =======================
        
        self.labelImagen = QLabelClickable(self)
        self.labelImagen.setGeometry(15, 15, 118, 130)
        self.labelImagen.setToolTip("Imagen")
        self.labelImagen.setCursor(Qt.PointingHandCursor)

        self.labelImagen.setStyleSheet("QLabel {background-color: white; border: 1px solid "
                                       "#01DFD7; border-radius: 5px;}")
        
        self.labelImagen.setAlignment(Qt.AlignCenter)

      # ================= WIDGETS QPUSHBUTTON ====================

        buttonSeleccionar = QPushButton("Seleccionar", self)
        buttonSeleccionar.setToolTip("Seleccionar imagen")
        buttonSeleccionar.setCursor(Qt.PointingHandCursor)
        buttonSeleccionar.setGeometry(143, 15, 120, 25)

        buttonEliminar = QPushButton("Eliminar", self)
        buttonEliminar.setToolTip("Eliminar imagen")
        buttonEliminar.setCursor(Qt.PointingHandCursor)
        buttonEliminar.setGeometry(143, 45, 120, 25)

      # ===================== EVENTO QLABEL ======================

      # Llamar función al hacer clic sobre el label
        self.labelImagen.clicked.connect(self.seleccionarImagen)

      # ================== EVENTOS QPUSHBUTTON ===================

        buttonSeleccionar.clicked.connect(self.seleccionarImagen)
        buttonEliminar.clicked.connect(lambda: self.labelImagen.clear())
     

  # ======================= FUNCIONES ============================ 
Example #30
Source File: plugin.py    From FeelUOwn with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, app, parent=None):
        super().__init__(parent)
        self._app = app

        self._total_count = 0
        self._enabled_count = 0

        self.setAlignment(Qt.AlignCenter)
        # FIXME: 暂时通过设置 5 个空格,来让整个文字显示居中
        self.setText('☯' + ' ' * 5)
        self.setMinimumWidth(40)

        self._app.plugin_mgr.scan_finished.connect(self.on_scan_finishd)