本文整理汇总了Python中PyQt5.QtCore.Qt.AlignRight方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.AlignRight方法的具体用法?Python Qt.AlignRight怎么用?Python Qt.AlignRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.AlignRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_top_layout
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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)
示例2: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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)
示例3: generateTagFile
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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))
示例4: paintEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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()
示例5: _initialize_navigation_buttons
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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)
示例6: createStatusBar
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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"])
示例7: customAxisY
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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上
示例8: addTare
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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)
示例9: addExecute
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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)
示例10: updateValue
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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}]: 更新策略执行数据时出错,执行列表中该策略已删除!")
示例11: alignRight
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
def alignRight(self):
self.text.setAlignment(Qt.AlignRight)
示例12: setup_hint_label
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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)
示例13: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
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)
示例14: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
def __init__(self, defaultStr):
super().__init__(defaultStr)
# See http://doc.qt.io/qt-5/qt.html for alignment
self.setTextAlignment( Qt.AlignRight + Qt.AlignVCenter )
示例15: populate_form
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignRight [as 别名]
def populate_form(self):
self.setWindowTitle('mkYARA :: Generated Yara Rule')
self.resize(800, 600)
self.layout = QtWidgets.QVBoxLayout(self)
self.top_layout = QtWidgets.QHBoxLayout()
self.bottom_layout = QtWidgets.QHBoxLayout()
self.bottom_layout.setAlignment(Qt.AlignRight | Qt.AlignBottom)
# layout.addStretch()
self.layout.addWidget(QtWidgets.QLabel("Generated Yara rule from 0x{:x} to 0x{:x}".format(self.start_addr, self.end_addr)))
self.text_edit = QtWidgets.QTextEdit()
font = QtGui.QFont()
font.setFamily("Consolas")
font.setStyleHint(QtGui.QFont.Monospace)
font.setFixedPitch(True)
font.setPointSize(10)
self.text_edit.setFont(font)
metrics = QtGui.QFontMetrics(font)
self.text_edit.setTabStopWidth(4 * metrics.width(' '))
self.text_edit.insertPlainText(self.yara_rule)
self.layout.addWidget(self.text_edit)
self.ok_btn = QtWidgets.QPushButton("OK")
self.ok_btn.setFixedWidth(100)
self.ok_btn.clicked.connect(self.ok_btn_clicked)
self.bottom_layout.addWidget(self.ok_btn)
self.layout.addLayout(self.top_layout)
self.layout.addLayout(self.bottom_layout)