当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QIcon方法代码示例

本文整理汇总了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 
开发者ID:Zolko-123,项目名称:FreeCAD_Assembly4,代码行数:18,代码来源:Asm4_Measure.py

示例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)

    # ------------------------------------------------------------------------- 
开发者ID:Clemson-DPA,项目名称:dpa-pipe,代码行数:27,代码来源:shelf.py

示例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) 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:26,代码来源:universal_tool_template_0903.py

示例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 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:18,代码来源:universal_tool_template_v7.3.py

示例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) 
开发者ID:shaise,项目名称:FreeCAD_SheetMetal,代码行数:20,代码来源:SheetMetalBend.py

示例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) 
开发者ID:slush0,项目名称:epycyzm,代码行数:21,代码来源:gui.py

示例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 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:20,代码来源:PySimulator.py

示例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) 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:29,代码来源:app.py

示例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) 
开发者ID:oddtopus,项目名称:flamingo,代码行数:36,代码来源:qForms.py

示例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) 
开发者ID:oddtopus,项目名称:flamingo,代码行数:40,代码来源:frameForms.py

示例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() 
开发者ID:shaise,项目名称:FreeCAD_FastenersWB,代码行数:38,代码来源:FSChangeParams.py

示例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 
开发者ID:shaise,项目名称:FreeCAD_FastenersWB,代码行数:17,代码来源:FSChangeParams.py

示例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) 
开发者ID:shaise,项目名称:FreeCAD_FastenersWB,代码行数:9,代码来源:FSScrewCalc.py

示例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) 
开发者ID:shaise,项目名称:FreeCAD_FastenersWB,代码行数:7,代码来源:CountersunkHoles.py

示例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)) 
开发者ID:shaise,项目名称:FreeCAD_FastenersWB,代码行数:7,代码来源:FastenerBase.py


注:本文中的PySide.QtGui.QIcon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。