python类AlignHCenter()的实例源码

mpvQC.py 文件源码 项目:mpvQC 作者: Frechdachs 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, parent, relativeconfpath):
        super(TextEditOptionDialog, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
        self.setWindowFlags(dialogwindowflags)
        self.setWindowTitle(relativeconfpath)
        self.conf = path.join(configlocation, relativeconfpath)
        with open(self.conf, "r", encoding="utf-8") as configfile:
            config = configfile.read()
        self.resize(640, 480)
        self.layout = QVBoxLayout()
        self.editor = RegularTextEdit()
        self.button = QPushButton(_("OK"))
        self.editor.setPlainText(config)
        self.editor.setWordWrapMode(QTextOption.NoWrap)
        self.layout.addWidget(self.editor)
        self.layout.addWidget(self.button)
        self.layout.setAlignment(self.button, Qt.AlignHCenter)
        self.button.clicked.connect(self.accept)
        self.setLayout(self.layout)
multiplayer.py 文件源码 项目:ultimate-tic-tac-toe 作者: stoimenoff 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def createIpAndPortFields(self):
        ipLabel = QLabel('Opponent IP:')
        ipLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        portLabel = QLabel('Game port:')
        portLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        self.ipField = QLineEdit()
        self.ipField.setInputMask('000.000.000.000; ')
        self.ipField.setFixedWidth(130)
        self.ipField.textChanged.connect(self.ipChange)
        self.portSpinBox = QSpinBox()
        self.portSpinBox.setRange(1024, 8080)
        self.portSpinBox.setFixedWidth(80)
        layout = QGridLayout()
        layout.addWidget(ipLabel, 0, 0)
        layout.addWidget(self.ipField, 0, 1)
        layout.addWidget(portLabel, 1, 0)
        layout.addWidget(self.portSpinBox, 1, 1)
        return layout
configdialog.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def createIcons(self):
        configButton = QListWidgetItem(self.contentsWidget)
        configButton.setIcon(QIcon(':/images/config.png'))
        configButton.setText("Configuration")
        configButton.setTextAlignment(Qt.AlignHCenter)
        configButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        updateButton = QListWidgetItem(self.contentsWidget)
        updateButton.setIcon(QIcon(':/images/update.png'))
        updateButton.setText("Update")
        updateButton.setTextAlignment(Qt.AlignHCenter)
        updateButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        queryButton = QListWidgetItem(self.contentsWidget)
        queryButton.setIcon(QIcon(':/images/query.png'))
        queryButton.setText("Query")
        queryButton.setTextAlignment(Qt.AlignHCenter)
        queryButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        self.contentsWidget.currentItemChanged.connect(self.changePage)
2dpainting.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self):
        super(Window, self).__init__()

        self.setWindowTitle("2D Painting on Native and OpenGL Widgets")

        helper = Helper()
        native = Widget(helper, self)
        openGL = GLWidget(helper, self)
        nativeLabel = QLabel("Native")
        nativeLabel.setAlignment(Qt.AlignHCenter)
        openGLLabel = QLabel("OpenGL")
        openGLLabel.setAlignment(Qt.AlignHCenter)

        layout = QGridLayout()
        layout.addWidget(native, 0, 0)
        layout.addWidget(openGL, 0, 1)
        layout.addWidget(nativeLabel, 1, 0)
        layout.addWidget(openGLLabel, 1, 1)
        self.setLayout(layout)

        timer = QTimer(self)
        timer.timeout.connect(native.animate)
        timer.timeout.connect(openGL.animate)
        timer.start(50)
configdialog.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def createIcons(self):
        configButton = QListWidgetItem(self.contentsWidget)
        configButton.setIcon(QIcon(':/images/config.png'))
        configButton.setText("Configuration")
        configButton.setTextAlignment(Qt.AlignHCenter)
        configButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        updateButton = QListWidgetItem(self.contentsWidget)
        updateButton.setIcon(QIcon(':/images/update.png'))
        updateButton.setText("Update")
        updateButton.setTextAlignment(Qt.AlignHCenter)
        updateButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        queryButton = QListWidgetItem(self.contentsWidget)
        queryButton.setIcon(QIcon(':/images/query.png'))
        queryButton.setText("Query")
        queryButton.setTextAlignment(Qt.AlignHCenter)
        queryButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        self.contentsWidget.currentItemChanged.connect(self.changePage)
2dpainting.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self):
        super(Window, self).__init__()

        self.setWindowTitle("2D Painting on Native and OpenGL Widgets")

        helper = Helper()
        native = Widget(helper, self)
        openGL = GLWidget(helper, self)
        nativeLabel = QLabel("Native")
        nativeLabel.setAlignment(Qt.AlignHCenter)
        openGLLabel = QLabel("OpenGL")
        openGLLabel.setAlignment(Qt.AlignHCenter)

        layout = QGridLayout()
        layout.addWidget(native, 0, 0)
        layout.addWidget(openGL, 0, 1)
        layout.addWidget(nativeLabel, 1, 0)
        layout.addWidget(openGLLabel, 1, 1)
        self.setLayout(layout)

        timer = QTimer(self)
        timer.timeout.connect(native.animate)
        timer.timeout.connect(openGL.animate)
        timer.start(50)
QLayout_01_Basic.py 文件源码 项目:OpenTutorials_PyQt 作者: RavenKyu 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def init_widget(self):
        self.setWindowTitle("Layout Basic")
        self.setFixedWidth(640)
        self.setFixedHeight(480)

        self.lb_1.setText("Label 1")
        self.lb_2.setText("Label 2")
        self.lb_3.setText("Label 3")
        self.lb_4.setText("Label 4")
        self.lb_5.setText("Label 5")

        self.lb_1.setStyleSheet("background-color: yellow")
        self.lb_2.setStyleSheet("background-color: red")
        self.lb_3.setStyleSheet("background-color: blue")
        self.lb_4.setStyleSheet("background-color: pink")
        self.lb_5.setStyleSheet("background-color: grey")

        self.layout_1.addWidget(self.lb_1)
        self.layout_1.addWidget(self.lb_2, alignment=Qt.AlignTop)
        self.layout_1.addWidget(self.lb_3, alignment=Qt.AlignBottom)
        self.layout_1.addWidget(self.lb_4, alignment=Qt.AlignVCenter)
        self.layout_1.addWidget(self.lb_5, alignment=Qt.AlignHCenter)
dialogs.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def initUI(self):
        """
        Initialize the Dialog layout.
        """
        self.setWindowTitle('Installing plugin')
        self.setFixedSize(500, 140)
        self.setStyleSheet("""
        QDialog {
            background: #F2F2F2;
        }
        """)
        self.progress = BusyProgressBar(self)
        self.progress.start()
        self.message = QLabel('initializing setup', self)
        self.message.setAlignment(Qt.AlignHCenter)
        self.message.setWordWrap(True)
        self.message.setOpenExternalLinks(True)
        self.layout = QVBoxLayout()
        self.layout.addWidget(self.progress)
        self.layout.addWidget(self.message)
        self.layout.setAlignment(Qt.AlignCenter)
        self.setLayout(self.layout)
        self.setModal(True)
configdialog.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def createIcons(self):
        configButton = QListWidgetItem(self.contentsWidget)
        configButton.setIcon(QIcon(':/images/config.png'))
        configButton.setText("Configuration")
        configButton.setTextAlignment(Qt.AlignHCenter)
        configButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        updateButton = QListWidgetItem(self.contentsWidget)
        updateButton.setIcon(QIcon(':/images/update.png'))
        updateButton.setText("Update")
        updateButton.setTextAlignment(Qt.AlignHCenter)
        updateButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        queryButton = QListWidgetItem(self.contentsWidget)
        queryButton.setIcon(QIcon(':/images/query.png'))
        queryButton.setText("Query")
        queryButton.setTextAlignment(Qt.AlignHCenter)
        queryButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        self.contentsWidget.currentItemChanged.connect(self.changePage)
2dpainting.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self):
        super(Window, self).__init__()

        self.setWindowTitle("2D Painting on Native and OpenGL Widgets")

        helper = Helper()
        native = Widget(helper, self)
        openGL = GLWidget(helper, self)
        nativeLabel = QLabel("Native")
        nativeLabel.setAlignment(Qt.AlignHCenter)
        openGLLabel = QLabel("OpenGL")
        openGLLabel.setAlignment(Qt.AlignHCenter)

        layout = QGridLayout()
        layout.addWidget(native, 0, 0)
        layout.addWidget(openGL, 0, 1)
        layout.addWidget(nativeLabel, 1, 0)
        layout.addWidget(openGLLabel, 1, 1)
        self.setLayout(layout)

        timer = QTimer(self)
        timer.timeout.connect(native.animate)
        timer.timeout.connect(openGL.animate)
        timer.start(50)
settings.py 文件源码 项目:vidcutter 作者: ozmartian 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def initCategories(self):
        generalButton = QListWidgetItem(self.categories)
        generalButton.setIcon(QIcon(':/images/settings-general.png'))
        generalButton.setText('General')
        generalButton.setToolTip('General settings')
        generalButton.setTextAlignment(Qt.AlignHCenter)
        generalButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        videoButton = QListWidgetItem(self.categories)
        videoButton.setIcon(QIcon(':/images/settings-video.png'))
        videoButton.setText('Video')
        videoButton.setToolTip('Video settings')
        videoButton.setTextAlignment(Qt.AlignHCenter)
        videoButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        themeButton = QListWidgetItem(self.categories)
        themeButton.setIcon(QIcon(':/images/settings-theme.png'))
        themeButton.setText('Theme')
        themeButton.setToolTip('Theme settings')
        themeButton.setTextAlignment(Qt.AlignHCenter)
        themeButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        logsButton = QListWidgetItem(self.categories)
        logsButton.setIcon(QIcon(':/images/settings-logs.png'))
        logsButton.setText('Logs')
        logsButton.setToolTip('Logging settings')
        logsButton.setTextAlignment(Qt.AlignHCenter)
        logsButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        self.categories.currentItemChanged.connect(self.changePage)
        self.categories.setCurrentRow(0)
        self.categories.setMaximumWidth(self.categories.sizeHintForColumn(0) + 2)
        self.setMinimumWidth(650 if sys.platform == 'darwin' else 620)
        if sys.platform != 'win32':
            self.adjustSize()
widgets.py 文件源码 项目:vidcutter 作者: ozmartian 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def showTimer(self) -> None:
        self._timerwidget.show()
        # noinspection PyArgumentList
        self.layout().addWidget(self._timerwidget, 1, 0, Qt.AlignHCenter | Qt.AlignTop)
        self._time.start()
        self.updateTimer()
        self._timer.start(1000)
botbattle.py 文件源码 项目:ultimate-tic-tac-toe 作者: stoimenoff 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def createTitle(self):
        title = QLabel(self.bot1.name + ' vs ' + self.bot2.name)
        font = QFont()
        font.setBold(True)
        font.setPointSize(12)
        title.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        title.setFont(font)
        return title
singleplayergame.py 文件源码 项目:ultimate-tic-tac-toe 作者: stoimenoff 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, difficulty=1, numberOfGames=1):
        super(SinglePlayerGame, self).__init__()
        self.difficulty = difficulty
        self.numberOfGames = numberOfGames
        self.gamesPlayed = 0
        self.playerScore = 0
        self.opponentScore = 0
        self.playerIsNotFirst = False

        self.gamesCounter = QLabel()
        self.gamesCounter.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        self.updateGameCounter()

        mainLayout = QVBoxLayout()

        self.gameWidget = BotGame(self.getOpponent())
        self.gameWidget.gameEnded.connect(self.updateScoreAndReset)
        self.saveButton = QPushButton('Save series')
        self.saveButton.clicked.connect(self.saveGame)
        self.message = self.createLabel('')
        self.message.hide()
        mainLayout.addLayout(self.createScoreLayout())
        mainLayout.addWidget(self.gameWidget)
        mainLayout.addWidget(self.message)
        pack = self.packInHStretch([self.gamesCounter, self.saveButton])
        mainLayout.addLayout(pack)
        self.setLayout(mainLayout)
singleplayergame.py 文件源码 项目:ultimate-tic-tac-toe 作者: stoimenoff 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def createLabel(self, text):
        lbl = QLabel(text)
        lbl.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        font = QFont()
        font.setPointSize(12)
        lbl.setFont(font)
        return lbl
maingame.py 文件源码 项目:ultimate-tic-tac-toe 作者: stoimenoff 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def createTitleLabel(self, title):
        titleLabel = QLabel(title)
        font = QFont()
        font.setBold(True)
        font.setPointSize(18)
        titleLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        titleLabel.setFont(font)
        return titleLabel
multiplayerserver.py 文件源码 项目:ultimate-tic-tac-toe 作者: stoimenoff 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, name, port, parent=None):
        super(ServerGame, self).__init__(parent)

        self.qBoard = QMacroBoard(self.onButtonClick)
        self.statusBar = QLabel()
        self.statusBar.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        self.statusBar.hide()
        self.titleBar = QLabel()
        self.titleBar.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        self.titleBar.hide()
        layout = QVBoxLayout()
        layout.addWidget(self.titleBar)
        layout.addWidget(self.qBoard)
        layout.addWidget(self.statusBar)
        self.setLayout(layout)

        self.server = game.players.human.ServerPlayer(name, port)
        self.opponentConnected = False
        self.board = None
        self.last_click = None
        self.qBoard.updateBoard(game.boards.Macroboard())
        self.qBoard.setClickEnabled(False)

        self.requestThread = QThread()

        self.requestWorker = RequestHandler(self)
        self.requestWorker.waitingRequest.connect(self.waitingOpponentMessage)
        self.requestWorker.requestAccepted.connect(self.moveRequest)
        self.requestWorker.error.connect(self.serverError)
        self.requestWorker.moveToThread(self.requestThread)
        self.requestThread.started.connect(self.requestWorker.run)
        self.requestWorker.terminated.connect(self.requestThread.quit)

        self.requestThread.start()
multiplayer.py 文件源码 项目:ultimate-tic-tac-toe 作者: stoimenoff 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def createTitleLabel(self, title):
        titleLabel = QLabel(title)
        titleLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        return titleLabel
hex.py 文件源码 项目:deen 作者: takeshixx 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _process_row(self, y, row):
        cols = self.columnCount()
        for x, i in enumerate(range(0, len(row), self._width)):
            block = row[i:i+self._width]
            item = QTableWidgetItem(codecs.encode(block, 'hex').decode())
            item.setBackground(QBrush(QColor('lightgray')))
            item.setForeground(QBrush(QColor('black')))
            item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
            item.setData(Qt.UserRole, block)  # store original data
            if self._read_only:
                item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
            else:
                item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
            self.setItem(y, x, item)

        # process remaining, unfilled cells
        for j in range(x+1, cols):
            item = QTableWidgetItem()
            item.setBackground(QBrush(QColor('white')))
            item.setFlags(Qt.NoItemFlags)
            item.setTextAlignment(Qt.AlignHCenter)
            self.setItem(y, j, item)

        text = self._bytes_to_ascii(row)
        item = QTableWidgetItem(text)
        item.setData(Qt.UserRole, row)  # store original data
        item.setTextAlignment(Qt.AlignLeft| Qt.AlignVCenter)
        item.setBackground(QBrush(QColor('lightblue')))
        item.setForeground(QBrush(QColor('black')))
        if self._read_only:
            item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        else:
            item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
        self.setItem(y, cols - 1, item)
textedit.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def textAlign(self, action):
        if action == self.actionAlignLeft:
            self.textEdit.setAlignment(Qt.AlignLeft | Qt.AlignAbsolute)
        elif action == self.actionAlignCenter:
            self.textEdit.setAlignment(Qt.AlignHCenter)
        elif action == self.actionAlignRight:
            self.textEdit.setAlignment(Qt.AlignRight | Qt.AlignAbsolute)
        elif action == self.actionAlignJustify:
            self.textEdit.setAlignment(Qt.AlignJustify)
textedit.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def alignmentChanged(self, alignment):
        if alignment & Qt.AlignLeft:
            self.actionAlignLeft.setChecked(True)
        elif alignment & Qt.AlignHCenter:
            self.actionAlignCenter.setChecked(True)
        elif alignment & Qt.AlignRight:
            self.actionAlignRight.setChecked(True)
        elif alignment & Qt.AlignJustify:
            self.actionAlignJustify.setChecked(True)
tetrix.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def createLabel(self, text):
        lbl = QLabel(text)
        lbl.setAlignment(Qt.AlignHCenter | Qt.AlignBottom)
        return lbl
textedit.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def textAlign(self, action):
        if action == self.actionAlignLeft:
            self.textEdit.setAlignment(Qt.AlignLeft | Qt.AlignAbsolute)
        elif action == self.actionAlignCenter:
            self.textEdit.setAlignment(Qt.AlignHCenter)
        elif action == self.actionAlignRight:
            self.textEdit.setAlignment(Qt.AlignRight | Qt.AlignAbsolute)
        elif action == self.actionAlignJustify:
            self.textEdit.setAlignment(Qt.AlignJustify)
textedit.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def alignmentChanged(self, alignment):
        if alignment & Qt.AlignLeft:
            self.actionAlignLeft.setChecked(True)
        elif alignment & Qt.AlignHCenter:
            self.actionAlignCenter.setChecked(True)
        elif alignment & Qt.AlignRight:
            self.actionAlignRight.setChecked(True)
        elif alignment & Qt.AlignJustify:
            self.actionAlignJustify.setChecked(True)
tetrix.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def createLabel(self, text):
        lbl = QLabel(text)
        lbl.setAlignment(Qt.AlignHCenter | Qt.AlignBottom)
        return lbl
adminSelectCourse.py 文件源码 项目:DCheat 作者: DCheat 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def makeCourseLayout(self):
        try:
            if self.pListLayout.count() is not 0:
                while self.pListLayout.count():
                    item = self.pListLayout.takeAt(0)
                    wid = item.widget()
                    wid.deleteLater()
        except Exception as e:
            print(e)

        listPos = 0

        for course in self.courseList:
            if len(course) is 0:
                break

            courseInfo = course.split(',')

            courseLabel = QtWidgets.QLabel(courseInfo[0])
            startLabel = QtWidgets.QLabel(courseInfo[1])
            endLabel = QtWidgets.QLabel(courseInfo[2])
            countLabel = QtWidgets.QLabel(courseInfo[5])

            courseLabel.setAlignment(Qt.AlignHCenter)
            startLabel.setAlignment(Qt.AlignHCenter)
            endLabel.setAlignment(Qt.AlignHCenter)
            countLabel.setAlignment(Qt.AlignHCenter)

            button = QtWidgets.QPushButton("??")
            button.clicked.connect(self.modify_test)

            self.pListLayout.addWidget(courseLabel, listPos, 0)
            self.pListLayout.addWidget(startLabel, listPos, 1)
            self.pListLayout.addWidget(endLabel, listPos, 2)
            self.pListLayout.addWidget(countLabel, listPos, 3)
            self.pListLayout.addWidget(button, listPos, 4)
            listPos += 1

        self.ui.show()
TableModel.py 文件源码 项目:urh 作者: jopohl 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def data(self, index: QModelIndex, role=Qt.DisplayRole):
        if not index.isValid():
            return None

        i = index.row()
        j = index.column()
        if role == Qt.DisplayRole and self.display_data:
            try:
                if self.proto_view == 0:
                    return self.display_data[i][j]
                elif self.proto_view == 1:
                    return "{0:x}".format(self.display_data[i][j])
                elif self.proto_view == 2:
                    return chr(self.display_data[i][j])
            except IndexError:
                return None

        elif role == Qt.TextAlignmentRole:
            if i in self.first_messages:
                return Qt.AlignHCenter + Qt.AlignBottom
            else:
                return Qt.AlignCenter

        elif role == Qt.BackgroundColorRole:
            return self.background_colors[i, j]

        elif role == Qt.FontRole:
            font = QFont()
            font.setBold(self.bold_fonts[i, j])
            font.setItalic(self.italic_fonts[i, j])
            return font

        elif role == Qt.TextColorRole:
            return self.text_colors[i, j]

        elif role == Qt.ToolTipRole:
            return self.get_tooltip(i, j)
        else:
            return None
dialogs.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def initUI(self):
        """
        Initialize the Dialog layout.
        """
        self.setWindowTitle('Checking update')
        self.setFixedSize(400, 120)
        self.setStyleSheet("""
        QDialog {
            background: #F2F2F2;
        }
        """)
        ## INIT PROGRESS BAR
        self.progress = BusyProgressBar(self)
        self.progress.setAlignment(Qt.AlignHCenter)
        self.progress.start()
        ## INITIALIZE UPDATE CHANNEL
        self.channel = B3App.Instance().settings.value('update_channel')
        if self.channel not in (UPDATE_CHANNEL_STABLE, UPDATE_CHANNEL_BETA, UPDATE_CHANNEL_DEV):
            self.channel = getDefaultChannel(b3.__version__)
        ## INITIALIZE DEFAULT MESSAGE
        self.message = QLabel('connecting to update channel: %s' % self.channel, self)
        self.message.setAlignment(Qt.AlignHCenter)
        self.message.setWordWrap(True)
        self.message.setOpenExternalLinks(True)
        self.layout = QVBoxLayout()
        self.layout.addWidget(self.progress)
        self.layout.addWidget(self.message)
        self.layout.setAlignment(Qt.AlignCenter)
        self.setLayout(self.layout)
        self.setModal(True)
textedit.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def textAlign(self, action):
        if action == self.actionAlignLeft:
            self.textEdit.setAlignment(Qt.AlignLeft | Qt.AlignAbsolute)
        elif action == self.actionAlignCenter:
            self.textEdit.setAlignment(Qt.AlignHCenter)
        elif action == self.actionAlignRight:
            self.textEdit.setAlignment(Qt.AlignRight | Qt.AlignAbsolute)
        elif action == self.actionAlignJustify:
            self.textEdit.setAlignment(Qt.AlignJustify)
textedit.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def alignmentChanged(self, alignment):
        if alignment & Qt.AlignLeft:
            self.actionAlignLeft.setChecked(True)
        elif alignment & Qt.AlignHCenter:
            self.actionAlignCenter.setChecked(True)
        elif alignment & Qt.AlignRight:
            self.actionAlignRight.setChecked(True)
        elif alignment & Qt.AlignJustify:
            self.actionAlignJustify.setChecked(True)


问题


面经


文章

微信
公众号

扫码关注公众号