Python PySide.QtGui.QIcon() Examples

The following are 30 code examples of PySide.QtGui.QIcon(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PySide.QtGui , or try the search function .
Example #1
Source File: universal_tool_template_0903.py    From universal_tool_template.py with MIT License 7 votes vote down vote up
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) 
Example #2
Source File: PySimulator.py    From PySimulator with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 
Example #3
Source File: shelf.py    From dpa-pipe with MIT License 6 votes vote down vote up
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)

    # ------------------------------------------------------------------------- 
Example #4
Source File: Asm4_Measure.py    From FreeCAD_Assembly4 with GNU Lesser General Public License v2.1 6 votes vote down vote up
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 
Example #5
Source File: universal_tool_template_v7.3.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
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 
Example #6
Source File: SheetMetalBend.py    From FreeCAD_SheetMetal with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #7
Source File: SheetMetalJunction.py    From FreeCAD_SheetMetal with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #8
Source File: SheetMetalCmd.py    From FreeCAD_SheetMetal with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #9
Source File: gui.py    From epycyzm with MIT License 6 votes vote down vote up
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) 
Example #10
Source File: universal_tool_template_v8.1.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def quickMenuAction(self, objName, title, tip, icon, menuObj):
        self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self)        
        self.uiList[objName].setStatusTip(tip)
        menuObj.addAction(self.uiList[objName]) 
Example #11
Source File: SheetMetalJunction.py    From FreeCAD_SheetMetal with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
      
      self.obj = None
      self.form = QtGui.QWidget()
      self.form.setObjectName("SMJunctionTaskPanel")
      self.form.setWindowTitle("Binded edges list")
      self.grid = QtGui.QGridLayout(self.form)
      self.grid.setObjectName("grid")
      self.title = QtGui.QLabel(self.form)
      self.grid.addWidget(self.title, 0, 0, 1, 2)
      self.title.setText("Select new Edge(s) and press Update")

      # tree
      self.tree = QtGui.QTreeWidget(self.form)
      self.grid.addWidget(self.tree, 1, 0, 1, 2)
      self.tree.setColumnCount(2)
      self.tree.setHeaderLabels(["Name","Subelement"])

      # buttons
      self.addButton = QtGui.QPushButton(self.form)
      self.addButton.setObjectName("addButton")
      self.addButton.setIcon(QtGui.QIcon(os.path.join( iconPath , 'SMUpdate.svg')))
      self.grid.addWidget(self.addButton, 3, 0, 1, 2)

      QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.updateElement)
      self.update() 
Example #12
Source File: SheetMetalRelief.py    From FreeCAD_SheetMetal with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
      
      self.obj = None
      self.form = QtGui.QWidget()
      self.form.setObjectName("SMReliefTaskPanel")
      self.form.setWindowTitle("Binded vertexes list")
      self.grid = QtGui.QGridLayout(self.form)
      self.grid.setObjectName("grid")
      self.title = QtGui.QLabel(self.form)
      self.grid.addWidget(self.title, 0, 0, 1, 2)
      self.title.setText("Select new vertex(es) and press Update")

      # tree
      self.tree = QtGui.QTreeWidget(self.form)
      self.grid.addWidget(self.tree, 1, 0, 1, 2)
      self.tree.setColumnCount(2)
      self.tree.setHeaderLabels(["Name","Subelement"])

      # buttons
      self.addButton = QtGui.QPushButton(self.form)
      self.addButton.setObjectName("addButton")
      self.addButton.setIcon(QtGui.QIcon(os.path.join( iconPath , 'SMUpdate.svg')))
      self.grid.addWidget(self.addButton, 3, 0, 1, 2)

      QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.updateElement)
      self.update() 
Example #13
Source File: SheetMetalCmd.py    From FreeCAD_SheetMetal with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
      
      self.obj = None
      self.form = QtGui.QWidget()
      self.form.setObjectName("SMBendWallTaskPanel")
      self.form.setWindowTitle("Binded faces/edges list")
      self.grid = QtGui.QGridLayout(self.form)
      self.grid.setObjectName("grid")
      self.title = QtGui.QLabel(self.form)
      self.grid.addWidget(self.title, 0, 0, 1, 2)
      self.title.setText("Select new face(s)/Edge(s) and press Update")

      # tree
      self.tree = QtGui.QTreeWidget(self.form)
      self.grid.addWidget(self.tree, 1, 0, 1, 2)
      self.tree.setColumnCount(2)
      self.tree.setHeaderLabels(["Name","Subelement"])

      # buttons
      self.addButton = QtGui.QPushButton(self.form)
      self.addButton.setObjectName("addButton")
      self.addButton.setIcon(QtGui.QIcon(os.path.join( iconPath , 'SMUpdate.svg')))
      self.grid.addWidget(self.addButton, 3, 0, 1, 2)

      QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.updateElement)
      self.update() 
Example #14
Source File: GDT.py    From FreeCAD-GDT with GNU Lesser General Public License v2.1 5 votes vote down vote up
def createForm(self):
        title, iconPath, idGDT, dialogWidgets, ContainerOfData = self.initArgs
        self.form = GDTGuiClass( title, idGDT, dialogWidgets, ContainerOfData)
        self.form.setWindowTitle( title )
        self.form.setWindowIcon( QtGui.QIcon( iconPath ) ) 
Example #15
Source File: GDT.py    From FreeCAD-GDT with GNU Lesser General Public License v2.1 5 votes vote down vote up
def generateWidget( self, idGDT, ContainerOfData ):
        self.idGDT = idGDT
        self.ContainerOfData = ContainerOfData

        if self.Text == 'Primary:':
            self.k=0
        elif self.Text == 'Secondary:':
            self.k=1
        elif self.Text == 'Tertiary:':
            self.k=2
        elif self.Text == 'Characteristic:':
            self.k=3
        elif self.Text == 'Datum system:':
            self.k=4
        elif self.Text == 'Active annotation plane:':
            self.k=5
        else:
            self.k=6

        self.ContainerOfData.combo[self.k] = QtGui.QComboBox()
        for i in range(len(self.List)):
            if self.Icons <> None:
                self.ContainerOfData.combo[self.k].addItem( QtGui.QIcon(self.Icons[i]), self.List[i] )
            else:
                if self.List[i] == None:
                    self.ContainerOfData.combo[self.k].addItem( '' )
                else:
                    self.ContainerOfData.combo[self.k].addItem( self.List[i].Label )
        if self.Text == 'Secondary:' or self.Text == 'Tertiary:':
            self.ContainerOfData.combo[self.k].setEnabled(False)
        if self.ToolTip <> None:
            self.ContainerOfData.combo[self.k].setToolTip( self.ToolTip[0] )
        self.comboIndex = self.ContainerOfData.combo[self.k].currentIndex()
        if self.k <> 0 and self.k <> 1:
            self.updateDate(self.comboIndex)
        self.ContainerOfData.combo[self.k].activated.connect(lambda comboIndex = self.comboIndex: self.updateDate(comboIndex))
        return GDTDialog_hbox(self.Text,self.ContainerOfData.combo[self.k]) 
Example #16
Source File: app.py    From bitmask-dev with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #17
Source File: qForms.py    From flamingo with GNU Lesser General Public License v3.0 5 votes vote down vote up
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) 
Example #18
Source File: universal_tool_template_0803.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def quickMenuAction(self, objName, title, tip, icon, menuObj):
        self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self)        
        self.uiList[objName].setStatusTip(tip)
        menuObj.addAction(self.uiList[objName]) 
Example #19
Source File: universal_tool_template_0803.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
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)
        
        # Custom user variable
        #------------------------------
        # initial data
        #------------------------------
        self.memoData['data']=[]
        
        self.setupStyle()
        if isinstance(self, QtWidgets.QMainWindow):
            self.setupMenu()
        self.setupWin()
        self.setupUI()
        self.Establish_Connections()
        self.loadData()
        self.loadLang() 
Example #20
Source File: universal_tool_template_0903.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def quickMenuAction(self, objName, title, tip, icon, menuObj):
        self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self)        
        self.uiList[objName].setStatusTip(tip)
        menuObj.addAction(self.uiList[objName]) 
Example #21
Source File: UITranslator_v1.0.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def quickMenuAction(self, objName, title, tip, icon, menuObj):
        self.uiList[objName] = QtGui.QAction(QtGui.QIcon(icon), title, self)        
        self.uiList[objName].setStatusTip(tip)
        menuObj.addAction(self.uiList[objName]) 
Example #22
Source File: universal_tool_template_1110.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None):
        self.uiList[ui_name] = QtWidgets.QAction(title, self)
        if icon!=None:
            self.uiList[ui_name].setIcon(QtGui.QIcon(icon))
        if tip !=None:
            self.uiList[ui_name].setStatusTip(tip)
        if key != None:
            self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key))
        if parent !=None:
            if isinstance(parent, (str, unicode)) and parent in self.uiList.keys():
                self.uiList[parent].addAction(self.uiList[ui_name])
            elif isinstance(parent, QtWidgets.QMenu):
                parent.addAction(self.uiList[ui_name])
        return ui_name 
Example #23
Source File: universal_tool_template_1100.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None):
        self.uiList[ui_name] = QtWidgets.QAction(title, self)
        if icon!=None:
            self.uiList[ui_name].setIcon(QtGui.QIcon(icon))
        if tip !=None:
            self.uiList[ui_name].setStatusTip(tip)
        if key != None:
            self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key))
        if parent !=None:
            if isinstance(parent, (str, unicode)) and parent in self.uiList.keys():
                self.uiList[parent].addAction(self.uiList[ui_name])
            elif isinstance(parent, QtWidgets.QMenu):
                parent.addAction(self.uiList[ui_name])
        return ui_name 
Example #24
Source File: universal_tool_template_1112.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None):
        self.uiList[ui_name] = QtWidgets.QAction(title, self)
        if icon!=None:
            self.uiList[ui_name].setIcon(QtGui.QIcon(icon))
        if tip !=None:
            self.uiList[ui_name].setStatusTip(tip)
        if key != None:
            self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key))
        if parent !=None:
            if isinstance(parent, (str, unicode)) and parent in self.uiList.keys():
                self.uiList[parent].addAction(self.uiList[ui_name])
            elif isinstance(parent, QtWidgets.QMenu):
                parent.addAction(self.uiList[ui_name])
        return ui_name 
Example #25
Source File: universal_tool_template_1115.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None):
        self.uiList[ui_name] = QtWidgets.QAction(title, self)
        if icon!=None:
            self.uiList[ui_name].setIcon(QtGui.QIcon(icon))
        if tip !=None:
            self.uiList[ui_name].setStatusTip(tip)
        if key != None:
            self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key))
        if parent !=None:
            if isinstance(parent, (str, unicode)) and parent in self.uiList.keys():
                self.uiList[parent].addAction(self.uiList[ui_name])
            elif isinstance(parent, QtWidgets.QMenu):
                parent.addAction(self.uiList[ui_name])
        return ui_name 
Example #26
Source File: FSChangeParams.py    From FreeCAD_FastenersWB with GNU General Public License v2.0 5 votes vote down vote up
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() 
Example #27
Source File: GearBox_template_1010.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def quickMenuAction(self, objName, title, tip, icon, menuObj):
        self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self)
        self.uiList[objName].setStatusTip(tip)
        menuObj.addAction(self.uiList[objName]) 
Example #28
Source File: universal_tool_template_1020.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None):
        self.uiList[ui_name] = QtWidgets.QAction(title, self)
        if icon!=None:
            self.uiList[ui_name].setIcon(QtGui.QIcon(icon))
        if tip !=None:
            self.uiList[ui_name].setStatusTip(tip)
        if key != None:
            self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key))
        if parent !=None:
            if isinstance(parent, (str, unicode)) and parent in self.uiList.keys():
                self.uiList[parent].addAction(self.uiList[ui_name])
            elif isinstance(parent, QtWidgets.QMenu):
                parent.addAction(self.uiList[ui_name])
        return ui_name 
Example #29
Source File: universal_tool_template_1116.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None):
        self.uiList[ui_name] = QtWidgets.QAction(title, self)
        if icon!=None:
            self.uiList[ui_name].setIcon(QtGui.QIcon(icon))
        if tip !=None:
            self.uiList[ui_name].setStatusTip(tip)
        if key != None:
            self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key))
        if parent !=None:
            if isinstance(parent, (str, unicode)) and parent in self.uiList.keys():
                self.uiList[parent].addAction(self.uiList[ui_name])
            elif isinstance(parent, QtWidgets.QMenu):
                parent.addAction(self.uiList[ui_name])
        return ui_name 
Example #30
Source File: universal_tool_template_0904.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def quickMenuAction(self, objName, title, tip, icon, menuObj):
        self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self)        
        self.uiList[objName].setStatusTip(tip)
        menuObj.addAction(self.uiList[objName])