Python PyQt4.QtCore.Qt 模块,AlignCenter() 实例源码

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

项目:ee-book    作者:ee-book    | 项目源码 | 文件源码
def update_library(self):
        self.library = get_library()

        self.library_table.clear()
        self.library_table.setStyleSheet("selection-background-color: blue")  # ???????
        self.library_table.setRowCount(len(self.library['books']))
        self.library_table.setColumnCount(5)    # TODO: ???????
        self.library_table.setHorizontalHeaderLabels(['Title', 'Authors', 'Tags', 'Date', 'Size(MB)'])

        self.library_table.setAlternatingRowColors(True)
        self.library_table.setEditTriggers(QTableWidget.NoEditTriggers)
        self.library_table.setSelectionBehavior(QTableWidget.SelectRows)
        self.library_table.setSelectionMode(QTableWidget.SingleSelection)

        self.model = QtGui.QStandardItemModel(self)
        for i, book in enumerate(self.library['books']):
            for j, cell in enumerate((book['title'], book['author'], book['tags'],
                                      book['date'], book['size'])):
                item = QTableWidgetItem(cell)
                item.setTextAlignment(Qt.AlignCenter)
                self.library_table.setItem(i, j, item)

        self.library_table.resizeColumnsToContents()
项目:Smart-Mirror    作者:aishmittal    | 项目源码 | 文件源码
def initUI(self):

        self.vbox = QVBoxLayout()
        self.heading = QLabel()

        self.size= "480x360"


        #self.source="the-times-of-india"
        self.fbox = QFormLayout()
        self.fbox.setAlignment(Qt.AlignLeft)
        self.fbox.setSpacing(8)

        self.heading.setAlignment(Qt.AlignCenter)
        self.heading.setFont(font2)

        self.vbox.addWidget(self.heading)
        self.vbox.addLayout(self.fbox)

        self.setLayout(self.vbox)
        self.news_fetcher()
        #self.addWidget(News)


    #updating news
项目:Smart-Mirror    作者:aishmittal    | 项目源码 | 文件源码
def initUI(self):

        self.vbox = QVBoxLayout()
        self.heading = QLabel()

        self.size= "480x360"


        #self.source="the-times-of-india"
        self.fbox = QFormLayout()
        self.fbox.setAlignment(Qt.AlignLeft)
        self.fbox.setSpacing(8)

        self.heading.setAlignment(Qt.AlignCenter)
        self.heading.setFont(font2)

        self.vbox.addWidget(self.heading)
        self.vbox.addLayout(self.fbox)

        self.setLayout(self.vbox)
        self.news_fetcher()
        #self.addWidget(News)


    #updating news
项目:AutoFields    作者:gacarrillor    | 项目源码 | 文件源码
def getLabelWithArrow( self, indexLayerCombo, indexFieldCombo, layer, fieldName ):
        label = QLabel()
        if indexLayerCombo != 0 and indexFieldCombo != 0:
            if self.autoFieldManager.isFieldAnAutoField( layer, fieldName ):
                label.setPixmap( QPixmap( ":/plugins/AutoFields/icons/orange_arrow.png" ) )
                label.setToolTip( u'This AutoField will overwrite an existing AutoField in {}/{}'.format(layer.name(),fieldName) )
            else:
                label.setPixmap( QPixmap( ":/plugins/AutoFields/icons/green_arrow.png" ) )
                label.setToolTip( 'AutoField correctly assigned' )
        else:
            label.setPixmap( QPixmap( ":/plugins/AutoFields/icons/gray_arrow.png" ) )
            label.setToolTip( 'This AutoField will not be assigned to any layer/field' )
        label.setAlignment( Qt.AlignCenter )
        return label
项目:pyDashboard    作者:jtsmith2    | 项目源码 | 文件源码
def __init__(self, parent, radar, rect, myname, config):

        self.Config = config

        self.manager = QtNetwork.QNetworkAccessManager()
        self.lastapiget = time.time()

        global xscale, yscale
        self.myname = myname
        self.rect = rect
        self.satellite = self.Config.satellite
        try: 
            if radar["satellite"]:
                self.satellite = 1
        except KeyError:
            pass
        self.baseurl = self.mapurl(radar, rect, False)
        #print "google map base url: "+self.baseurl
        self.wxurl = self.radarurl(radar, rect)
        #print "radar url: "+self.wxurl
        QtGui.QLabel.__init__(self, parent)
        self.interval = self.Config.radar_refresh*60
        self.lastwx = 0

        self.setObjectName("radar")
        self.setGeometry(rect)
        self.setStyleSheet("#radar { background-color: transparent; }")    
        self.setAlignment(Qt.AlignCenter)

        self.wwx = QtGui.QLabel(self)
        self.wwx.setObjectName("wx")
        self.wwx.setStyleSheet("#wx { background-color: transparent; }")
        self.setAlignment(Qt.AlignCenter)
        self.wwx.setGeometry(0, 0, rect.width(), rect.height())

        self.wxmovie = QMovie()
项目:fman    作者:bfaure    | 项目源码 | 文件源码
def alignCenter(self):
        self.text.setAlignment(Qt.AlignCenter)
项目:Smart-Mirror    作者:aishmittal    | 项目源码 | 文件源码
def initUI(self):
        self.style = "style=element:geometry%7Ccolor:0x1d2c4d&style=element:labels.text.fill%7Ccolor:0x8ec3b9&style=element:labels.text.stroke%7Ccolor:0x1a3646&style=feature:administrative.country%7Celement:geometry.stroke%7Ccolor:0x4b6878&style=feature:administrative.land_parcel%7Celement:labels.text.fill%7Ccolor:0x64779e&style=feature:administrative.province%7Celement:geometry.stroke%7Ccolor:0x4b6878&style=feature:landscape.man_made%7Celement:geometry.stroke%7Ccolor:0x334e87&style=feature:landscape.natural%7Celement:geometry%7Ccolor:0x023e58&style=feature:poi%7Celement:geometry%7Ccolor:0x283d6a&style=feature:poi%7Celement:labels.text.fill%7Ccolor:0x6f9ba5&style=feature:poi%7Celement:labels.text.stroke%7Ccolor:0x1d2c4d&style=feature:poi.park%7Celement:geometry.fill%7Ccolor:0x023e58&style=feature:poi.park%7Celement:labels.text.fill%7Ccolor:0x3C7680&style=feature:road%7Celement:geometry%7Ccolor:0x304a7d&style=feature:road%7Celement:labels.text.fill%7Ccolor:0x98a5be&style=feature:road%7Celement:labels.text.stroke%7Ccolor:0x1d2c4d&style=feature:road.highway%7Celement:geometry%7Ccolor:0x2c6675&style=feature:road.highway%7Celement:geometry.stroke%7Ccolor:0x255763&style=feature:road.highway%7Celement:labels.text.fill%7Ccolor:0xb0d5ce&style=feature:road.highway%7Celement:labels.text.stroke%7Ccolor:0x023e58&style=feature:transit%7Celement:labels.text.fill%7Ccolor:0x98a5be&style=feature:transit%7Celement:labels.text.stroke%7Ccolor:0x1d2c4d&style=feature:transit.line%7Celement:geometry.fill%7Ccolor:0x283d6a&style=feature:transit.station%7Celement:geometry%7Ccolor:0x3a4762&style=feature:water%7Celement:geometry%7Ccolor:0x0e1626&style=feature:water%7Celement:labels.text.fill%7Ccolor:0x4e6d70"
        self.size = "480x360"
        #print self.zoom
        #self.zoom = 15
        self.mapLbl=QLabel()
        self.mapLbl.setAlignment(Qt.AlignCenter)
        self.vbox = QVBoxLayout()
        self.vbox.addWidget(self.mapLbl)
        self.setLayout(self.vbox)
        self.show_map()
项目:Smart-Mirror    作者:aishmittal    | 项目源码 | 文件源码
def initUI(self):
        self.msgLbl=QLabel('Welcome Have A nice day!')
        self.msgLbl.setAlignment(Qt.AlignCenter)
        self.msgLbl.setFont(font2)
        self.hbox = QHBoxLayout()
        self.fname = ''
        self.hbox.addWidget(self.msgLbl)
        self.setLayout(self.hbox)
        self.update_check()
项目:Smart-Mirror    作者:aishmittal    | 项目源码 | 文件源码
def initUI(self):
        self.vbox = QVBoxLayout()
        self.lbl1 = QLabel()
        self.lbl1.setWordWrap(True)
        self.lbl2 = QLabel()
        self.lbl1.setAlignment(Qt.AlignCenter)
        self.lbl2.setAlignment(Qt.AlignCenter)
        self.vbox.setAlignment(Qt.AlignCenter)
        self.vbox.addWidget(self.lbl1)
        self.vbox.addWidget(self.lbl2)
        self.setLayout(self.vbox)
        self.quotes_get()
项目:Smart-Mirror    作者:aishmittal    | 项目源码 | 文件源码
def initUI(self):
        self.msgLbl=QLabel('Welcome Have A nice day!')
        self.msgLbl.setAlignment(Qt.AlignCenter)
        self.msgLbl.setFont(font2)
        self.hbox = QHBoxLayout()
        self.fname = ''
        self.hbox.addWidget(self.msgLbl)
        self.setLayout(self.hbox)
        self.update_check()
项目:Smart-Mirror    作者:aishmittal    | 项目源码 | 文件源码
def initUI(self):
        self.vbox = QVBoxLayout()
        self.lbl1 = QLabel()
        self.lbl1.setWordWrap(True)
        self.lbl2 = QLabel()
        self.lbl1.setAlignment(Qt.AlignCenter)
        self.lbl2.setAlignment(Qt.AlignCenter)
        self.vbox.setAlignment(Qt.AlignCenter)
        self.vbox.addWidget(self.lbl1)
        self.vbox.addWidget(self.lbl2)
        self.setLayout(self.vbox)
        self.quotes_get()
项目:AutoFields    作者:gacarrillor    | 项目源码 | 文件源码
def layerOrFieldCombosChanged( self, callerRow=None, idx=None ):
        """ SLOT. Handles both layer or field selection changed SIGNALS updating
            all rows in the table. Namely, this function:
            + updates assignation arrows,
            + enables/disables OK button accordingly, and
            + updates field comboBox if layer was changed.
        """
        assigned = []
        bEnableOkButton = True
        for row in range(self.tblAutoFields.rowCount()):
            indexLayerCombo = self.tblAutoFields.cellWidget( row, 4 ).currentIndex()
            indexFieldCombo = self.tblAutoFields.cellWidget( row, 5 ).currentIndex()
            layerId = self.tblAutoFields.cellWidget( row, 4 ).itemData( indexLayerCombo )
            fieldName = self.tblAutoFields.cellWidget( row, 5 ).itemText( indexFieldCombo )
            layer = QgsMapLayerRegistry.instance().mapLayer( layerId )

            # Update fieldCombo if necessary
            if callerRow is not None and row == callerRow:
                fieldCombo = self.tblAutoFields.cellWidget( row, 5 )
                fieldCombo.blockSignals(True)
                fieldCombo.clear()
                fieldCombo.addItem( '[Select a field]', None )
                if indexLayerCombo != 0:
                    autoFieldFieldName = self.tblAutoFields.item( row, 1 ).text()
                    for field in layer.fields():
                        fieldCombo.addItem( field.name() )
                    fieldIndex = fieldCombo.findText( autoFieldFieldName )
                    fieldCombo.setCurrentIndex( fieldIndex if fieldIndex != -1 else 0 )
                fieldCombo.blockSignals(False)
                # Update fieldCombo status info
                indexFieldCombo = self.tblAutoFields.cellWidget( row, 5 ).currentIndex()
                fieldName = self.tblAutoFields.cellWidget( row, 5 ).itemText( indexFieldCombo )

            # Arrows
            label = QLabel()
            if indexLayerCombo != 0 and indexFieldCombo != 0 and layerId + "_" + fieldName in assigned:
                label.setPixmap( QPixmap( ":/plugins/AutoFields/icons/red_arrow.png" ) )
                label.setToolTip( 'Target layer/field pair already selected. You cannot assign two AutoFields to the same layer/field pair.' )
                label.setAlignment( Qt.AlignCenter )
                bEnableOkButton = False
            else:
                if indexLayerCombo != 0 and indexFieldCombo != 0:
                    assigned.append( layerId + "_" + fieldName )
                label = self.getLabelWithArrow( indexLayerCombo, indexFieldCombo, layer, fieldName )
            self.tblAutoFields.setCellWidget( row, 3, label )

        self.buttonBox.button( QDialogButtonBox.Ok ).setEnabled( bEnableOkButton )