Python PyQt5.QtCore.Qt 模块,AlignVCenter() 实例源码

我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用PyQt5.QtCore.Qt.AlignVCenter()

项目:cookiecutter-pyqt5    作者:mandeep    | 项目源码 | 文件源码
def __init__(self, parent=None):
        """Display a dialog that shows application information."""
        super(AboutDialog, self).__init__(parent)

        self.setWindowTitle('About')
        help_icon = pkg_resources.resource_filename('{{ cookiecutter.package_name }}.images',
                                                    'ic_help_black_48dp_1x.png')
        self.setWindowIcon(QIcon(help_icon))
        self.resize(300, 200)

        author = QLabel('{{ cookiecutter.full_name }}')
        author.setAlignment(Qt.AlignCenter)

        icons = QLabel('Material design icons created by Google')
        icons.setAlignment(Qt.AlignCenter)

        github = QLabel('GitHub: {{ cookiecutter.github_username }}')
        github.setAlignment(Qt.AlignCenter)

        self.layout = QVBoxLayout()
        self.layout.setAlignment(Qt.AlignVCenter)

        self.layout.addWidget(author)
        self.layout.addWidget(icons)
        self.layout.addWidget(github)

        self.setLayout(self.layout)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, icon: str, parent=None, f=Qt.Dialog | Qt.FramelessWindowHint):
        super(Notification, self).__init__(parent, f)
        self.parent = parent
        self.theme = self.parent.theme
        self.setObjectName('notification')
        self.setContentsMargins(10, 10, 10, 10)
        self.shown.connect(lambda: QTimer.singleShot(self.duration * 1000, self.fadeOut))
        self.setWindowModality(Qt.ApplicationModal)
        self.setMinimumWidth(550)
        self._title, self._message = '', ''
        self.buttons = []
        self.msgLabel = QLabel(self._message, self)
        self.msgLabel.setWordWrap(True)
        logo_label = QLabel('<img src="{}" width="82" />'.format(icon), self)
        logo_label.setFixedSize(82, 82)
        self.left_layout = QVBoxLayout()
        self.left_layout.addWidget(logo_label)
        layout = QHBoxLayout()
        layout.addStretch(1)
        layout.addLayout(self.left_layout)
        layout.addSpacing(10)
        layout.addWidget(self.msgLabel, Qt.AlignVCenter)
        layout.addStretch(1)
        self.setLayout(layout)
项目:ultimate-tic-tac-toe    作者:stoimenoff    | 项目源码 | 文件源码
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
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def data(self, role):
        if role in (Qt.EditRole, Qt.StatusTipRole):
            return self.formula()
        if role == Qt.DisplayRole:
            return self.display()
        t = str(self.display())
        try:
            number = int(t)
        except ValueError:
            number = None
        if role == Qt.TextColorRole:
            if number is None:
                return QColor(Qt.black)
            elif number < 0:
                return QColor(Qt.red)
            return QColor(Qt.blue)

        if role == Qt.TextAlignmentRole:
            if t and (t[0].isdigit() or t[0] == '-'):
                return Qt.AlignRight | Qt.AlignVCenter
        return super(SpreadSheetItem, self).data(role)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self):
        super(MainWindow, self).__init__()

        self.setupUi(self)

        XmlSyntaxHighlighter(self.schemaView.document())
        XmlSyntaxHighlighter(self.instanceEdit.document())

        self.schemaSelection.addItem("Contact Schema")
        self.schemaSelection.addItem("Recipe Schema")
        self.schemaSelection.addItem("Order Schema")

        self.instanceSelection.addItem("Valid Contact Instance")
        self.instanceSelection.addItem("Invalid Contact Instance")

        self.schemaSelection.currentIndexChanged.connect(self.schemaSelected)
        self.instanceSelection.currentIndexChanged.connect(self.instanceSelected)
        self.validateButton.clicked.connect(self.validate)
        self.instanceEdit.textChanged.connect(self.textChanged)

        self.validationStatus.setAlignment(Qt.AlignCenter | Qt.AlignVCenter)

        self.schemaSelected(0)
        self.instanceSelected(0)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def data(self, role):
        if role in (Qt.EditRole, Qt.StatusTipRole):
            return self.formula()
        if role == Qt.DisplayRole:
            return self.display()
        t = str(self.display())
        try:
            number = int(t)
        except ValueError:
            number = None
        if role == Qt.TextColorRole:
            if number is None:
                return QColor(Qt.black)
            elif number < 0:
                return QColor(Qt.red)
            return QColor(Qt.blue)

        if role == Qt.TextAlignmentRole:
            if t and (t[0].isdigit() or t[0] == '-'):
                return Qt.AlignRight | Qt.AlignVCenter
        return super(SpreadSheetItem, self).data(role)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self):
        super(MainWindow, self).__init__()

        self.setupUi(self)

        XmlSyntaxHighlighter(self.schemaView.document())
        XmlSyntaxHighlighter(self.instanceEdit.document())

        self.schemaSelection.addItem("Contact Schema")
        self.schemaSelection.addItem("Recipe Schema")
        self.schemaSelection.addItem("Order Schema")

        self.instanceSelection.addItem("Valid Contact Instance")
        self.instanceSelection.addItem("Invalid Contact Instance")

        self.schemaSelection.currentIndexChanged.connect(self.schemaSelected)
        self.instanceSelection.currentIndexChanged.connect(self.instanceSelected)
        self.validateButton.clicked.connect(self.validate)
        self.instanceEdit.textChanged.connect(self.textChanged)

        self.validationStatus.setAlignment(Qt.AlignCenter | Qt.AlignVCenter)

        self.schemaSelected(0)
        self.instanceSelected(0)
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
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)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def data(self, role):
        if role in (Qt.EditRole, Qt.StatusTipRole):
            return self.formula()
        if role == Qt.DisplayRole:
            return self.display()
        t = str(self.display())
        try:
            number = int(t)
        except ValueError:
            number = None
        if role == Qt.TextColorRole:
            if number is None:
                return QColor(Qt.black)
            elif number < 0:
                return QColor(Qt.red)
            return QColor(Qt.blue)

        if role == Qt.TextAlignmentRole:
            if t and (t[0].isdigit() or t[0] == '-'):
                return Qt.AlignRight | Qt.AlignVCenter
        return super(SpreadSheetItem, self).data(role)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self):
        super(MainWindow, self).__init__()

        self.setupUi(self)

        XmlSyntaxHighlighter(self.schemaView.document())
        XmlSyntaxHighlighter(self.instanceEdit.document())

        self.schemaSelection.addItem("Contact Schema")
        self.schemaSelection.addItem("Recipe Schema")
        self.schemaSelection.addItem("Order Schema")

        self.instanceSelection.addItem("Valid Contact Instance")
        self.instanceSelection.addItem("Invalid Contact Instance")

        self.schemaSelection.currentIndexChanged.connect(self.schemaSelected)
        self.instanceSelection.currentIndexChanged.connect(self.instanceSelected)
        self.validateButton.clicked.connect(self.validate)
        self.instanceEdit.textChanged.connect(self.textChanged)

        self.validationStatus.setAlignment(Qt.AlignCenter | Qt.AlignVCenter)

        self.schemaSelected(0)
        self.instanceSelected(0)
项目:gui_tool    作者:UAVCAN    | 项目源码 | 文件源码
def set_row(self, row, model):
        for col, spec in enumerate(self.columns):
            value = spec.render(model)
            color = None
            if isinstance(value, tuple):
                value, color = value
            w = QTableWidgetItem(str(value))
            if color is not None:
                w.setBackground(color)
            w.setTextAlignment(Qt.AlignVCenter | Qt.AlignLeft)
            w.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
            self.setItem(row, col, w)

        self.setRowHidden(row, not self.apply_filter_to_row(row))
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def paint(self, painter: QPainter, option: QStyleOptionViewItem, index: QModelIndex) -> None:
        r = option.rect
        pencolor = Qt.white if self.theme == 'dark' else Qt.black
        if self.parent.isEnabled():
            if option.state & QStyle.State_Selected:
                painter.setBrush(QColor(150, 190, 78, 150))
            elif option.state & QStyle.State_MouseOver:
                painter.setBrush(QColor(227, 212, 232))
                pencolor = Qt.black
            else:
                brushcolor = QColor(79, 85, 87, 175) if self.theme == 'dark' else QColor('#EFF0F1')
                painter.setBrush(Qt.transparent if index.row() % 2 == 0 else brushcolor)
        painter.setPen(Qt.NoPen)
        painter.drawRect(r)
        thumb = QIcon(index.data(Qt.DecorationRole + 1))
        starttime = index.data(Qt.DisplayRole + 1)
        endtime = index.data(Qt.UserRole + 1)
        externalPath = index.data(Qt.UserRole + 2)
        r = option.rect.adjusted(5, 0, 0, 0)
        thumb.paint(painter, r, Qt.AlignVCenter | Qt.AlignLeft)
        painter.setPen(QPen(pencolor, 1, Qt.SolidLine))
        r = option.rect.adjusted(110, 8, 0, 0)
        painter.setFont(QFont('Noto Sans UI', 10 if sys.platform == 'darwin' else 8, QFont.Bold))
        painter.drawText(r, Qt.AlignLeft, 'FILENAME' if len(externalPath) else 'START')
        r = option.rect.adjusted(110, 20, 0, 0)
        painter.setFont(QFont('Noto Sans UI', 11 if sys.platform == 'darwin' else 9, QFont.Normal))
        if len(externalPath):
            painter.drawText(r, Qt.AlignLeft, self.clipText(os.path.basename(externalPath), painter))
        else:
            painter.drawText(r, Qt.AlignLeft, starttime)
        if len(endtime) > 0:
            r = option.rect.adjusted(110, 45, 0, 0)
            painter.setFont(QFont('Noto Sans UI', 10 if sys.platform == 'darwin' else 8, QFont.Bold))
            painter.drawText(r, Qt.AlignLeft, 'RUNTIME' if len(externalPath) else 'END')
            r = option.rect.adjusted(110, 60, 0, 0)
            painter.setFont(QFont('Noto Sans UI', 11 if sys.platform == 'darwin' else 9, QFont.Normal))
            painter.drawText(r, Qt.AlignLeft, endtime)
        if self.parent.verticalScrollBar().isVisible():
            self.parent.setFixedWidth(210)
        else:
            self.parent.setFixedWidth(190)
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def paintEvent(self, event):
        painter = QStylePainter(self)
        option = QStyleOptionTab()

        #painter.begin(self)
        for index in range(self.count()):
            self.initStyleOption(option, index)
            tabRect = self.tabRect(index)
            tabRect.moveLeft(10)
            painter.drawControl(QStyle.CE_TabBarTabShape, option)
            painter.drawText(tabRect, Qt.AlignVCenter | Qt.TextDontClip, self.tabText(index))
        #painter.end()
项目:PyTrader    作者:didw    | 项目源码 | 文件源码
def set_automated_stocks(self):
        file_list = ["../data/sell_list.txt", "../data/buy_list.txt"]
        automated_stocks = []

        try:
            for file in file_list:
                # utf-8? ??? ???
                # cp949 ???? ????? encoding ??
                with open(file, 'rt', encoding='utf-8') as f:
                    stocks_list = f.readlines()
                    automated_stocks += stocks_list
        except Exception as e:
            print(e)
            e.msg = "set_automated_stocks() ??"
            self.show_dialog('Critical', e)
            return

        # ??? ?? ??
        cnt = len(automated_stocks)
        self.automatedStocksTable.setRowCount(cnt)

        # ???? ??
        for i in range(cnt):
            stocks = automated_stocks[i].split(';')
            for j in range(len(stocks)):
                if j == 1:
                    name = self.kiwoom.get_master_code_name(stocks[j].rstrip())
                    item = QTableWidgetItem(name)
                else:
                    item = QTableWidgetItem(stocks[j].rstrip())
                item.setTextAlignment(Qt.AlignVCenter | Qt.AlignCenter)
                self.automatedStocksTable.setItem(i, j, item)
        self.automatedStocksTable.resizeRowsToContents()
项目:ultimate-tic-tac-toe    作者:stoimenoff    | 项目源码 | 文件源码
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
项目:ultimate-tic-tac-toe    作者:stoimenoff    | 项目源码 | 文件源码
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)
项目:ultimate-tic-tac-toe    作者:stoimenoff    | 项目源码 | 文件源码
def createLabel(self, text):
        lbl = QLabel(text)
        lbl.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        font = QFont()
        font.setPointSize(12)
        lbl.setFont(font)
        return lbl
项目:ultimate-tic-tac-toe    作者:stoimenoff    | 项目源码 | 文件源码
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
项目:ultimate-tic-tac-toe    作者:stoimenoff    | 项目源码 | 文件源码
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()
项目:ultimate-tic-tac-toe    作者:stoimenoff    | 项目源码 | 文件源码
def createTitleLabel(self, title):
        titleLabel = QLabel(title)
        titleLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        return titleLabel
项目:deen    作者:takeshixx    | 项目源码 | 文件源码
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)
项目:KerbalPie    作者:Vivero    | 项目源码 | 文件源码
def _assemble_plot(self, qpainter):
        qpainter.save()
        #---

        # draw bounding box
        qpainter.setPen(self._bbox_pen)
        qpainter.setBrush(self._bbox_brush)
        qpainter.drawRect(self._bbox_rect)

        # x-axis
        qpainter.setFont(self._labelFont)
        qpainter.setPen(self._axes_tick_pen)
        qpainter.setBrush(self._axes_tick_brush)
        for tick_line in self._xaxis_ticks:
            qpainter.drawLine(tick_line)

        for i in range(len(self._xaxis_ticks_text)):
            qpainter.drawText(self._xaxis_ticks_text_rect[i], Qt.AlignVCenter | Qt.AlignHCenter, self._xaxis_ticks_text[i])

        # y-axis
        for tick_line in self._yaxis_ticks:
            qpainter.drawLine(tick_line)

        for i in range(len(self._yaxis_ticks_text)):
            qpainter.drawText(self._yaxis_ticks_text_rect[i], Qt.AlignVCenter | Qt.AlignHCenter, self._yaxis_ticks_text[i])

        # x-axis origin
        qpainter.setPen(self._axes_origin_pen)
        qpainter.setBrush(self._axes_origin_brush)
        if self._xaxis_origin_x > self._bbox_x0 and self._xaxis_origin_x < self._bbox_x1:
            qpainter.drawLine(self._xaxis_origin_line)

        # y-axis origin
        if self._yaxis_origin_y > self._bbox_y0 and self._yaxis_origin_y < self._bbox_y1:
            qpainter.drawLine(self._yaxis_origin_line)

        # draw plots
        for plot_key in self._plot_points.keys():
            qpainter.setPen(self._plot_pens[plot_key])
            qpainter.setBrush(QBrush(Qt.NoBrush))

            if self._plot_draw_method[plot_key] == 'line' and len(self._plot_points[plot_key]) > 1:
                qpainter.drawPolyline(QPolygonF(self._plot_points[plot_key]))

            else:
                for plot_point in self._plot_points[plot_key]:
                    qpainter.drawPoint(plot_point)


        #---
        qpainter.restore()



    # G E T T E R S   /   S E T T E R S 
    #===========================================================================
项目:lilii    作者:LimeLinux    | 项目源码 | 文件源码
def paintEvent(self, event):
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)

        width = self.width() - 8
        height = 36

        previous = 0
        percent_up = 0
        for partition in self.partitions:
            color = self.color_list[self.partitions.index(partition)]
            percent = self.__percentage(width, partition.getSize(), self.max_capacity)

            if percent < 10:
                percent += 4
                percent_up += 1

            if percent_up >= 0 and percent >= width/35:
                percent -= 4 * percent_up
                percent_up = 0
            print(percent, width)
            painter.setPen(color)
            painter.setBrush(color)
            painter.drawRect(QRectF(4+previous, 5, percent, 34))
            previous += percent


        #Çerçeve
        painter.setPen(QColor(Qt.black))
        painter.setBrush(Qt.NoBrush)
        painter.drawRoundedRect(QRectF(4, 4, width, height), 4, 4)
        #Parlakl?k
        painter.drawPixmap(QRect(6, 6, width-4, height-4), QPixmap(":/images/partitionwidget/light.svg"))

        #kareler
        line = 0
        column = 0
        for partition in self.partitions:
            painter.setPen(Qt.black)
            painter.setBrush(self.color_list[self.partitions.index(partition)])

            if width - (line * 150) <= 150:
                column += 1
                line = 0

            painter.drawRoundedRect(QRectF(4 + (line * 150), (column*32)+64, 12, 12), 2, 2)
            painter.drawText(QRectF(24 + (line * 150), (column*32)+64, 30, 12),
                             Qt.AlignVCenter | Qt.TextDontClip, partition.path)
            painter.setPen(Qt.darkGray)

            if partition.fileSystem:
                painter.drawText(QRectF(24 + (line * 150), (column*32)+78, 40, 12),
                                 Qt.AlignVCenter | Qt.TextDontClip, "{}  {}".format(mbToGB(partition.getSize()),
                                                                                    partition.fileSystem.type))

            else:
                painter.drawText(QRectF(24 + (line * 150), (column*32)+78, 40, 12),
                                 Qt.AlignVCenter | Qt.TextDontClip,
                                 self.tr("{}  Bilinmiyor").format(mbToGB(partition.getSize())))

            line += 1
项目:ovirt-desktop-client    作者:nkovacne    | 项目源码 | 文件源码
def initUI(self):
        """
            Description: Simply shows the dialog
            Arguments: None
            Returns: Nothing
        """

        global conf

        self.resize(450, 150)

        # About image
        filename = 'imgs/about.png'
        image = QImage(filename)
        imageLabel = QLabel()
        imageLabel.setPixmap(QPixmap.fromImage(image))
        imageLabel.setAlignment(Qt.AlignCenter)

        # Labels for info
        lab_appname = QLabel("<font color='#0000FF'>" + _('apptitle') + ' ' + VERSION + "</font>")
        lab_appname.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        lab_desc = QLabel(_('appdesc'))
        lab_desc.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        lab_desc.setWordWrap(True)
        lab_author = QLabel(_('written_by') + ' nKn (<a href=\'http://github.com/nkovacne\'>http://github.com/nkovacne</a>)')
        lab_author.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        lab_unoff = QLabel('<b>' + _('unofficial_project') + '</b>')
        lab_unoff.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        lab_unoff.setWordWrap(True)

        # OK button
        okButton = QPushButton(_("ok"))
        okButton.setMaximumWidth(100)
        okButton.setDefault(True)
        okButton.clicked.connect(self.done)

        # Grid layout with all the elements
        grid = QGridLayout()

        grid.addWidget(imageLabel, 1, 0, 4, 1)               # About image

        grid.addWidget(lab_appname, 1, 1, 1, 2)              # Several QLabels
        grid.addWidget(lab_desc, 2, 1, 1, 2)
        grid.addWidget(lab_author, 3, 1, 1, 2)
        grid.addWidget(lab_unoff, 4, 1, 1, 2)

        grid.addWidget(okButton, 6, 1)                       # Button

        self.setLayout(grid) 

        self.setModal(True)
        self.center()
        self.setWindowTitle(_('about'))
        self.show()