Python PySide.QtGui 模块,QTreeWidget() 实例源码

我们从Python开源项目中,提取了以下26个代码示例,用于说明如何使用PySide.QtGui.QTreeWidget()

项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def buildTree(self,*args):
        pathTree=buildTreeFromPaths(self.publishItems)
        #build Tree
        dicts=[[pathTree,self.publishesTree]]
        for dict,parent in dicts:
            for k in dict.keys():
                item=QtGui.QTreeWidgetItem()
                item.setText(0,k)
                if type(parent) is QtGui.QTreeWidget:
                    if not item.text(0)=='<files>':
                        self.publishesTree.insertTopLevelItem(0,item)
                if type(parent) is QtGui.QTreeWidgetItem:
                    if not item.text(0)=='<files>':
                        parent.addChild(item)
                if type(dict[k]) is collections.defaultdict:
                    dicts.append([dict[k],item])
                    #print "found dict",k
                if type(dict[k]) is list and type(parent) is not QtGui.QTreeWidget:
                    for i in dict[k]:
                        #add frames to parent
                        parent.setText(1,i.split(" ")[-1])
        self.publishesTree.sortItems(0,QtCore.Qt.AscendingOrder)
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def buildTree(self,*args):
        pathTree=buildTreeFromPaths(self.publishItems)
        #build Tree
        dicts=[[pathTree,self.publishesTree]]
        for dict,parent in dicts:
            for k in dict.keys():
                item=QtGui.QTreeWidgetItem()
                item.setText(0,k)
                if type(parent) is QtGui.QTreeWidget:
                    if not item.text(0)=='<files>':
                        self.publishesTree.insertTopLevelItem(0,item)
                if type(parent) is QtGui.QTreeWidgetItem:
                    if not item.text(0)=='<files>':
                        parent.addChild(item)
                if type(dict[k]) is collections.defaultdict:
                    dicts.append([dict[k],item])
                    #print "found dict",k
                if type(dict[k]) is list and type(parent) is not QtGui.QTreeWidget:
                    for i in dict[k]:
                        #add frames to parent
                        parent.setText(1,i.split(" ")[-1])
        self.publishesTree.sortItems(0,QtCore.Qt.AscendingOrder)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(241, 367)
        self.gridLayout = QtGui.QGridLayout(Form)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtGui.QLabel(Form)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
        self.itemTree = QtGui.QTreeWidget(Form)
        self.itemTree.setObjectName("itemTree")
        self.itemTree.headerItem().setText(0, "1")
        self.itemTree.header().setVisible(False)
        self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
        self.label_2 = QtGui.QLabel(Form)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
        self.formatList = QtGui.QListWidget(Form)
        self.formatList.setObjectName("formatList")
        self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
        self.exportBtn = QtGui.QPushButton(Form)
        self.exportBtn.setObjectName("exportBtn")
        self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
        self.closeBtn = QtGui.QPushButton(Form)
        self.closeBtn.setObjectName("closeBtn")
        self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
        self.paramTree = ParameterTree(Form)
        self.paramTree.setObjectName("paramTree")
        self.paramTree.headerItem().setText(0, "1")
        self.paramTree.header().setVisible(False)
        self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
        self.label_3 = QtGui.QLabel(Form)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
        self.copyBtn = QtGui.QPushButton(Form)
        self.copyBtn.setObjectName("copyBtn")
        self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(241, 367)
        self.gridLayout = QtGui.QGridLayout(Form)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtGui.QLabel(Form)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
        self.itemTree = QtGui.QTreeWidget(Form)
        self.itemTree.setObjectName("itemTree")
        self.itemTree.headerItem().setText(0, "1")
        self.itemTree.header().setVisible(False)
        self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
        self.label_2 = QtGui.QLabel(Form)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
        self.formatList = QtGui.QListWidget(Form)
        self.formatList.setObjectName("formatList")
        self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
        self.exportBtn = QtGui.QPushButton(Form)
        self.exportBtn.setObjectName("exportBtn")
        self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
        self.closeBtn = QtGui.QPushButton(Form)
        self.closeBtn.setObjectName("closeBtn")
        self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
        self.paramTree = ParameterTree(Form)
        self.paramTree.setObjectName("paramTree")
        self.paramTree.headerItem().setText(0, "1")
        self.paramTree.header().setVisible(False)
        self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
        self.label_3 = QtGui.QLabel(Form)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
        self.copyBtn = QtGui.QPushButton(Form)
        self.copyBtn.setObjectName("copyBtn")
        self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:KicadSolderTool    作者:pioupus    | 项目源码 | 文件源码
def __init__(self, parent):
        QtGui.QTreeWidget.__init__(self, parent)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QTreeWidget.__init__(self, parent)

        self.setColumnCount(2)
        self.setItemsExpandable(True)
        self.setSortingEnabled(False)
        self.setHeaderLabels(['Object', 'Layer'])
        self.setFrameShape(QtGui.QFrame.NoFrame)
        self.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.setStyleSheet('''
            QTreeWidget QHeaderView
            {
                border:0px;
            }
            QTreeWidget
            {
                border: 1px solid #9EB6CE;
                border-top:0px;
            }
            QTreeWidget QHeaderView::section
            {
                color:#4C4161;
                font-size:12px;
                border:1px solid #9EB6CE;
                border-left:0px;
                padding:5px;
            }
        ''')
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QTreeWidget.__init__(self, parent)
        #
        self.Sockets = []
        self.sql = None
        #
        self.setColumnCount(2)
        self.setHeaderLabels([u"Name", u"Description"])
        self.setSortingEnabled(True)
        self.checkItems = True
项目:android_malware_detection    作者:congyuandong    | 项目源码 | 文件源码
def setupEmptyTree(self):
        '''Setup empty Tree at startup. '''
        if hasattr(self, "tree"):
            del self.tree
        self.tree = QtGui.QTreeWidget(self)
        self.tree.header().close()
项目:android_malware_detection    作者:congyuandong    | 项目源码 | 文件源码
def setupEmptyTree(self):
        '''Setup empty Tree at startup. '''
        if hasattr(self, "tree"):
            del self.tree
        self.tree = QtGui.QTreeWidget(self)
        self.tree.header().close()
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def generateJobList(self):
        self._jobList = QtGui.QTreeWidget()
        self._jobList.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
        self._jobList.setSortingEnabled(True)
        self._jobList.setRootIsDecorated(False)

        header = self._jobList.headerItem()
        for i,item in enumerate(["priority","name","user","status"]):
            header.setText(i,item)

        self.refreshJobList()
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]
项目:DroidWatcher    作者:suemi994    | 项目源码 | 文件源码
def setupEmptyTree(self):
        '''Setup empty Tree at startup. '''
        if hasattr(self, "tree"):
            del self.tree
        self.tree = QtGui.QTreeWidget(self)
        self.tree.header().close()
项目:DroidWatcher    作者:suemi994    | 项目源码 | 文件源码
def setupEmptyTree(self):
        '''Setup empty Tree at startup. '''
        if hasattr(self, "tree"):
            del self.tree
        self.tree = QtGui.QTreeWidget(self)
        self.tree.header().close()
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def tabModels(self):
        tab = QtGui.QWidget()

        # table
        self.modelsTable = QtGui.QTreeWidget()
        #self.modelsTable.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
        self.modelsTable.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.modelsTable.setHeaderLabels([u'Name', u'Description', u'Paths', u'Softwares'])
        self.modelsTable.setStyleSheet('''
            QTreeWidget {border:0px solid #FFF;}
        ''')
        self.connect(self.modelsTable, QtCore.SIGNAL("itemPressed (QTreeWidgetItem*,int)"), self.showInfoF)
        # buttons
        selectAll = QtGui.QPushButton()
        selectAll.setFlat(True)
        selectAll.setToolTip('Select all')
        selectAll.setIcon(QtGui.QIcon(":/data/img/checkbox_checked_16x16.png"))
        selectAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''')
        self.connect(selectAll, QtCore.SIGNAL("clicked()"), self.selectAllModels)

        unselectAll = QtGui.QPushButton()
        unselectAll.setFlat(True)
        unselectAll.setToolTip('Deselect all')
        unselectAll.setIcon(QtGui.QIcon(":/data/img/checkbox_unchecked_16x16.PNG"))
        unselectAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''')
        self.connect(unselectAll, QtCore.SIGNAL("clicked()"), self.unselectAllModels)

        collapseAll = QtGui.QPushButton()
        collapseAll.setFlat(True)
        collapseAll.setToolTip('Collapse all')
        collapseAll.setIcon(QtGui.QIcon(":/data/img/collapse.png"))
        collapseAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''')
        self.connect(collapseAll, QtCore.SIGNAL("clicked()"), self.modelsTable.collapseAll)

        expandAll = QtGui.QPushButton()
        expandAll.setFlat(True)
        expandAll.setToolTip('Expand all')
        expandAll.setIcon(QtGui.QIcon(":/data/img/expand.png"))
        expandAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''')
        self.connect(expandAll, QtCore.SIGNAL("clicked()"), self.modelsTable.expandAll)
        # info
        self.showInfo = QtGui.QLabel('')
        self.showInfo.setStyleSheet('border:1px solid rgb(237, 237, 237); padding:5px 2px;')

        # main lay
        layTableButtons = QtGui.QHBoxLayout()
        layTableButtons.addWidget(selectAll)
        layTableButtons.addWidget(unselectAll)
        layTableButtons.addWidget(collapseAll)
        layTableButtons.addWidget(expandAll)
        layTableButtons.addStretch(10)

        lay = QtGui.QGridLayout(tab)
        lay.addLayout(layTableButtons, 0, 0, 1, 1)
        lay.addWidget(self.modelsTable, 1, 0, 1, 1)
        lay.addWidget(self.showInfo, 2, 0, 1, 1)
        lay.setRowStretch(1, 10)
        lay.setColumnStretch(0, 10)
        lay.setContentsMargins(5, 5, 5, 5)

        return tab
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def __init__(self, parent=None, mode=0):
        QtWidgets.QMainWindow.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = '0.1'
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'

        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']
        self.memoData['last_export'] = ''
        self.memoData['last_import'] = ''
        self.name = self.__class__.__name__
        self.location = ''
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)

        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)

        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {}
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = "0.1"
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'

        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']
        self.memoData['last_export'] = ''
        self.memoData['last_import'] = ''
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__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)

        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {}
        #------------------------------
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
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(sys.modules[self.__class__.__module__].__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)

        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        self.qui_user_dict = {}
        #------------------------------
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def qui(self, ui_list_string, parentObject_string='', opt=''):
        # pre-defined user short name syntax
        type_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        # get ui_list, creation or existing ui object
        ui_list = [x.strip() for x in ui_list_string.split('|')]
        for i in range(len(ui_list)):
            if ui_list[i] in self.uiList:
                # - exisiting object
                ui_list[i] = self.uiList[ui_list[i]]
            else:
                # - string creation: 
                # get part info
                partInfo = ui_list[i].split(';',1)
                uiName = partInfo[0].split('@')[0]
                uiType = uiName.rsplit('_',1)[-1]
                if uiType in type_dict:
                    uiType = type_dict[uiType]
                # set quickUI string format
                ui_list[i] = partInfo[0]+';'+uiType
                if len(partInfo)==1:
                    # give empty button and label a place holder name
                    if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'):
                        ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName 
                elif len(partInfo)==2:
                    ui_list[i]=ui_list[i]+";"+partInfo[1]
        # get parentObject or exisiting object
        parentObject = parentObject_string
        if parentObject in self.uiList:
            parentObject = self.uiList[parentObject]
        # process quickUI
        self.quickUI(ui_list, parentObject, opt)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def qui(self, ui_list_string, parentObject_string='', opt=''):
        # pre-defined user short name syntax
        type_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        # get ui_list, creation or existing ui object
        ui_list = [x.strip() for x in ui_list_string.split('|')]
        for i in range(len(ui_list)):
            if ui_list[i] in self.uiList:
                # - exisiting object
                ui_list[i] = self.uiList[ui_list[i]]
            else:
                # - string creation: 
                # get part info
                partInfo = ui_list[i].split(';',1)
                uiName = partInfo[0].split('@')[0]
                uiType = uiName.rsplit('_',1)[-1]
                if uiType in type_dict:
                    uiType = type_dict[uiType]
                # set quickUI string format
                ui_list[i] = partInfo[0]+';'+uiType
                if len(partInfo)==1:
                    # give empty button and label a place holder name
                    if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'):
                        ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName 
                elif len(partInfo)==2:
                    ui_list[i]=ui_list[i]+";"+partInfo[1]
        # get parentObject or exisiting object
        parentObject = parentObject_string
        if parentObject in self.uiList:
            parentObject = self.uiList[parentObject]
        # process quickUI
        self.quickUI(ui_list, parentObject, opt)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = "0.1"
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'

        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']
        self.memoData['last_export'] = ''
        self.memoData['last_import'] = ''
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__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)

        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {}
        #------------------------------
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def buildTreeA(self,*args):
        if self.selShot and self.selScript:
            tree=''
            if self.bottomTab.currentIndex()==0:
                tree=self.RendersInTreeA
            if self.bottomTab.currentIndex()==1:
                tree=self.RendersOutTreeA
            if self.bottomTab.currentIndex()<2:    
                tree.clear()

                projectPath=self.template_nukeScriptPath.replace("shotNum",self.selShot)
                nukeFile=projectPath+"/"+self.selScript
                seqs=getNukeScriptSeqs(nukeFile,self.searchDir3D)
                #remove incoming from paths
                pathsOnly=[]
                for seq in seqs:
                    #only list beauty files
                    #if "beauty" in seq:
                    pathsOnly.append(filterPath(seq,self.searchDir3D))

                pathTree=buildTreeFromPaths(pathsOnly)
                #build Tree
                dicts=[[pathTree,tree]]
                for dict,parent in dicts:
                    for k in dict.keys():
                        item=QtGui.QTreeWidgetItem()
                        item.setText(0,k)
                        if type(parent) is QtGui.QTreeWidget:
                            if not item.text(0)=='<files>':
                                tree.insertTopLevelItem(0,item)
                        if type(parent) is QtGui.QTreeWidgetItem:
                            if not item.text(0)=='<files>':
                                parent.addChild(item)
                        if type(dict[k]) is collections.defaultdict:
                            dicts.append([dict[k],item])
                            #print "found dict",k
                        if type(dict[k]) is list and type(parent) is not QtGui.QTreeWidget:
                            for i in dict[k]:
                                item=QtGui.QTreeWidgetItem()
                                item.setText(0,i)
                                parent.addChild(item)
                tree.sortItems(0,QtCore.Qt.AscendingOrder)
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def __init__(self, parent=None):
        self.publishData={}
        self.publishItems=[]
        self.selection=[]
        self.localDrive="E:"

        QtGui.QWidget.__init__(self, parent)
        #TreeA_Buttons
        self.PublishesHLayout = QtGui.QHBoxLayout()
        self.setLayout(self.PublishesHLayout)
        self.PublishesButtonsVLayout=QtGui.QVBoxLayout()
        #ServerRendersTree
        self.publishesTree = QtGui.QTreeWidget()
        self.publishesTree.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        self.publishesTree.setObjectName("publishesTree")
        item=QtGui.QTreeWidgetItem()
        item.setText(0,"Publishes:")
        item.setText(1,"serverFrames:")
        item.setText(2,"localFrames:")
        self.publishesTree.setHeaderItem(item)
        self.publishesTree.setColumnCount(3)
        self.publishesTree.resizeColumnToContents(0)
        self.publishesTree.resizeColumnToContents(1)
        self.PublishesHLayout.addWidget(self.publishesTree)
        #frame widgets
        self.renderLocation = QtGui.QComboBox()
        self.renderLocation.insertItems(0,["server","local"])
        self.PublishesButtonsVLayout.addWidget(self.renderLocation)
        self.frameNthSize=QtGui.QLineEdit()
        self.frameNthSize.setText("10")
        self.PublishesButtonsVLayout.addWidget(self.frameNthSize)
        self.frameRange=QtGui.QLineEdit()
        self.frameRange.setText("")
        self.PublishesButtonsVLayout.addWidget(self.frameRange)
        self.phoneLabel = QtGui.QLabel()
        self.phoneLabel.setText("chunkSize")
        self.phoneLabel.setBuddy(self.frameNthSize)
        self.frameNthSize.setMaximumWidth(100)
        self.frameRange.setMaximumWidth(100)
        #TreeB_Buttons
        publishesTreeBtns = [
            ["print path", self.printPaths],
            ["copy local", self.copyLocal],
            ["printDependents", self.printDependentAovs],
            ["compareFiles", self.compareFiles],
            ["copyAllNodes", self.copyAllNodes],
        ]
        for btn in publishesTreeBtns:
            pushBtn = QtGui.QPushButton()
            pushBtn.setText(btn[0])
            pushBtn.clicked.connect(btn[1])
            self.PublishesButtonsVLayout.addWidget(pushBtn)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.PublishesButtonsVLayout.addItem(spacerItem)
        self.PublishesHLayout.addLayout(self.PublishesButtonsVLayout)

        self.getShotgunPublishes()
        self.buildTree()
        self.renderLocation.currentIndexChanged.connect(self.switchFilepaths)
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def __init__(self, parent=None):
        self.publishData={}
        self.publishItems=[]
        self.selection=[]
        self.localDrive="D:"

        QtGui.QWidget.__init__(self, parent)
        #TreeA_Buttons
        self.PublishesHLayout = QtGui.QHBoxLayout()
        self.setLayout(self.PublishesHLayout)
        self.PublishesButtonsVLayout=QtGui.QVBoxLayout()
        #ServerRendersTree
        self.publishesTree = QtGui.QTreeWidget()
        self.publishesTree.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        self.publishesTree.setObjectName("publishesTree")
        item=QtGui.QTreeWidgetItem()
        item.setText(0,"Publishes:")
        item.setText(1,"serverFrames:")
        item.setText(2,"localFrames:")
        self.publishesTree.setHeaderItem(item)
        self.publishesTree.setColumnCount(3)
        self.publishesTree.resizeColumnToContents(0)
        self.publishesTree.resizeColumnToContents(1)
        self.PublishesHLayout.addWidget(self.publishesTree)
        #frame widgets
        self.renderLocation = QtGui.QComboBox()
        self.renderLocation.insertItems(0,["server","local"])
        self.PublishesButtonsVLayout.addWidget(self.renderLocation)
        self.frameNthSize=QtGui.QLineEdit()
        self.frameNthSize.setText("10")
        self.PublishesButtonsVLayout.addWidget(self.frameNthSize)
        self.frameRange=QtGui.QLineEdit()
        self.frameRange.setText("")
        self.PublishesButtonsVLayout.addWidget(self.frameRange)
        self.phoneLabel = QtGui.QLabel()
        self.phoneLabel.setText("chunkSize")
        self.phoneLabel.setBuddy(self.frameNthSize)
        self.frameNthSize.setMaximumWidth(100)
        self.frameRange.setMaximumWidth(100)
        #TreeB_Buttons
        publishesTreeBtns = [
            ["print path", self.printPaths],
            ["copy local", self.copyLocal],
            ["printDependents", self.printDependentAovs],
            ["compareFiles", self.compareFiles],
            ["copyAllNodes", self.copyAllNodes],
        ]
        for btn in publishesTreeBtns:
            pushBtn = QtGui.QPushButton()
            pushBtn.setText(btn[0])
            pushBtn.clicked.connect(btn[1])
            self.PublishesButtonsVLayout.addWidget(pushBtn)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.PublishesButtonsVLayout.addItem(spacerItem)
        self.PublishesHLayout.addLayout(self.PublishesButtonsVLayout)

        self.getShotgunPublishes()
        self.buildTree()
        self.renderLocation.currentIndexChanged.connect(self.switchFilepaths)