Python PyQt5.QtCore.Qt.AlignRight() Examples
The following are 30
code examples of PyQt5.QtCore.Qt.AlignRight().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: main.py From Hydra with GNU General Public License v3.0 | 6 votes |
def generateTagFile(self, directoryLocation: str) -> bool: location = shutil.which("ctags") appDir = os.getcwd() if location is None: print("Please download universal ctags from the website https://github.com/universal-ctags/ctags") return False else: os.chdir(directoryLocation) generateProcess = QProcess(self) command = [location, "-R"] generateProcess.start(" ".join(command)) self.tagInfo.setText("Generating tags file...") self.status.addWidget(self.tagInfo, Qt.AlignRight) generateProcess.finished.connect(lambda: self.afterTagGeneration(appDir))
Example #2
Source File: numberBar.py From Hydra with GNU General Public License v3.0 | 6 votes |
def paintEvent(self, event: QPaintEvent): if self.isVisible(): block: QTextBlock = self.editor.firstVisibleBlock() height: int = self.fontMetrics().height() number: int = block.blockNumber() painter = QPainter(self) painter.fillRect(event.rect(), QColor(53, 53, 53)) # painter.drawRect(0, 0, event.rect().width() - 1, event.rect().height() - 1) font = painter.font() font.setPointSize(15) for blocks in self.editor.currentlyVisibleBlocks: bl: QTextBlock = blocks[-1] blockGeometry: QRectF = self.editor.blockBoundingGeometry(bl) offset: QPointF = self.editor.contentOffset() blockTop: float = float(blockGeometry.translated(offset).top() + 2) rect: QRect = QRect(0, blockTop, self.width(), height) painter.drawText(rect, Qt.AlignRight, str(bl.blockNumber() + 1)) painter.end()
Example #3
Source File: view.py From equant with GNU General Public License v2.0 | 6 votes |
def updateValue(self, strategyId, dataDict): """更新策略ID对应的运行数据""" colValues = { 8: "{:.2f}".format(dataDict["Available"]), 9: "{:.2f}".format(dataDict["MaxRetrace"]), 10: "{:.2f}".format(dataDict["NetProfit"]), 11: "{:.2f}".format(dataDict["WinRate"]) } row = self.get_row_from_strategy_id(strategyId) if row != -1: for k, v in colValues.items(): try: item = QTableWidgetItem(str(v)) if isinstance(eval(v), int) or isinstance(eval(v), float): item.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter) elif isinstance(eval(v), str): item.setTextAlignment(Qt.AlignCenter) self.strategy_table.setItem(row, k, item) except Exception as e: self._logger.error(f"[UI][{strategyId}]: 更新策略执行数据时出错,执行列表中该策略已删除!")
Example #4
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 6 votes |
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)
Example #5
Source File: view.py From equant with GNU General Public License v2.0 | 6 votes |
def addExecute(self, dataDict): values = self._formatMonitorInfo(dataDict) if not values: return strategyId = dataDict["StrategyId"] strategy_id_list = self.get_run_strategy_id() try: if strategyId in strategy_id_list: self.updateRunStage(strategyId, dataDict[5]) return except Exception as e: self._logger.warn("addExecute exception") else: row = self.strategy_table.rowCount() self.strategy_table.setRowCount(row + 1) for j in range(len(values)): item = QTableWidgetItem(str(values[j])) if isinstance(values[j], int) or isinstance(values[j], float): item.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter) elif isinstance(values[j], str): item.setTextAlignment(Qt.AlignCenter) self.strategy_table.setItem(row, j, item)
Example #6
Source File: book_config.py From X-Ray_Calibre_Plugin with GNU General Public License v3.0 | 6 votes |
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)
Example #7
Source File: mainwinbase.py From QssStylesheetEditor with GNU General Public License v3.0 | 6 votes |
def createStatusBar(self): self.statusbar.showMessage(self.tr("Ready")) # self.statusbar.addWidget(QWidget(),1) # self.status["date"] = QLabel() # self.statusbar.addPermanentWidget(self.status["date"]) # self.status["date"].setText(QDate.currentDate().toString()) # self.status["date"].setVisible(False) self.status["line"] = QLabel(self.tr("line:0 pos:0")) self.status["select"] = QLabel(self.tr("select: none")) self.status["coding"] = QLabel(self.tr("coding")) self.status["lines"] = QLabel(self.tr("lines:0")) self.status["line"].setMinimumWidth(120) self.status["select"].setMinimumWidth(150) self.status["coding"].setMinimumWidth(80) self.status["coding"].setAlignment(Qt.AlignCenter) self.status["lines"].setMinimumWidth(60) self.status["lines"].setAlignment(Qt.AlignRight) self.statusbar.addPermanentWidget(self.status["line"]) self.statusbar.addPermanentWidget(self.status["select"]) self.statusbar.addPermanentWidget(self.status["coding"]) self.statusbar.addPermanentWidget(self.status["lines"])
Example #8
Source File: roast_properties.py From artisan with GNU General Public License v3.0 | 6 votes |
def addTare(self,_): rows = self.taretable.rowCount() self.taretable.setRowCount(rows + 1) #add widgets to the table name = QLineEdit() name.setAlignment(Qt.AlignRight) name.setText("name") w,_,_ = self.aw.scale.readWeight(self.parent.scale_weight) # read value from scale in 'g' weight = QLineEdit() weight.setAlignment(Qt.AlignRight) if w > -1: weight.setText(str(w)) else: weight.setText(str(0)) weight.setValidator(QIntValidator(0,999,weight)) self.taretable.setCellWidget(rows,0,name) self.taretable.setCellWidget(rows,1,weight)
Example #9
Source File: frameless.py From FeelUOwn with GNU General Public License v3.0 | 6 votes |
def __init__(self,): super().__init__(parent=None) self._widget = None self._timer = QTimer(self) self._old_pos = None self._widget = None self._size_grip = QSizeGrip(self) self._timer.timeout.connect(self.__on_timeout) # setup window layout self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint) self._size_grip.setFixedSize(20, 20) self._layout = QVBoxLayout(self) self._layout.setContentsMargins(0, 0, 0, 0) self._layout.setSpacing(0) self._layout.addWidget(self._size_grip) self._layout.setAlignment(self._size_grip, Qt.AlignBottom | Qt.AlignRight) self.setMouseTracking(True)
Example #10
Source File: CustomXYaxis.py From PyQt with GNU General Public License v3.0 | 6 votes |
def customAxisY(chart): # 自定义y轴(不等分) series = chart.series() if not series: return category = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"] axisy = QCategoryAxis( chart, labelsPosition=QCategoryAxis.AxisLabelsPositionOnValue) axisy.setGridLineVisible(False) # 隐藏网格线条 axisy.setTickCount(len(category)) # 设置刻度个数 miny = chart.axisY().min() maxy = chart.axisY().max() tickc = axisy.tickCount() if tickc < 2: axisy.append(category[0]) else: step = (maxy - miny) / (tickc - 1) # tickc>=2 for i in range(0, tickc): axisy.append(category[i], miny + i * step) chart.addAxis(axisy, Qt.AlignRight) # 添加到右侧 series[-1].attachAxis(axisy) # 附加到series上
Example #11
Source File: ChartView.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __getAlignment(self, alignment): ''' :param alignment: left|top|right|bottom ''' try: return getattr(Qt, "Align" + alignment.capitalize()) except: return Qt.AlignTop # if alignment == "left": # return Qt.AlignLeft # if alignment == "right": # return Qt.AlignRight # if alignment == "bottom": # return Qt.AlignBottom # return Qt.AlignTop
Example #12
Source File: panel_modules.py From Dwarf with GNU General Public License v3.0 | 5 votes |
def add_module(self, module): name = QStandardItem() name.setTextAlignment(Qt.AlignLeft) if 'name' in module: name.setText(module['name']) base = QStandardItem() base.setTextAlignment(Qt.AlignCenter) str_fmt = '0x{0:X}' if not self.uppercase_hex: str_fmt = '0x{0:x}' if 'base' in module: base.setText(str_fmt.format(int(module['base'], 16))) size = QStandardItem() size.setTextAlignment(Qt.AlignRight) if 'size' in module: size.setText("{0:,d}".format(int(module['size']))) path = QStandardItem() path.setTextAlignment(Qt.AlignLeft) if 'path' in module: path.setText(module['path']) self.modules_model.appendRow([name, base, size, path]) module_info = ModuleInfo(module) if 'exports' in module and module['exports']: module_info.apply_exports(module['exports']) if 'imports' in module and module['imports']: module_info.apply_imports(module['imports']) if 'symbols' in module and module['symbols']: module_info.apply_symbols(module['symbols']) module_info._updated_details = True
Example #13
Source File: code_editor.py From Dwarf with GNU General Public License v3.0 | 5 votes |
def draw_line_numbers(self, event): painter = QPainter(self.ui_line_numbers) # background painter.fillRect(event.rect(), Qt.transparent) # linenums current_block = self.firstVisibleBlock() block_num = current_block.blockNumber() top = self.blockBoundingGeometry(current_block).translated( self.contentOffset()).top() bottom = top + self.blockBoundingRect(current_block).height() while current_block.isValid() and (top <= event.rect().bottom()): if current_block.isVisible() and (bottom >= event.rect().top()): s = ("{0}".format(block_num + 1)) painter.setPen(QColor('#636d83')) painter.setFont(self.font()) painter.drawText(0, top, self.calculated_linenum_width() - 5, self.fontMetrics().height(), Qt.AlignRight | Qt.AlignVCenter, s) current_block = current_block.next() top = bottom bottom = top + self.blockBoundingRect(current_block).height() block_num += 1
Example #14
Source File: ChartThemes.py From PyQt with GNU General Public License v3.0 | 5 votes |
def createLegendBox(self): legendComboBox = QComboBox() legendComboBox.addItem("No Legend ", 0) legendComboBox.addItem("Legend Top", Qt.AlignTop) legendComboBox.addItem("Legend Bottom", Qt.AlignBottom) legendComboBox.addItem("Legend Left", Qt.AlignLeft) legendComboBox.addItem("Legend Right", Qt.AlignRight) return legendComboBox
Example #15
Source File: main.py From controleEstoque with MIT License | 5 votes |
def tx_tabelaReceber(self, tabela, row, col, status, valor): item = QtWidgets.QLineEdit() # item.setGeometry(QRect(310, 360, 80, 30)) # item.setFixedWidth(60) if status == 1: item.setReadOnly(True) item.setText(valor) item.setFocusPolicy(Qt.WheelFocus) item.setStyleSheet("QLineEdit{\n" "background: #F1F1F1;\n" "border: 2px solid #CFCFCF;\n" "color: #000;\n" "font: 12px \"Arial\" ;\n" "text-transform: uppercase;\n" "font-weight: bold\n" "}\n" "QLineEdit:Focus {\n" "border: 1px solid red;\n" "}") item.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) item.setObjectName("tx_ValorPago") item.setPlaceholderText("R$ 0.00") tabela.setCellWidget(row, col, item) #Input data tabela parcelas
Example #16
Source File: designer.py From artisan with GNU General Public License v3.0 | 5 votes |
def __init__(self,parent = None, aw = None, values = [0,0]): super(pointDlg,self).__init__(parent, aw) self.values = values self.setWindowTitle(QApplication.translate("Form Caption","Add Point",None)) self.tempEdit = QLineEdit(str(int(round(self.values[1])))) self.tempEdit.setValidator(QIntValidator(0, 999, self.tempEdit)) self.tempEdit.setFocus() self.tempEdit.setAlignment(Qt.AlignRight) templabel = QLabel(QApplication.translate("Label", "temp",None)) regextime = QRegExp(r"^-?[0-9]?[0-9]?[0-9]:[0-5][0-9]$") self.timeEdit = QLineEdit(stringfromseconds(self.values[0],leadingzero=False)) self.timeEdit.setAlignment(Qt.AlignRight) self.timeEdit.setValidator(QRegExpValidator(regextime,self)) timelabel = QLabel(QApplication.translate("Label", "time",None)) # connect the ArtisanDialog standard OK/Cancel buttons self.dialogbuttons.accepted.connect(self.return_values) self.dialogbuttons.rejected.connect(self.reject) buttonLayout = QHBoxLayout() buttonLayout.addStretch() buttonLayout.addWidget(self.dialogbuttons) grid = QGridLayout() grid.addWidget(timelabel,0,0) grid.addWidget(self.timeEdit,0,1) grid.addWidget(templabel,1,0) grid.addWidget(self.tempEdit,1,1) mainLayout = QVBoxLayout() mainLayout.addLayout(grid) mainLayout.addStretch() mainLayout.addLayout(buttonLayout) self.setLayout(mainLayout) self.dialogbuttons.button(QDialogButtonBox.Ok).setFocus()
Example #17
Source File: roast_properties.py From artisan with GNU General Public License v3.0 | 5 votes |
def createTareTable(self): self.taretable.clear() self.taretable.setRowCount(len(self.aw.qmc.container_names)) self.taretable.setColumnCount(2) self.taretable.setHorizontalHeaderLabels([QApplication.translate("Table","Name",None), QApplication.translate("Table","Weight",None)]) self.taretable.setAlternatingRowColors(True) self.taretable.setEditTriggers(QTableWidget.NoEditTriggers) self.taretable.setSelectionBehavior(QTableWidget.SelectRows) self.taretable.setSelectionMode(QTableWidget.SingleSelection) self.taretable.setShowGrid(True) self.taretable.verticalHeader().setSectionResizeMode(2) for i in range(len(self.aw.qmc.container_names)): #add widgets to the table name = QLineEdit() name.setAlignment(Qt.AlignRight) name.setText(self.aw.qmc.container_names[i]) weight = QLineEdit() weight.setAlignment(Qt.AlignRight) weight.setText(str(self.aw.qmc.container_weights[i])) weight.setValidator(QIntValidator(0,999,weight)) self.taretable.setCellWidget(i,0,name) self.taretable.setCellWidget(i,1,weight) header = self.taretable.horizontalHeader() header.setSectionResizeMode(0, QHeaderView.Stretch) header.setSectionResizeMode(1, QHeaderView.Fixed) self.taretable.setColumnWidth(1,65) ######################################################################################## ##################### RECENT ROAST POPUP #############################################
Example #18
Source File: roast_properties.py From artisan with GNU General Public License v3.0 | 5 votes |
def defineBatchEditor(self): self.batchprefixedit = QLineEdit(self.aw.qmc.roastbatchprefix) self.batchcounterSpinBox = QSpinBox() self.batchcounterSpinBox.setRange(0,999999) self.batchcounterSpinBox.setSingleStep(1) self.batchcounterSpinBox.setValue(self.aw.qmc.roastbatchnr) self.batchcounterSpinBox.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter) self.batchposSpinBox = QSpinBox() self.batchposSpinBox.setRange(1,99) self.batchposSpinBox.setSingleStep(1) self.batchposSpinBox.setValue(self.aw.qmc.roastbatchpos) self.batchposSpinBox.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter) self.batchLayout.addWidget(self.batchprefixedit) self.batchLayout.addWidget(self.batchcounterSpinBox) self.batchLayout.addWidget(self.batchposSpinBox)
Example #19
Source File: view.py From equant with GNU General Public License v2.0 | 5 votes |
def updateSyncPosition(self, positions): self.pos_table.setRowCount(len(positions)) for i in range(len(positions)): for j in range(len(positions[i])): item = QTableWidgetItem(str(positions[i][j])) if isinstance(positions[i][j], int) or isinstance(positions[i][j], float): item.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter) elif isinstance(positions[i][j], str): item.setTextAlignment(Qt.AlignCenter) self.pos_table.setItem(i, j, item)
Example #20
Source File: dlg_mnStatus.py From PIVX-SPMT with MIT License | 5 votes |
def setupUi(self, MnStatusDlg): MnStatusDlg.setModal(True) layout = QVBoxLayout(MnStatusDlg) layout.setContentsMargins(10, 15, 10, 10) name = QLabel("<b><i>%s</i></b>" % self.mnAlias) name.setAlignment(Qt.AlignCenter) layout.addWidget(name) body = QFormLayout() body.setLabelAlignment(Qt.AlignRight) body.setVerticalSpacing(20) body.setContentsMargins(25, 10, 25, 30) body.addRow(QLabel("<b>Address</b>"), QLabel(self.statusData['addr'])) body.addRow(QLabel("<b>Tx Hash: idx</b>"), QLabel(self.statusData['txhash']+": "+str(self.statusData['outidx']))) body.addRow(QLabel("<b>Network</b>"), QLabel(self.statusData['network'])) body.addRow(QLabel("<b>Version</b>"), QLabel(str(self.statusData['version']))) body.addRow(QLabel("<b>Rank</b>"), QLabel(str(self.statusData['rank']))) body.addRow(QLabel("<b>Queue Position</b>"), QLabel(str(self.statusData['queue_pos']))) body.addRow(QLabel("<b>Active Time</b>"), QLabel(sec_to_time(self.statusData['activetime']))) body.addRow(QLabel("<b>Last Seen</b>"), QLabel(time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(self.statusData['lastseen'])))) body.addRow(QLabel("<b>Last Paid</b>"), QLabel(time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(self.statusData['lastpaid'])))) layout.addLayout(body) self.okButton = QPushButton('OK') self.okButton.clicked.connect(self.accept) layout.addWidget(self.okButton) sh = layout.sizeHint() self.setFixedSize(sh)
Example #21
Source File: gui.py From lanzou-gui with MIT License | 5 votes |
def update_rec_lists(self, dir_lists, file_lists): """显示回收站文件和文件夹列表""" self.model_rec.removeRows(0, self.model_rec.rowCount()) # 清理旧的内容 file_count = len(file_lists) folder_count = len(dir_lists) if ((not dir_lists) and (not file_lists)) or (file_count == 0 and folder_count == 0): self.show_status("回收站为空!", 4000) return name_header = ["文件夹{}个".format(folder_count), ] if folder_count else [] if file_count: name_header.append("文件{}个".format(file_count)) self.model_rec.setHorizontalHeaderLabels(["/".join(name_header), "大小", "时间"]) folder_ico = QIcon(SRC_DIR + "folder.gif") for item in iter(dir_lists): # 文件夹 name = QStandardItem(folder_ico, item.name) name.setData(item) name.setToolTip("双击查看详情") size_ = QStandardItem(item.size) time_ = QStandardItem(item.time) self.model_rec.appendRow([name, size_, time_]) for item in iter(file_lists): # 文件 name = QStandardItem(set_file_icon(item.name), item.name) name.setData(item) size_ = QStandardItem(item.size) time_ = QStandardItem(item.time) self.model_rec.appendRow([name, size_, time_]) for row in range(self.model_rec.rowCount()): # 右对齐 self.model_rec.item(row, 1).setTextAlignment(Qt.AlignRight | Qt.AlignVCenter) self.model_rec.item(row, 2).setTextAlignment(Qt.AlignRight | Qt.AlignVCenter)
Example #22
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 5 votes |
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)
Example #23
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 5 votes |
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)
Example #24
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 5 votes |
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)
Example #25
Source File: part-2.py From Writer-Tutorial with MIT License | 5 votes |
def alignRight(self): self.text.setAlignment(Qt.AlignRight)
Example #26
Source File: part-3.py From Writer-Tutorial with MIT License | 5 votes |
def alignRight(self): self.text.setAlignment(Qt.AlignRight)
Example #27
Source File: part-4.py From Writer-Tutorial with MIT License | 5 votes |
def alignRight(self): self.text.setAlignment(Qt.AlignRight)
Example #28
Source File: battleView.py From imperialism-remake with GNU General Public License v3.0 | 5 votes |
def setup_hint_label(self): size_policy = constants.default_size_policy(self.hintLabel, QSizePolicy.Preferred, QSizePolicy.Fixed) self.hintLabel.setSizePolicy(size_policy) self.hintLabel.setFont(constants.default_font()) self.hintLabel.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.gridLayout.addWidget(self.hintLabel, 0, 0, 1, 1)
Example #29
Source File: monitor_control.py From stytra with GNU General Public License v3.0 | 5 votes |
def __init__(self, experiment, **kwargs): """ Instantiate the widget that controls the display on the projector :param experiment: Experiment class with calibrator and display window """ super().__init__(**kwargs) self.experiment = experiment self.calibrator = experiment.calibrator self.container_layout = QVBoxLayout() self.container_layout.setContentsMargins(0, 0, 0, 0) self.widget_proj_viewer = ProjectorViewer(display=experiment.window_display) self.container_layout.addWidget(self.widget_proj_viewer) self.widget_proj_viewer.sig_dim_changed.connect(self.update_size) self.layout_calibrate = QHBoxLayout() self.button_show_calib = QPushButton("Show calibration") self.button_show_calib.clicked.connect(self.toggle_calibration) if isinstance(experiment.calibrator, CircleCalibrator): self.button_calibrate = QPushButton("Calibrate") self.button_calibrate.clicked.connect(self.calibrate) self.layout_calibrate.addWidget(self.button_calibrate) self.label_calibrate = QLabel(self.calibrator.length_to_measure) self.label_calibrate.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.layout_calibrate.addWidget(self.button_show_calib) if isinstance(experiment.calibrator, CircleCalibrator): self.calibrator_px_len = ControlSpin(self.calibrator, "triangle_length") self.layout_calibrate.addWidget(self.calibrator_px_len) self.layout_calibrate.addWidget(self.label_calibrate) self.calibrator_len_spin = ControlSpin(self.calibrator, "length_mm") self.calibrator_len_spin.label.hide() self.layout_calibrate.addWidget(self.calibrator_len_spin) self.layout_calibrate.setContentsMargins(12, 0, 12, 12) self.container_layout.addLayout(self.layout_calibrate) self.setLayout(self.container_layout)
Example #30
Source File: sparrowtablewidgets.py From sparrow-wifi with GNU General Public License v3.0 | 5 votes |
def __init__(self, defaultStr): super().__init__(defaultStr) self.setTextAlignment( Qt.AlignRight + Qt.AlignVCenter)