Python源码示例:PyQt5.QtCore.Qt.AlignRight()
示例1
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
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
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
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
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
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
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
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
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
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
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)
示例12
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)
示例13
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)
示例14
def alignRight(self):
self.text.setAlignment(Qt.AlignRight)
示例15
def alignRight(self):
self.text.setAlignment(Qt.AlignRight)
示例16
def alignRight(self):
self.text.setAlignment(Qt.AlignRight)
示例17
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)
示例18
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)
示例19
def __init__(self, defaultStr):
super().__init__(defaultStr)
# See http://doc.qt.io/qt-5/qt.html for alignment
self.setTextAlignment( Qt.AlignRight + Qt.AlignVCenter )
示例20
def __init__(self, defaultStr):
super().__init__(defaultStr)
self.setTextAlignment( Qt.AlignRight + Qt.AlignVCenter)
示例21
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)
示例22
def initUI(self):
self.setWindowTitle("请稍等……")
self.setWindowIcon(QIcon(SRC_DIR + "password.ico"))
self.lb_oldpwd = QLabel()
self.lb_oldpwd.setText("当前提取码:")
self.lb_oldpwd.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
self.tx_oldpwd = QLineEdit()
# 当前提取码 只读
self.tx_oldpwd.setFocusPolicy(Qt.NoFocus)
self.tx_oldpwd.setReadOnly(True)
self.lb_newpwd = QLabel()
self.lb_newpwd.setText("新的提取码:")
self.lb_newpwd.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
self.tx_newpwd = QLineEdit()
self.buttonBox = QDialogButtonBox()
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttonBox.button(QDialogButtonBox.Ok).setText("确定")
self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消")
self.grid = QGridLayout()
self.grid.setSpacing(10)
self.grid.addWidget(self.lb_oldpwd, 1, 0)
self.grid.addWidget(self.tx_oldpwd, 1, 1)
self.grid.addWidget(self.lb_newpwd, 2, 0)
self.grid.addWidget(self.tx_newpwd, 2, 1)
self.grid.addWidget(self.buttonBox, 3, 0, 1, 2)
self.setLayout(self.grid)
self.buttonBox.accepted.connect(self.btn_ok)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.accepted.connect(self.set_tip)
self.buttonBox.rejected.connect(self.reject)
self.buttonBox.rejected.connect(self.set_tip)
self.setMinimumWidth(280)
示例23
def initUI(self):
self.setWindowIcon(QIcon(SRC_DIR + "desc.ico"))
self.lb_name = QLabel()
self.lb_name.setText("文件夹名:")
self.lb_name.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
self.tx_name = QLineEdit()
self.lb_desc = QLabel()
self.tx_desc = QTextEdit()
self.lb_desc.setText("描 述:")
self.lb_desc.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
self.buttonBox = QDialogButtonBox()
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttonBox.button(QDialogButtonBox.Ok).setText("确定")
self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消")
self.grid = QGridLayout()
self.grid.setSpacing(10)
self.grid.addWidget(self.lb_name, 1, 0)
self.grid.addWidget(self.tx_name, 1, 1)
self.grid.addWidget(self.lb_desc, 2, 0)
self.grid.addWidget(self.tx_desc, 2, 1, 5, 1)
self.grid.addWidget(self.buttonBox, 7, 1, 1, 1)
self.setLayout(self.grid)
self.buttonBox.accepted.connect(self.btn_ok)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
示例24
def initUI(self):
self.setWindowTitle("移动文件(夹)")
self.setWindowIcon(QIcon(SRC_DIR + "move.ico"))
self.lb_name = QLabel()
self.lb_name.setText("文件(夹)名:")
self.lb_name.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
self.tx_name = AutoResizingTextEdit()
self.tx_name.setFocusPolicy(Qt.NoFocus) # 只读
self.tx_name.setReadOnly(True)
self.lb_new_path = QLabel()
self.lb_new_path.setText("目标文件夹:")
self.lb_new_path.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
self.tx_new_path = QComboBox()
self.buttonBox = QDialogButtonBox()
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttonBox.button(QDialogButtonBox.Ok).setText("确定")
self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消")
self.grid = QGridLayout()
self.grid.setSpacing(10)
self.grid.addWidget(self.lb_name, 1, 0)
self.grid.addWidget(self.tx_name, 1, 1)
self.grid.addWidget(self.lb_new_path, 2, 0)
self.grid.addWidget(self.tx_new_path, 2, 1)
self.grid.addWidget(self.buttonBox, 3, 0, 1, 2)
self.setLayout(self.grid)
self.buttonBox.accepted.connect(self.btn_ok)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.setMinimumWidth(280)
示例25
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)
示例26
def crearLeyendaCaja(self):
leyendaComboBox = QComboBox()
leyendaComboBox.addItem("No Leyenda", 0)
leyendaComboBox.addItem("Leyenda superior", Qt.AlignTop)
leyendaComboBox.addItem("Leyenda inferior", Qt.AlignBottom)
leyendaComboBox.addItem("Leyenda izquierda", Qt.AlignLeft)
leyendaComboBox.addItem("Leyenda derecha", Qt.AlignRight)
return leyendaComboBox
示例27
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
示例28
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
示例29
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
示例30
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