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

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

项目:X-Ray_Calibre_Plugin    作者:szarroug3    | 项目源码 | 文件源码
def _initialize_navigation_buttons(self, v_layout, previous_button, next_button):
        '''Add previous, ok, cancel, and next buttons'''
        buttons_layout = QHBoxLayout(None)
        buttons_layout.setAlignment(Qt.AlignRight)

        if len(self._book_settings) > 1:
            buttons_layout.addWidget(previous_button)

        ok_button = QPushButton('OK')
        ok_button.setFixedWidth(100)
        ok_button.clicked.connect(self.ok_clicked)
        buttons_layout.addWidget(ok_button)

        cancel_button = QPushButton('Cancel')
        cancel_button.setFixedWidth(100)
        cancel_button.clicked.connect(self.cancel_clicked)
        buttons_layout.addWidget(cancel_button)

        if len(self._book_settings) > 1:
            buttons_layout.addWidget(next_button)

        v_layout.addLayout(buttons_layout)
项目:mpvQC    作者:Frechdachs    | 项目源码 | 文件源码
def writeCommentListViewContents(comments, seconds=False):
    commentmodel.clear()
    for comment in comments:
        if not seconds:
            timestamp = QStandardItem(comment[0])
        else:
            timestamp = QStandardItem(secondsToTimestamp(comment[0]))
        timestamp.setEditable(False)
        timestamp.setTextAlignment(Qt.AlignRight|Qt.AlignVCenter)
        commenttype = QStandardItem(comment[1])
        commenttype.setEditable(False)
        commenttype.setTextAlignment(Qt.AlignCenter)
        commentmodel.appendRow([timestamp, commenttype, QStandardItem(comment[2])])
    commentlistview.horizontalHeader().setSectionResizeMode(2, QHeaderView.Stretch)
    resizeCommentListViewToContents()
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(FrameCounter, self).__init__(parent)
        self.parent = parent
        self.currentframe = QSpinBox(self)
        self.currentframe.setObjectName('frameCounter')
        self.currentframe.setStyle(QStyleFactory.create('Fusion'))
        self.currentframe.setFrame(False)
        self.currentframe.setAlignment(Qt.AlignRight)
        self.currentframe.valueChanged.connect(self.frameChangeHandler)
        separator = QLabel('/')
        separator.setObjectName('frameSeparator')
        self.framecount = QLabel('0000')
        self.framecount.setObjectName('frameCount')
        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.currentframe)
        layout.addWidget(separator)
        layout.addWidget(self.framecount)
        self.setLayout(layout)
项目:OpenMineMods    作者:OpenMineMods    | 项目源码 | 文件源码
def init_packs(self):
        clearLayout(self.packTable)
        if self.searchInp.text():
            packs = self.curse.search(self.searchInp.text(), SearchType.Modpack)
        else:
            packs = self.curse.get_modpacks(page=self.page)

        def create_pack_item(pack):
            group = QGroupBox(self)
            hbox = QHBoxLayout()
            group.setLayout(hbox)
            group.setStyleSheet("QGroupBox { border:0; } ")

            addButton = makeIconButton(self, "download", translate("tooltip.install"))
            addButton.clicked.connect(partial(self.add_clicked, pack=pack))

            hbox.addStretch(1)
            hbox.addWidget(QLabel(pack.title))
            hbox.addWidget(addButton)
            return group

        for pack in packs:
            self.packTable.addWidget(create_pack_item(pack), 0, Qt.AlignRight)
项目:OpenMineMods    作者:OpenMineMods    | 项目源码 | 文件源码
def __init__(self, curse: CurseAPI):
        super().__init__()

        self.curse = curse

        self.setWindowTitle(translate("title.settings"))

        self.layout = QVBoxLayout(self)

        mmc_box = QGroupBox(translate("label.mmc.location"))
        mmc_layout = QHBoxLayout()

        mmc_box.setLayout(mmc_layout)

        self.mmcDir = QLineEdit(self.curse.baseDir)
        self.mmcDir.setReadOnly(True)
        self.mmcDir.setMinimumWidth(250)
        mmc_layout.addWidget(self.mmcDir, 0, Qt.AlignLeft)

        self.mmcEb = makeIconButton(self, "edit", translate("tooltip.mmc.change"))
        self.mmcEb.clicked.connect(partial(self.browse_clicked))
        mmc_layout.addWidget(self.mmcEb, 0, Qt.AlignRight)

        self.layout.addWidget(mmc_box)

        analytics_box = QGroupBox(translate("label.analytics"))
        analytics_layout = QHBoxLayout()

        analytics_box.setLayout(analytics_layout)

        self.analyticsToggle = QCheckBox()
        self.analyticsToggle.setChecked(self.curse.db["analytics"])
        self.analyticsToggle.setToolTip(translate("tooltip.toggle.analytics"))
        self.analyticsToggle.stateChanged.connect(self.analytics_toggle)
        analytics_layout.addWidget(self.analyticsToggle, 1, Qt.AlignCenter)

        self.layout.addWidget(analytics_box)

        self.show()
项目:OpenMineMods    作者:OpenMineMods    | 项目源码 | 文件源码
def init_mods(self):
        clearLayout(self.modTable)
        if self.searchInp.text():
            packs = self.curse.search(self.searchInp.text())
        else:
            packs = self.curse.get_mod_list(self.instance.version, page=self.page)

        def create_mod_item(mod):
            group = QGroupBox(self)
            hbox = QHBoxLayout()
            group.setLayout(hbox)
            group.setStyleSheet("QGroupBox { border:0; } ")

            addButton = makeIconButton(self, "download", translate("tooltip.install"))
            addButton.clicked.connect(partial(self.add_clicked, mod=mod))

            hbox.addStretch(1)
            hbox.addWidget(QLabel(mod.title))
            hbox.addWidget(addButton)
            return group

        for pack in packs:
            self.modTable.addWidget(create_mod_item(pack), 0, Qt.AlignRight)
项目: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)
项目: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)
项目:headcache    作者:s9w    | 项目源码 | 文件源码
def __init__(self, title: str, filename, parent=None):
        super().__init__(parent)

        self.real_parent = parent

        layout = QVBoxLayout()
        self.label_title = QLabel(title)
        self.label_filename = QLabel(filename)
        layout.addWidget(self.label_title)
        layout.addWidget(self.label_filename)
        self.label_title.setObjectName("file_list_title")
        self.label_filename.setObjectName("file_list_filename")
        layout.setAlignment(self.label_filename, Qt.AlignRight)
        layout.setContentsMargins(2, 0, 2, 2)
        layout.setSpacing(0)
        self.setLayout(layout)
项目:FIRST-plugin-ida    作者:vrtadmin    | 项目源码 | 文件源码
def init_top_layout(self):
            history = FIRST.server.history(self.metadata_id)
            if (not history
                or ('results' not in history)
                or (self.metadata_id not in history['results'])
                or ('creator' not in history['results'][self.metadata_id])
                or ('history' not in history['results'][self.metadata_id])):
                self.should_show = False
                return

            self.creator = history['results'][self.metadata_id]['creator']
            self.history = history['results'][self.metadata_id]['history']

            title = QtWidgets.QLabel('Revision History')
            title.setStyleSheet('font: 16pt;')
            creator = QtWidgets.QLabel('by: <b>{}</b>'.format(self.creator))
            creator.setAlignment(Qt.AlignRight | Qt.AlignBottom)

            self.top_layout.addWidget(title)
            self.top_layout.addStretch()
            self.top_layout.addWidget(creator)
项目: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)
项目:Red-GUI    作者:ScarletRav3n    | 项目源码 | 文件源码
def buttons_panel(self):
        self.b1 = QPushButton("Back", self)
        self.b1.setMaximumWidth(75)
        self.hbox.addWidget(self.b1, 0, Qt.AlignRight)
        self.b2 = QPushButton("Next >", self)
        self.b2.setMaximumWidth(75)
        self.hbox.addWidget(self.b2, 0, Qt.AlignRight)
        self.hbox.insertSpacing(20, 20)
        self.b3 = QPushButton("Cancel", self)
        self.b3.setMaximumWidth(75)
        self.hbox.addWidget(self.b3, 0, Qt.AlignRight)
项目:tvlinker    作者:ozmartian    | 项目源码 | 文件源码
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)
项目:kaptan    作者:KaOSx    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        self.setSubTitle(self.tr("<h2>Welcome to KaOS</h2>"))

        vlayout = QVBoxLayout(self)
        vlayout.addItem(QSpacerItem(20, 30, QSizePolicy.Preferred, QSizePolicy.Minimum))

        hlayout = QHBoxLayout(self)
        label = QLabel(self)
        label.setText(self.tr("""<h1>What is KaOS?</h1>
        <p>The idea behind KaOS is to create a tightly integrated rolling and<br />
        transparent distribution for the modern desktop, build from scratch with<br />
        a very specific focus. Focus on one DE (KDE), one toolkit (Qt) & one architecture (x86_64).<br />
        Plus a focus on evaluating and selecting the most suitable tools and applications.</p>
        <p>This wizard will help you personalize your KaOS workspace easily and quickly.</p>
        <p>Please click <code style=color:#3498DB>Next</code> in order to begin. Click <code style=color:#3498DB>Cancel</code> anytime and changes won't be saved.</p>"""))
        label.setWordWrap(True)
        label.setAlignment(Qt.AlignLeft)
        hlayout.addWidget(label)

        kaptan_logo = QLabel(self)
        kaptan_logo.setPixmap(QPixmap(":/data/images/welcome.png"))
        kaptan_logo.setAlignment(Qt.AlignRight)
        kaptan_logo.setMaximumSize(157, 181)
        hlayout.addWidget(kaptan_logo)
        vlayout.addLayout(hlayout)

        vlayout.addItem(QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))

        desktop_file = os.path.join(os.environ["HOME"], ".config", "autostart", "kaptan.desktop")
        if os.path.exists(desktop_file):
            self.checkBox = QCheckBox()
            self.checkBox.setText(self.tr("Run on system startup"))
            self.checkBox.setChecked(True)
            self.checkBox.clicked.connect(self.autoRemove)
            vlayout.addWidget(self.checkBox)
项目:defconQt    作者:trufont    | 项目源码 | 文件源码
def lineNumberAreaPaintEvent(self, event):
        painter = QPainter()
        painter.begin(self.lineNumbers)
        rect = event.rect()
        painter.fillRect(rect, self.palette().color(QPalette.Base))
        d = rect.topRight()
        a = rect.bottomRight()
        painter.setPen(QColor(150, 150, 150))
        # Alright. Since we just did setPen() w the default color constructor
        # it set the pen to a cosmetic width (of zero), i.e. drawing one pixel
        # regardless of screen density.
        # The thing is, we want to paint the last pixels at width boundary.
        # So if devicePixelRatio is e.g. 3 (3 device pixels per screen pixel),
        # then we need to translate by 3-1 pixels, but since 3 device pixels
        # is just one pixel is painter units, we'd have to divide by device
        # pixels after, so we would translate by 2/3 "software" pixels.
        pixelRatio = self.lineNumbers.devicePixelRatio()
        delta = (pixelRatio - 1) / pixelRatio
        drawing.drawLine(painter, d.x() + delta, d.y(), a.x() + delta, a.y())
        painter.setFont(self.font())

        block = self.firstVisibleBlock()
        blockNumber = block.blockNumber()
        top = int(
            self.blockBoundingGeometry(block).translated(
                self.contentOffset()).top())
        bottom = top + int(self.blockBoundingRect(block).height())

        while block.isValid() and top <= event.rect().bottom():
            if block.isVisible() and bottom >= event.rect().top():
                number = str(blockNumber + 1)
                painter.drawText(4, top, self.lineNumbers.width() - 8,
                                 self.fontMetrics().height(), Qt.AlignRight,
                                 number)
            block = block.next()
            top = bottom
            bottom = top + int(self.blockBoundingRect(block).height())
            blockNumber += 1
        painter.end()
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
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)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
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)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def alignmentChanged(self, index):
        if index == 0:
            self.alignmentLineEdit.setAlignment(Qt.AlignLeft)
        elif index == 1:
            self.alignmentLineEdit.setAlignment(Qt.AlignCenter)
        elif index == 2:
            self.alignmentLineEdit.setAlignment(Qt.AlignRight)
项目:ovirt-desktop-client    作者:nkovacne    | 项目源码 | 文件源码
def generate_toolbar(self):
        """
            Description: There will be a toolbar in the main widget with some buttons,
                         this method will render them.
            Arguments: None
            Returns: Nothing
        """

        global IMGDIR, conf

        self.toolBar = QToolBar(self)

        refreshAction = QAction(QIcon(IMGDIR + 'refresh.png'), _('refresh'), self)
        refreshAction.setShortcut('Ctrl+R')
        refreshAction.triggered.connect(self.refresh_grid)
        self.toolBar.addAction(refreshAction)

        self.forgetCredsAction = QAction(QIcon(IMGDIR + 'forget.png'), _('forget_credentials'), self)
        self.forgetCredsAction.setShortcut('Ctrl+F')
        self.forgetCredsAction.triggered.connect(self.forget_creds)
        if not isfile(conf.USERCREDSFILE):
            self.forgetCredsAction.setDisabled(True)
        self.toolBar.addAction(self.forgetCredsAction)

        aboutAction = QAction(QIcon(IMGDIR + 'about.png'), _('about'), self)
        aboutAction.setShortcut('Ctrl+I')
        aboutAction.triggered.connect(self.about)
        self.toolBar.addAction(aboutAction)

        exitAction = QAction(QIcon(IMGDIR + 'exit.png'), _('exit'), self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.triggered.connect(self.quit_button)
        self.toolBar.addAction(exitAction)

        self.grid.addWidget(self.toolBar, 0, 3, Qt.AlignRight)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
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)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
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)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def alignmentChanged(self, index):
        if index == 0:
            self.alignmentLineEdit.setAlignment(Qt.AlignLeft)
        elif index == 1:
            self.alignmentLineEdit.setAlignment(Qt.AlignCenter)
        elif index == 2:
            self.alignmentLineEdit.setAlignment(Qt.AlignRight)
项目:pyzcto    作者:miguelmarco    | 项目源码 | 文件源码
def updateotheraccounts(self):
        self.otheralias = {}
        r = self.tableWidget_otheraddresses.rowCount()
        for i in range(r):
            try:
                ad = self.tableWidget_otheraddresses.item(i,2).text()
            except:
                ad = '..'
            if len(ad)<3:
                ad = '..'
            typ = ''
            validate = 'validateaddress'
            if ad[0]=='z':
                typ = 'Shielded'
                validate = 'z_validateaddress'
            elif ad[1] in '1m':
                typ = 'Transparent'
            elif ad[1] in '23':
                typ = 'Multisig'
            try:
                valid = self.callzcash(validate, [ad])['isvalid']
                if not valid:
                    typ = 'Invalid'
            except:
                typ = ''
            if not  self.tableWidget_otheraddresses.item(i,0) or self.tableWidget_otheraddresses.item(i,0).text() != typ:
                item = QTableWidgetItem(typ)
                item.setTextAlignment(Qt.AlignRight)
                item.setFlags(Qt.ItemFlags(97))
                self.tableWidget_otheraddresses.setItem(i,0,item)
            alias = self.tableWidget_otheraddresses.item(i,1)
            if alias:
                self.otheralias[ad]=alias.text()
        with open('addresses.ext','w') as fd:
            for ad in self.otheralias:
                fd.write(ad+' '+self.otheralias[ad]+'\n')
项目:pyzcto    作者:miguelmarco    | 项目源码 | 文件源码
def readaliasesfromfile(self):
        with open('addresses') as fd:
            lines = fd.readlines()
            for line in lines:
                address = line.split()[0]
                alias = line[len(address)+1:].replace('\n','')
                self.addressesalias[address]=alias
            self.updatelinesendaccount()
        otheralias = {}
        with open('addresses.ext') as fd:
            lines = fd.readlines()
            for line in lines:
                address = line.split()[0]
                alias = line[len(address)+1:].replace('\n','')
                otheralias[address]=alias
        self.tableWidget_otheraddresses.setRowCount(0)
        for ad in otheralias:
            self.tableWidget_otheraddresses.insertRow(0)
            alias = otheralias[ad]
            if alias == ad:
                alias = ''
            item = QTableWidgetItem(alias)
            item.setTextAlignment(Qt.AlignRight)
            self.tableWidget_otheraddresses.setItem(0,1,item)
            item = QTableWidgetItem(ad)
            self.tableWidget_otheraddresses.setItem(0,2,item)
项目:pyzcto    作者:miguelmarco    | 项目源码 | 文件源码
def updatetrs(self):
        self.tableWidget_traddr.setRowCount(0)
        trbalance = Decimal('0.0')
        shbalance = Decimal(self.callzcash('z_gettotalbalance')['private'])
        for us in self.utxos:
            self.tableWidget_traddr.insertRow(0)
            trbalance += us[1]
            item = QTableWidgetItem(self.aliasofaddress(us[0]))
            item.setFlags(Qt.ItemFlags(97))
            item.setBackground(QBrush(QColor(us[-1][0],us[-1][1],us[-1][2])))
            self.tableWidget_traddr.setItem(0, 0, item)
            item = QTableWidgetItem(str(us[1]))
            item.setFlags(Qt.ItemFlags(97))
            item.setTextAlignment(Qt.AlignRight)
            item.setBackground(QBrush(QColor(us[-1][0],us[-1][1],us[-1][2])))
            self.tableWidget_traddr.setItem(0, 1, item)
        self.label_transparent_balance.setText('Transparent balance: {}'.format(trbalance))
        #self.tableWidget_traddr.resizeColumnsToContents()
        self.tableWidget_shaddr.setRowCount(0)
        for tr in self.shreceived:
            self.tableWidget_shaddr.insertRow(0)
            item = QTableWidgetItem(self.aliasofaddress(tr[0]))
            item.setFlags(Qt.ItemFlags(97))
            if len(tr[2])>1:
                item.setToolTip(tr[2])
            item.setBackground(QBrush(QColor(tr[-1][0],tr[-1][1],tr[-1][2])))
            self.tableWidget_shaddr.setItem(0, 0, item)
            item = QTableWidgetItem(str(tr[1]))
            item.setFlags(Qt.ItemFlags(97))
            item.setTextAlignment(Qt.AlignRight)
            if len(tr[2])>1:
                item.setToolTip(tr[2])
            item.setBackground(QBrush(QColor(tr[-1][0],tr[-1][1],tr[-1][2])))
            self.tableWidget_shaddr.setItem(0, 1, item)
        #self.tableWidget_shaddr.resizeColumnsToContents()
        self.label_shielded_balance.setText('Shielded balance: {}'.format(shbalance))
        self.label_total_balance.setText('Total balance: {}'.format(shbalance+trbalance))
项目:pyzcto    作者:miguelmarco    | 项目源码 | 文件源码
def updatealiases(self):
        self.tableWidget_ownaddresses.setRowCount(0)
        for ad in self.balances:
            bal = self.balances[ad]
            self.tableWidget_ownaddresses.insertRow(0)
            item = QTableWidgetItem(bal)
            item.setTextAlignment(Qt.AlignRight)
            item.setFlags(Qt.ItemFlags(97))
            self.tableWidget_ownaddresses.setItem(0,0,item)
            typ = ''
            if ad[0]=='z':
                typ = 'Shielded'
            elif ad[1] in '1m':
                typ = 'Transparent'
                vali =  self.callzcash('validateaddress', [ad])
                if vali['ismine']:
                    pubkey =vali['pubkey']
                    self.pubkeys[ad] = pubkey
            elif ad[1] in '23':
                typ = 'Multisig'
            item = QTableWidgetItem(typ)
            item.setTextAlignment(Qt.AlignRight)
            item.setFlags(Qt.ItemFlags(97))
            self.tableWidget_ownaddresses.setItem(0,1,item)
            alias = self.aliasofaddress(ad)
            if alias == ad:
                alias = ''
            item = QTableWidgetItem(alias)
            #item.setTextAlignment(Qt.AlignRight)
            self.tableWidget_ownaddresses.setItem(0,2,item)
            item = QTableWidgetItem(ad)
            item.setFlags(Qt.ItemFlags(97))
            self.tableWidget_ownaddresses.setItem(0,3,item)
项目:FIRST-plugin-ida    作者:vrtadmin    | 项目源码 | 文件源码
def init_top_layout(self):
            title = QtWidgets.QLabel('Mass Function Upload')
            title.setStyleSheet('font: 16pt;')

            description = QtWidgets.QLabel((
                'Upload function prototype to server for others to access.\n'
                'Select the functions you want to upload. Click to select a '
                'function and click again to deselect the function. Once '
                'uploaded you can manage prototypes you\'ve created in the '
                'management window.'))
            description.setWordWrap(True)
            description.setLineWidth(200)
            description.setStyleSheet('text-size: 90%')

            vbox_text = QtWidgets.QVBoxLayout()
            vbox_text.addWidget(title)
            vbox_text.addWidget(description)

            vbox_legend = QtWidgets.QVBoxLayout()
            grid_legend = QtWidgets.QGridLayout()
            style = 'background-color: #{0:06x}; border: 1px solid #c0c0c0;'
            colors = [  FIRST.color_changed, FIRST.color_unchanged,
                        FIRST.color_default, FIRST.color_selected]
            text = ['Changed', 'Unchanged', 'Default', 'Selected']
            for i in xrange(len(colors)):
                box = QtWidgets.QLabel()
                box.setFixedHeight(10)
                box.setFixedWidth(10)
                box.setStyleSheet(style.format(colors[i].color().rgb() & 0xFFFFFF))
                grid_legend.addWidget(box, i, 0)
                grid_legend.addWidget(QtWidgets.QLabel(text[i]), i, 1)

            vbox_legend.addLayout(grid_legend)
            vbox_legend.setAlignment(Qt.AlignRight | Qt.AlignBottom)

            self.top_layout.addLayout(vbox_text)
            self.top_layout.addStretch()
            self.top_layout.addLayout(vbox_legend)
项目:FIRST-plugin-ida    作者:vrtadmin    | 项目源码 | 文件源码
def init_top_layout(self):
            title = QtWidgets.QLabel('Check All Functions')
            title.setStyleSheet('font: 16pt;')

            description = QtWidgets.QLabel((
                'Query FIRST\'s server for function metadata.\n'
                'If a function within this IDB matches a signature found in '
                'FIRST then it and its metadata will be available for you to '
                'select below to apply to your IDB. Select the function you '
                'wish to apply existing metadata to in order to view the '
                'possible matches.'))
            description.setWordWrap(True)
            description.setStyleSheet('text-size: 90%')

            vbox_text = QtWidgets.QVBoxLayout()
            vbox_text.addWidget(title)
            vbox_text.addWidget(description)

            widget = QtWidgets.QWidget()
            widget.setFixedWidth(100)
            vbox_legend = QtWidgets.QVBoxLayout(widget)
            grid_legend = QtWidgets.QGridLayout()
            style = 'background-color: #{0:06x}; border: 1px solid #c0c0c0;'
            colors = [FIRST.color_applied, FIRST.color_selected]
            text = ['Applied', 'Selected']
            for i in xrange(len(colors)):
                box = QtWidgets.QLabel()
                box.setFixedHeight(10)
                box.setFixedWidth(10)
                box.setStyleSheet(style.format(colors[i].color().rgb() & 0xFFFFFF))
                grid_legend.addWidget(box, i, 0)
                grid_legend.addWidget(QtWidgets.QLabel(text[i]), i, 1)

            vbox_legend.addLayout(grid_legend)
            vbox_legend.setAlignment(Qt.AlignRight | Qt.AlignBottom)
            vbox_legend.setContentsMargins(20, 0, 0, 0)


            self.top_layout.addLayout(vbox_text)
            self.top_layout.addWidget(widget)
项目:FIRST-plugin-ida    作者:vrtadmin    | 项目源码 | 文件源码
def init_top_layout(self):
            title = QtWidgets.QLabel('Check Function')
            title.setStyleSheet('font: 16pt;')

            description = QtWidgets.QLabel((
                'Query FIRST\'s server for function metadata.\n'
                'If a function within this IDB matches a signature found in '
                'FIRST then it and its metadata will be available for you to '
                'select below to apply to your IDB. Click to select a '
                'function\'s metadata and click again to deselect it.'))
            description.setWordWrap(True)
            description.setStyleSheet('text-size: 90%')

            vbox_text = QtWidgets.QVBoxLayout()
            vbox_text.addWidget(title)
            vbox_text.addWidget(description)

            widget = QtWidgets.QWidget()
            widget.setFixedWidth(100)
            vbox_legend = QtWidgets.QVBoxLayout(widget)
            grid_legend = QtWidgets.QGridLayout()
            style = 'background-color: #{0:06x}; border: 1px solid #c0c0c0;'
            colors = [FIRST.color_applied, FIRST.color_selected]
            text = ['Applied', 'Selected']
            for i in xrange(len(colors)):
                box = QtWidgets.QLabel()
                box.setFixedHeight(10)
                box.setFixedWidth(10)
                box.setStyleSheet(style.format(colors[i].color().rgb() & 0xFFFFFF))
                grid_legend.addWidget(box, i, 0)
                grid_legend.addWidget(QtWidgets.QLabel(text[i]), i, 1)

            vbox_legend.addLayout(grid_legend)
            vbox_legend.setAlignment(Qt.AlignRight | Qt.AlignBottom)
            vbox_legend.setContentsMargins(20, 0, 0, 0)


            self.top_layout.addLayout(vbox_text)
            self.top_layout.addWidget(widget)
项目:kaptan    作者:PisiLinuxNew    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        self.setSubTitle(self.tr("<h2>Welcome to Pisi Linux!</h2>"))

        vlayout = QVBoxLayout(self)
        vlayout.addItem(QSpacerItem(20, 150, QSizePolicy.Preferred, QSizePolicy.Minimum))

        hlayout = QHBoxLayout(self)
        label = QLabel(self)
        label.setText(self.tr("""<h1>What is Pisi Linux?</h1>
        <p><strong>Pisi Linux</strong> is a reliable, secure, fast and user friendly operating system.</p>
        <p>With Pisi Linux, you can connect to the internet, read your e-mails, work with your office documents,
         watch movies, play music, develop applications, play games and much more!</p>
        <p><strong>Kaptan</strong>,  will help you personalize your Pisi Linux workspace easily and quickly.
         Please click <strong>Next</strong> in order to begin.</p>"""))
        label.setWordWrap(True)
        label.setAlignment(Qt.AlignLeft)
        hlayout.addWidget(label)

        kaptan_logo = QLabel(self)
        kaptan_logo.setScaledContents(True)
        kaptan_logo.setPixmap(QPixmap(":/data/images/kaptan_welcome.svg"))
        kaptan_logo.setAlignment(Qt.AlignRight)
        kaptan_logo.setFixedSize(196, 196)
        hlayout.addWidget(kaptan_logo)
        vlayout.addLayout(hlayout)

        vlayout.addItem(QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
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)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
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)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def alignmentChanged(self, index):
        if index == 0:
            self.alignmentLineEdit.setAlignment(Qt.AlignLeft)
        elif index == 1:
            self.alignmentLineEdit.setAlignment(Qt.AlignCenter)
        elif index == 2:
            self.alignmentLineEdit.setAlignment(Qt.AlignRight)
项目:SimpleFF    作者:seanyeh    | 项目源码 | 文件源码
def __init__(self, parent):
        super(QWidget, self).__init__(parent)

        self.is_reversed = False

        # Setup GUI
        self.layout = QVBoxLayout(self)
        self.layout.setContentsMargins(10, 0, 10, 10)


        self.hlayout = QWidget()

        status = QHBoxLayout(self.hlayout)
        self.min_ts = QLabel("00:00:00.000")
        self.max_ts = QLabel("00:00:00.000")
        self.max_ts.setAlignment(Qt.AlignRight)

        status.addWidget(self.min_ts)
        status.addWidget(self.max_ts)

        self.hlayout.setLayout(status)

        # Sets up self.hslider
        self.set_hslider(ff.FFTime(2000))
        self.hslider.setEnabled(False)

        def on_change(min_val, max_val):
            if self.is_reversed:
                # Swap min,max if reversed
                min_val, max_val = max_val, min_val

            if min_val > max_val:
                self.is_reversed = not self.is_reversed

            min_ts = ff.FFTime(min_val)
            self.min_ts.setText(str(min_ts))

            max_ts = ff.FFTime(max_val)
            self.max_ts.setText(str(max_ts))

            print("on_change: %s,%s" % (str(min_val), str(max_val)))

        self.hslider.rangeChanged.connect(on_change)

        self.layout.addWidget(self.hlayout)
        self.layout.addWidget(self.hslider)

        self.setLayout(self.layout)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def newLetter(self):
        self.textEdit.clear()

        cursor = self.textEdit.textCursor()
        cursor.movePosition(QTextCursor.Start)
        topFrame = cursor.currentFrame()
        topFrameFormat = topFrame.frameFormat()
        topFrameFormat.setPadding(16)
        topFrame.setFrameFormat(topFrameFormat)

        textFormat = QTextCharFormat()
        boldFormat = QTextCharFormat()
        boldFormat.setFontWeight(QFont.Bold)
        italicFormat = QTextCharFormat()
        italicFormat.setFontItalic(True)

        tableFormat = QTextTableFormat()
        tableFormat.setBorder(1)
        tableFormat.setCellPadding(16)
        tableFormat.setAlignment(Qt.AlignRight)
        cursor.insertTable(1, 1, tableFormat)
        cursor.insertText("The Firm", boldFormat)
        cursor.insertBlock()
        cursor.insertText("321 City Street", textFormat)
        cursor.insertBlock()
        cursor.insertText("Industry Park")
        cursor.insertBlock()
        cursor.insertText("Some Country")
        cursor.setPosition(topFrame.lastPosition())
        cursor.insertText(QDate.currentDate().toString("d MMMM yyyy"),
                textFormat)
        cursor.insertBlock()
        cursor.insertBlock()
        cursor.insertText("Dear ", textFormat)
        cursor.insertText("NAME", italicFormat)   
        cursor.insertText(",", textFormat)
        for i in range(3):
            cursor.insertBlock()
        cursor.insertText("Yours sincerely,", textFormat)
        for i in range(3):
            cursor.insertBlock()
        cursor.insertText("The Boss", textFormat)
        cursor.insertBlock()
        cursor.insertText("ADDRESS", italicFormat)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def newLetter(self):
        self.textEdit.clear()

        cursor = self.textEdit.textCursor()
        cursor.movePosition(QTextCursor.Start)
        topFrame = cursor.currentFrame()
        topFrameFormat = topFrame.frameFormat()
        topFrameFormat.setPadding(16)
        topFrame.setFrameFormat(topFrameFormat)

        textFormat = QTextCharFormat()
        boldFormat = QTextCharFormat()
        boldFormat.setFontWeight(QFont.Bold)
        italicFormat = QTextCharFormat()
        italicFormat.setFontItalic(True)

        tableFormat = QTextTableFormat()
        tableFormat.setBorder(1)
        tableFormat.setCellPadding(16)
        tableFormat.setAlignment(Qt.AlignRight)
        cursor.insertTable(1, 1, tableFormat)
        cursor.insertText("The Firm", boldFormat)
        cursor.insertBlock()
        cursor.insertText("321 City Street", textFormat)
        cursor.insertBlock()
        cursor.insertText("Industry Park")
        cursor.insertBlock()
        cursor.insertText("Some Country")
        cursor.setPosition(topFrame.lastPosition())
        cursor.insertText(QDate.currentDate().toString("d MMMM yyyy"),
                textFormat)
        cursor.insertBlock()
        cursor.insertBlock()
        cursor.insertText("Dear ", textFormat)
        cursor.insertText("NAME", italicFormat)   
        cursor.insertText(",", textFormat)
        for i in range(3):
            cursor.insertBlock()
        cursor.insertText("Yours sincerely,", textFormat)
        for i in range(3):
            cursor.insertBlock()
        cursor.insertText("The Boss", textFormat)
        cursor.insertBlock()
        cursor.insertText("ADDRESS", italicFormat)
项目:BigBrotherBot-For-UrT43    作者:ptitbigorneau    | 项目源码 | 文件源码
def initUI(self):
        """
        Initialize the Central Widget user interface.
        """
        def __get_top_layout(parent):
            image = ImageWidget(parent, B3_BANNER)
            layout = QHBoxLayout()
            layout.addWidget(image)
            layout.setAlignment(Qt.AlignTop)
            layout.setContentsMargins(0, 0, 0, 0)
            return layout

        def __get_middle_layout(parent):
            parent.main_table = MainTable(parent)
            parent.help_label = HelpLabel(parent.main_table)
            layout = QVBoxLayout()
            layout.addWidget(parent.main_table)
            #layout.addWidget(parent.help_label)
            layout.setAlignment(Qt.AlignHCenter | Qt.AlignTop)
            layout.setContentsMargins(0, 2, 0, 0)
            return layout

        def __get_bottom_layout(parent):
            parent.news = MarqueeLabel(parent)
            parent.news.parseFeed()
            btn_new = Button(parent=parent, text='Add', shortcut='Ctrl+N')
            btn_new.clicked.connect(self.parent().new_process_dialog)
            btn_new.setStatusTip('Add a new B3')
            btn_new.setVisible(True)
            btn_quit = Button(parent=parent, text='Quit', shortcut='Ctrl+Q')
            btn_quit.clicked.connect(B3App.Instance().shutdown)
            btn_quit.setStatusTip('Shutdown B3')
            btn_quit.setVisible(True)
            layout = QHBoxLayout()
            layout.addWidget(parent.news)
            layout.addWidget(btn_new)
            layout.addWidget(btn_quit)
            layout.setAlignment(Qt.AlignBottom | Qt.AlignRight)
            layout.setSpacing(10)
            layout.setContentsMargins(0, 0, 11, GEOMETRY[b3.getPlatform()]['CENTRAL_WIDGET_BOTTOM_LAYOUT_MARGIN_BOTTOM'])
            return layout

        main_layout = QVBoxLayout()
        main_layout.addLayout(__get_top_layout(self))
        main_layout.addLayout(__get_middle_layout(self))
        main_layout.addLayout(__get_bottom_layout(self))
        main_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(main_layout)
        self.setFixedSize(614, 512)
        self.setStyleSheet("""
        QWidget, QDialog, QMessageBox {
            background: #F2F2F2;
        }
        """)
        self.setFocus()
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def newLetter(self):
        self.textEdit.clear()

        cursor = self.textEdit.textCursor()
        cursor.movePosition(QTextCursor.Start)
        topFrame = cursor.currentFrame()
        topFrameFormat = topFrame.frameFormat()
        topFrameFormat.setPadding(16)
        topFrame.setFrameFormat(topFrameFormat)

        textFormat = QTextCharFormat()
        boldFormat = QTextCharFormat()
        boldFormat.setFontWeight(QFont.Bold)
        italicFormat = QTextCharFormat()
        italicFormat.setFontItalic(True)

        tableFormat = QTextTableFormat()
        tableFormat.setBorder(1)
        tableFormat.setCellPadding(16)
        tableFormat.setAlignment(Qt.AlignRight)
        cursor.insertTable(1, 1, tableFormat)
        cursor.insertText("The Firm", boldFormat)
        cursor.insertBlock()
        cursor.insertText("321 City Street", textFormat)
        cursor.insertBlock()
        cursor.insertText("Industry Park")
        cursor.insertBlock()
        cursor.insertText("Some Country")
        cursor.setPosition(topFrame.lastPosition())
        cursor.insertText(QDate.currentDate().toString("d MMMM yyyy"),
                textFormat)
        cursor.insertBlock()
        cursor.insertBlock()
        cursor.insertText("Dear ", textFormat)
        cursor.insertText("NAME", italicFormat)   
        cursor.insertText(",", textFormat)
        for i in range(3):
            cursor.insertBlock()
        cursor.insertText("Yours sincerely,", textFormat)
        for i in range(3):
            cursor.insertBlock()
        cursor.insertText("The Boss", textFormat)
        cursor.insertBlock()
        cursor.insertText("ADDRESS", italicFormat)