本文整理汇总了Python中qtpy.QtGui.QIcon方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QIcon方法的具体用法?Python QtGui.QIcon怎么用?Python QtGui.QIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtGui
的用法示例。
在下文中一共展示了QtGui.QIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def create(self, p4, files=[]):
self.p4 = p4
path = interop.getIconPath() + "p4.png"
icon = QtGui.QIcon(path)
self.setWindowTitle("Submit Change")
self.setWindowIcon(icon)
self.setWindowFlags(QtCore.Qt.Window)
self.fileList = files
self.create_controls()
self.create_layout()
self.create_connections()
self.validateText()
示例2: __add_result
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def __add_result(self, result: Mapping[str, Any]) -> None:
"""Add result items, except add to the list."""
item = QListWidgetItem(result['algorithm'])
interrupt = result['interrupted']
if interrupt == 'False':
interrupt_icon = "task_completed.png"
elif interrupt == 'N/A':
interrupt_icon = "question.png"
else:
interrupt_icon = "interrupted.png"
item.setIcon(QIcon(QPixmap(f":/icons/{interrupt_icon}")))
if interrupt == 'False':
interrupt_text = "No interrupt."
else:
interrupt_text = f"Interrupt at: {interrupt}"
text = f"{result['algorithm']} ({interrupt_text})"
if interrupt == 'N/A':
text += "\n※Completeness is unknown."
item.setToolTip(text)
self.result_list.addItem(item)
示例3: __undo_redo
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def __undo_redo(self) -> None:
"""Undo list settings.
+ Undo stack.
+ Undo view widget.
+ Hot keys.
"""
self.command_stack = QUndoStack(self)
self.command_stack.setUndoLimit(self.prefer.undo_limit_option)
self.command_stack.indexChanged.connect(self.command_reload)
action_redo = self.command_stack.createRedoAction(self, "Redo")
action_undo = self.command_stack.createUndoAction(self, "Undo")
action_redo.setShortcuts(["Ctrl+Shift+Z", "Ctrl+Y"])
action_redo.setStatusTip("Backtracking undo action.")
action_redo.setIcon(QIcon(QPixmap(":/icons/redo.png")))
action_undo.setShortcut("Ctrl+Z")
action_undo.setStatusTip("Recover last action.")
action_undo.setIcon(QIcon(QPixmap(":/icons/undo.png")))
self.menu_edit.addActions([action_undo, action_redo])
示例4: __alignment
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def __alignment(self) -> None:
"""Menu of alignment function."""
def switch_icon(m: int, icon_name: str) -> Callable[[], None]:
@Slot()
def func() -> None:
self.alignment_mode = m
self.alignment_button.setIcon(QIcon(QPixmap(icon_name)))
return func
menu = QMenu(self)
for i, (text, icon) in enumerate([
("Vertical alignment", "vertical_align"),
("Horizontal alignment", "horizontal_align"),
]):
icon = f":/icons/{icon}.png"
action = QAction(QIcon(QPixmap(icon)), text, self)
action.triggered.connect(switch_icon(i, icon))
menu.addAction(action)
self.alignment_button.setMenu(menu)
self.alignment_button.clicked.connect(self.point_alignment)
示例5: __init__
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def __init__(
self,
env: str,
file_name: str,
vpoints: Sequence[VPoint],
v_to_slvs: Callable[[], Iterable[Tuple[int, int]]],
parent: QWidget
):
"""Comes in environment variable and project name."""
super(OutputDialog, self).__init__(parent)
self.setupUi(self)
self.setWindowFlags(self.windowFlags()
& ~Qt.WindowContextHelpButtonHint)
self.setWindowTitle(f"Export {self.format_name} module project")
self.setWindowIcon(QIcon(QPixmap(f":/icons/{self.format_icon}")))
self.assembly_label.setText(self.assembly_description)
self.frame_label.setText(self.frame_description)
self.path_edit.setPlaceholderText(env)
self.filename_edit.setPlaceholderText(file_name)
self.vpoints = vpoints
self.v_to_slvs = v_to_slvs
示例6: createQApp
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def createQApp():
"""创建PyQt应用对象"""
# 创建Qt应用对象
qApp = QtWidgets.QApplication([])
# 设置Qt的皮肤
if globalSetting['darkStyle']:
try:
import qdarkstyle
qApp.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
except :
print("Unexpected error when import darkStyle:", sys.exc_info()[0])
# 设置Windows底部任务栏图标
if 'Windows' in platform.uname():
import ctypes
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('vn.trader')
# 设置Qt字体
qApp.setFont(BASIC_FONT)
# 设置Qt图标
qApp.setWindowIcon(QtGui.QIcon(loadIconPath('vnpy.ico')))
# 返回创建好的QApp对象
return qApp
示例7: main
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def main():
import signal
from .config import ROOT_LOG
from .main_window import MainWindow
from .resources import qCleanupResources
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QApplication
app = QApplication(sys.argv)
app.setWindowIcon(QIcon(':/cutelog.png'))
mw = MainWindow(ROOT_LOG, app)
signal.signal(signal.SIGINT, mw.signal_handler)
sys.exit(app.exec_())
qCleanupResources()
示例8: __init__
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def __init__(self, axis: str, signal_target_changed: QtCore.Signal):
""" A widget to change the tick properties
Args:
axis: whether to use the "x" or "y" axis
signal_target_changed: a signal to emit when the target changed
"""
QtWidgets.QWidget.__init__(self)
self.setWindowTitle("Figure - " + axis + "-Axis - Ticks - Pylustrator")
self.setWindowIcon(QtGui.QIcon(os.path.join(os.path.dirname(__file__), "icons", "ticks.ico")))
self.layout = QtWidgets.QVBoxLayout(self)
self.axis = axis
self.label = QtWidgets.QLabel(
"Ticks can be specified, one tick pre line.\nOptionally a label can be provided, e.g. 1 \"First\",")
self.layout.addWidget(self.label)
self.layout2 = QtWidgets.QHBoxLayout()
self.layout.addLayout(self.layout2)
self.input_ticks = TextWidget(self.layout2, axis + "-Ticks:", multiline=True, horizontal=False)
self.input_ticks.editingFinished.connect(self.ticksChanged)
self.input_ticks2 = TextWidget(self.layout2, axis + "-Ticks (minor):", multiline=True, horizontal=False)
self.input_ticks2.editingFinished.connect(self.ticksChanged2)
self.input_scale = ComboWidget(self.layout, axis + "-Scale", ["linear", "log", "symlog", "logit"])
self.input_scale.link(axis + "scale", signal_target_changed)
self.input_font = TextPropertiesWidget(self.layout)
self.input_labelpad = NumberWidget(self.layout, axis + "-Labelpad", min=-999)
self.input_labelpad.link(axis + "axis.labelpad", signal_target_changed, direct=True)
self.button_ok = QtWidgets.QPushButton("Ok")
self.layout.addWidget(self.button_ok)
self.button_ok.clicked.connect(self.hide)
示例9: icon
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def icon(self, name: str):
""" get an icon with the given filename """
pm = QtGui.QPixmap(os.path.join(os.path.dirname(__file__), "icons", name))
if hasattr(pm, 'setDevicePixelRatio'):
pm.setDevicePixelRatio(self.canvas._dpi_ratio)
return QtGui.QIcon(pm)
示例10: create
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def create(self, title, files=[]):
path = interop.getIconPath() + "p4.png"
icon = QtGui.QIcon(path)
self.setWindowTitle(title)
self.setWindowIcon(icon)
self.setWindowFlags(QtCore.Qt.Dialog)
self.create_controls()
self.create_layout()
self.create_connections()
示例11: __init__
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def __init__(self, p4, parent=None):
super(BaseRevisionTab, self).__init__(parent)
self.p4 = p4
path = os.path.join(interop.getIconPath(), "p4.png")
icon = QtGui.QIcon(path)
self.setWindowTitle("File Revisions")
self.setWindowIcon(icon)
self.setWindowFlags(QtCore.Qt.Window)
self.fileRevisions = []
示例12: create_controls
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def create_controls(self):
'''
Create the widgets for the dialog
'''
headers = ["File", "Type", "Action", "User", "Folder"]
self.tableWidget = QtWidgets.QTableWidget(0, len(headers))
self.tableWidget.setMaximumHeight(200)
self.tableWidget.setMinimumWidth(500)
self.tableWidget.setHorizontalHeaderLabels(headers)
self.tableWidget.setSelectionBehavior(
QtWidgets.QAbstractItemView.SelectRows)
self.tableWidget.setSelectionMode(
QtWidgets.QAbstractItemView.SingleSelection)
self.openSelectedBtn = QtWidgets.QPushButton("Open")
self.openSelectedBtn.setEnabled(False)
self.openSelectedBtn.setIcon(QtGui.QIcon(
os.path.join(interop.getIconPath(), "File0228.png")))
self.revertFileBtn = QtWidgets.QPushButton("Remove from changelist")
self.revertFileBtn.setEnabled(False)
self.revertFileBtn.setIcon(QtGui.QIcon(
os.path.join(interop.getIconPath(), "File0308.png")))
self.refreshBtn = QtWidgets.QPushButton("Refresh")
self.refreshBtn.setIcon(QtGui.QIcon(
os.path.join(interop.getIconPath(), "File0175.png")))
self.updateTable()
示例13: data
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def data(self, index, role):
column = index.column()
if not index.isValid():
return None
if role == QtCore.Qt.DisplayRole:
item = index.internalPointer()
return item.data[column]
elif role == QtCore.Qt.SizeHintRole:
return QtCore.QSize(20, 20)
elif role == QtCore.Qt.DecorationRole:
if column == 1:
itemType = index.internalPointer().data[column]
isDeleted = index.internalPointer().data[3] == 'delete'
if isDeleted:
return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0104.png'))
# Try to figure out which icon is most applicable to the item
if itemType == "Folder":
return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0059.png'))
elif "binary" in itemType:
return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0315.png'))
elif "text" in itemType:
return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0027.png'))
else:
return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0106.png'))
else:
return None
return None
示例14: create
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def create(self, p4, files=[]):
self.p4 = p4
path = interop.getIconPath()
icon = QtGui.QIcon(path)
self.setWindowTitle("Changelist : Opened Files")
self.setWindowIcon(icon)
self.setWindowFlags(QtCore.Qt.Window)
self.entries = []
self.create_controls()
self.create_layout()
self.create_connections()
示例15: __init__
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QIcon [as 别名]
def __init__(self):
super(Q7FileIconProvider, self).__init__()
self.dir = QIcon(QPixmap(":/images/icons/folder.png"))
self.cgns = QIcon(QPixmap(":/images/icons/tree-load.png"))
self.empty = QIcon()