本文整理汇总了Python中PySide.QtGui.QIcon方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QIcon方法的具体用法?Python QtGui.QIcon怎么用?Python QtGui.QIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onSel1_toggled
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def onSel1_toggled(self):
if not self.Selection1.isChecked() and self.Selection2.isEnabled():
self.Selection1.setChecked(False)
self.sel1Name.clear()
self.Selection2.setEnabled(False)
Gui.Selection.clearSelection()
removePtS()
self.sel1Icon.setIcon(QtGui.QIcon(self.selectIcon))
self.sel2Icon.setIcon(QtGui.QIcon(self.noneIcon))
else:
if not self.Selection2.isEnabled():
self.Selection1.setChecked(False)
self.sel1Icon.setIcon(QtGui.QIcon(self.selectIcon))
#self.sel2Icon.setIcon(QtGui.QIcon(self.noneIcon))
# Angle can be measured only between shapes
示例2: add_button
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def add_button(self, **kwargs):
# so not sure if this is going to work, yay programming!
# intercept/adjust some of the arguments
cmd = kwargs.get('command', 'print "No action defined"')
label = kwargs.get('label', 'Unknown')
annotation = kwargs.get('annotation', '')
image = QtGui.QPixmap()
for (key, val) in kwargs.iteritems():
if key.startswith("image") and IconFactory.is_icon_path(val):
image = QtGui.QIcon(self.icon_factory.disk_path(val))
action = QtGui.QAction(self.widget)
action.setIcon(image)
action.setToolTip(annotation)
action.triggered.connect(lambda: self._exec_cmd(cmd))
button = QtGui.QToolButton()
button.setAutoRaise(True)
button.setDefaultAction(action)
self.layout.addWidget(button)
# -------------------------------------------------------------------------
示例3: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def __init__(self, parent=None, mode=0):
super_class.__init__(self, parent)
#------------------------------
# class variables
#------------------------------
self.version="0.1"
self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file."
self.uiList={} # for ui obj storage
self.memoData = {} # key based variable data storage
self.location = ""
if getattr(sys, 'frozen', False):
# frozen - cx_freeze
self.location = sys.executable
else:
# unfrozen
self.location = os.path.realpath(__file__) # location: ref: sys.modules[__name__].__file__
self.name = self.__class__.__name__
self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
self.iconPix = QtGui.QPixmap(self.iconPath)
self.icon = QtGui.QIcon(self.iconPath)
self.fileType='.{0}_EXT'.format(self.name)
示例4: setupWin
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def setupWin(self):
self.setWindowTitle("TMP_UniversalToolUI_TND" + " - v" + self.version)
self.setGeometry(300, 300, 800, 600)
# win icon setup
path = os.path.join(os.path.dirname(self.location),'icons','TMP_UniversalToolUI_TND.png')
self.setWindowIcon(QtGui.QIcon(path))
# initial win drag position
self.drag_position=QtGui.QCursor.pos()
#self.resize(250,250)
# - for frameless or always on top option
#self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent
#self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear
#self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui
# - for transparent and non-regular shape ui
#self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window
#self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
示例5: update
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def update(self):
'fills the treewidget'
self.tree.clear()
if self.obj:
f = self.obj.baseObject
if isinstance(f[1],list):
for subf in f[1]:
#FreeCAD.Console.PrintLog("item: " + subf + "\n")
item = QtGui.QTreeWidgetItem(self.tree)
item.setText(0,f[0].Name)
item.setIcon(0,QtGui.QIcon(":/icons/Tree_Part.svg"))
item.setText(1,subf)
else:
item = QtGui.QTreeWidgetItem(self.tree)
item.setText(0,f[0].Name)
item.setIcon(0,QtGui.QIcon(":/icons/Tree_Part.svg"))
item.setText(1,f[1][0])
self.retranslateUi(self.form)
示例6: createIconGroupBox
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def createIconGroupBox(self):
self.iconGroupBox = QtGui.QGroupBox("Tray Icon")
self.iconLabel = QtGui.QLabel("Icon:")
self.iconComboBox = QtGui.QComboBox()
self.iconComboBox.addItem(QtGui.QIcon(':/icons/miner.svg'), "Miner")
self.iconComboBox.addItem(QtGui.QIcon(':/images/heart.svg'), "Heart")
self.iconComboBox.addItem(QtGui.QIcon(':/images/trash.svg'), "Trash")
self.showIconCheckBox = QtGui.QCheckBox("Show icon")
self.showIconCheckBox.setChecked(True)
iconLayout = QtGui.QHBoxLayout()
iconLayout.addWidget(self.iconLabel)
iconLayout.addWidget(self.iconComboBox)
iconLayout.addStretch()
iconLayout.addWidget(self.showIconCheckBox)
self.iconGroupBox.setLayout(iconLayout)
示例7: _newPlotContainer
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def _newPlotContainer(self):
''' Create a new plot and add it to the current tab '''
plotContainer = plotWidget.plotContainer(self.mdi)
# defaultWidget = plotWidget.DefaultPlotWidget(self, self.plotMenuCallbacks)
# plotContainer.addRight(defaultWidget)
plotContainer.addFirst(self, self.plotMenuCallbacks)
self.plotContainers.append(plotContainer)
plotContainer.activeWidgetChanged.connect(self._currentPlotChanged)
plotContainer.closed.connect(self._removePlotContainer)
window = self.mdi.addSubWindow(plotContainer)
self.plotWindowNr += 1
window.setWindowTitle("Tab " + str(self.plotWindowNr))
p = QtGui.QPalette()
p.setColor(QtGui.QPalette.Background, QtGui.QColor("white"))
window.setPalette(p)
window.setWindowIcon(QtGui.QIcon(self.rootDir + '/Icons/office-chart-line-stacked.png'))
window.showMaximized()
return plotContainer
示例8: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def __init__(self, *args, **kw):
url = kw.pop('url', None)
first = False
if not url:
url = get_authenticated_url()
first = True
self.url = url
self.closing = False
super(QWebView, self).__init__(*args, **kw)
self.setWindowTitle('Bitmask')
self.bitmask_browser = NewPageConnector(self) if first else None
self.loadPage(self.url)
self.bridge = AppBridge(self) if first else None
if self.bridge is not None and HAS_WEBENGINE:
print "[+] registering python<->js bridge"
channel = QWebChannel(self)
channel.registerObject("bitmaskApp", self.bridge)
self.page().setWebChannel(channel)
icon = QtGui.QIcon()
icon.addPixmap(
QtGui.QPixmap(":/mask-icon.png"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.setWindowIcon(icon)
示例9: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def __init__(self,winTitle='Rotate WP', icon='rotWP.svg'):
super(rotWPForm,self).__init__()
self.move(QPoint(100,250))
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.setWindowTitle(winTitle)
iconPath=join(dirname(abspath(__file__)),"icons",icon)
from PySide.QtGui import QIcon
Icon=QIcon()
Icon.addFile(iconPath)
self.setWindowIcon(Icon)
self.grid=QGridLayout()
self.setLayout(self.grid)
self.radioX=QRadioButton('X')
self.radioX.setChecked(True)
self.radioY=QRadioButton('Y')
self.radioZ=QRadioButton('Z')
self.lab1=QLabel('Angle:')
self.edit1=QLineEdit('45')
self.edit1.setAlignment(Qt.AlignCenter)
self.edit1.setValidator(QDoubleValidator())
self.btn1=QPushButton('Rotate working plane')
self.btn1.clicked.connect(self.rotate)
self.grid.addWidget(self.radioX,0,0,1,1,Qt.AlignCenter)
self.grid.addWidget(self.radioY,0,1,1,1,Qt.AlignCenter)
self.grid.addWidget(self.radioZ,0,2,1,1,Qt.AlignCenter)
self.grid.addWidget(self.lab1,1,0,1,1)
self.grid.addWidget(self.edit1,1,1,1,2)
self.grid.addWidget(self.btn1,2,0,1,3,Qt.AlignCenter)
self.show()
self.sg=FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
s=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("gridSize")
sc=[float(x*s) for x in [1,1,.2]]
from polarUtilsCmd import arrow
self.arrow =arrow(FreeCAD.DraftWorkingPlane.getPlacement(),scale=sc,offset=s)
示例10: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def __init__(self,winTitle='Title',btn1Text='Button1',btn2Text='Button2',initVal='someVal',units='someUnit', icon='flamingo.svg'):
super(prototypeForm,self).__init__()
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.setWindowTitle(winTitle)
iconPath=join(dirname(abspath(__file__)),"icons",icon)
from PySide.QtGui import QIcon
Icon=QIcon()
Icon.addFile(iconPath)
self.setWindowIcon(Icon)
self.move(QPoint(100,250))
self.mainVL=QVBoxLayout()
self.setLayout(self.mainVL)
self.inputs=QWidget()
self.inputs.setLayout(QFormLayout())
self.edit1=QLineEdit(initVal)
self.edit1.setMinimumWidth(40)
self.edit1.setAlignment(Qt.AlignHCenter)
self.edit1.setMaximumWidth(60)
self.inputs.layout().addRow(units,self.edit1)
self.mainVL.addWidget(self.inputs)
self.radio1=QRadioButton()
self.radio1.setChecked(True)
self.radio2=QRadioButton()
self.radios=QWidget()
self.radios.setLayout(QFormLayout())
self.radios.layout().setAlignment(Qt.AlignHCenter)
self.radios.layout().addRow('move',self.radio1)
self.radios.layout().addRow('copy',self.radio2)
self.mainVL.addWidget(self.radios)
self.btn1=QPushButton(btn1Text)
self.btn1.setDefault(True)
self.btn1.setFocus()
self.btn2=QPushButton(btn2Text)
self.buttons=QWidget()
self.buttons.setLayout(QHBoxLayout())
self.buttons.layout().addWidget(self.btn1)
self.buttons.layout().addWidget(self.btn2)
self.mainVL.addWidget(self.buttons)
示例11: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def __init__(self, obj):
self.object = obj
self.baseObj = obj
self.disableUpdate = True
self.selection = Gui.Selection.getSelection()
self.matchOuter = FastenerBase.FSMatchOuter
FSChangeParamDialog = QtGui.QWidget()
FSChangeParamDialog.ui = Ui_DlgChangeParams()
FSChangeParamDialog.ui.setupUi(FSChangeParamDialog)
ui = FSChangeParamDialog.ui
#FSChangeParamDialog.ui.widgetVarLength.hide()
self.form = FSChangeParamDialog
self.form.setWindowTitle("Change fastener parameters")
Gui.Selection.addSelectionGate(FSCPSelectionFilterGate)
self.selobserver = FSCPSelObserver(self.selection)
Gui.Selection.addObserver(self.selobserver)
ui.comboFastenerType.currentIndexChanged.connect(self.onFastenerChange)
ui.comboDiameter.currentIndexChanged.connect(self.onDiameterChange)
ui.checkAutoDiameter.stateChanged.connect(self.onAutoDiamChange)
ui.checkSetLength.stateChanged.connect(self.onSetLengthChange)
ui.spinLength.setEnabled(False)
self.hatMatchOption = False
if len(self.selection) > 0:
selobj = self.selection[0]
#FreeCAD.Console.PrintLog("selobj: " + str(selobj.Proxy) + "\n")
if hasattr(selobj, 'Proxy') and hasattr(selobj.Proxy, 'VerifyCreateMatchOuter'):
self.hatMatchOption = True
if self.hatMatchOption:
ui.comboMatchType.addItem("No Change")
ui.comboMatchType.addItem(QtGui.QIcon(os.path.join(iconPath , 'IconMatchTypeInner.svg')), "Match inner thread")
ui.comboMatchType.addItem(QtGui.QIcon(os.path.join(iconPath , 'IconMatchTypeOuter.svg')), "Match outer thread")
ui.comboMatchType.setEnabled(False)
ui.comboMatchType.setCurrentIndex(0)
else:
ui.comboMatchType.hide()
示例12: FillFields
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def FillFields(self, fstype):
ui = self.form.ui
self.fstype = fstype
#FreeCAD.Console.PrintLog(fstype.typeName + str(fstype.hasLength) + str(fstype.lengthFixed) + "\n")
ui.comboFastenerType.addItem('No Change')
#FreeCAD.Console.PrintLog("nitems: " + str(len(fstype.items)) + "\n")
for screw in fstype.items:
ui.comboFastenerType.addItem(QtGui.QIcon(os.path.join(iconPath , screw + '.svg')), screw)
if len(fstype.items) == 1:
ui.comboFastenerType.setCurrentIndex(1)
ui.comboFastenerType.setEnabled(False)
#FreeCAD.Console.PrintLog("manual\n")
self.disableUpdate = False
self.UpdateDiameters()
return
示例13: fillScrewTypes
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def fillScrewTypes(self):
self.comboFastenerType.currentIndexChanged.connect(self.onTypeChange)
self.comboDiameter.currentIndexChanged.connect(self.onDiameterChange)
self.comboFastenerType.clear()
for type in FSCScrewTypes:
icon, name, table = type
self.comboFastenerType.addItem(QtGui.QIcon(os.path.join(iconPath , icon)), name)
示例14: fillScrewType
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def fillScrewType(self, screwList):
self.comboScrewType.clear()
self.comboScrewType.addItem('Default')
for screw in screwList:
self.comboScrewType.addItem(QtGui.QIcon(os.path.join(iconPath , screw + '.svg')), screw)
示例15: UpdateIcon
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QIcon [as 别名]
def UpdateIcon(self):
if FSMatchOuter:
self.toolbarItem.setIcon(QtGui.QIcon(self.iconOuter))
else:
self.toolbarItem.setIcon(QtGui.QIcon(self.iconInner))