コード例 #1
0
        def g_display(self):
            self.layout = QHBoxLayout(self)

            # Browser
            tmp = ["Virtual File System"]
            self.treeItemModel = TreeItemModel(tmp)
            self.treeView = TreeView(self, self.__mainWindow,
                                     self.treeItemModel)

            self.layout.addWidget(self.treeView)

            # Set Model and Resize
            self.treeView.setModel(self.treeItemModel)

            self.treeItemModel.addRootVFS()
            self.treeItemModel.fillAllDirectory(self.treeItemModel.rootItemVFS)
            self.treeItemModel.reset()
            self.treeView.resizeAllColumn()
            self.treeView.setCurrentIndex(
                self.treeItemModel.createIndex(
                    self.treeItemModel.rootItemVFS.childNumber(), 0,
                    self.treeItemModel.rootItemVFS))
コード例 #2
0
ファイル: nodetree.py プロジェクト: alepee/dff
        def g_display(self):
            self.layout = QHBoxLayout(self)
            
            # Browser 
            tmp = ["Virtual File System"]
            self.treeItemModel = TreeItemModel(tmp)
            self.treeView = TreeView(self, self.__mainWindow, self.treeItemModel)

            self.layout.addWidget(self.treeView)
            
            # Set Model and Resize
            self.treeView.setModel(self.treeItemModel)
            
            self.treeItemModel.addRootVFS()
            self.treeItemModel.fillAllDirectory(self.treeItemModel.rootItemVFS)
            self.treeItemModel.reset()
            self.treeView.resizeAllColumn()
            self.treeView.setCurrentIndex(self.treeItemModel.createIndex(self.treeItemModel.rootItemVFS.childNumber(), 0,  self.treeItemModel.rootItemVFS))
コード例 #3
0
    class __NodeTree(QWidget):
        def __init__(self, mainWindow):
            QWidget.__init__(self, mainWindow)
            self.__mainWindow = mainWindow
            #self.__action = action
            self.sched = scheduler.sched
            self.vfs = VFS.Get()

            self.__listFiles = []
            self.childSelected = None
            self.childSelectedLock = QReadWriteLock()

            self.configure()
            self.g_display()
            self.initCallback()

        def configure(self):
            self.setObjectName("Browser")
            self.resize(300, 300)

        def g_display(self):
            self.layout = QHBoxLayout(self)

            # Browser
            tmp = ["Virtual File System"]
            self.treeItemModel = TreeItemModel(tmp)
            self.treeView = TreeView(self, self.__mainWindow,
                                     self.treeItemModel)

            self.layout.addWidget(self.treeView)

            # Set Model and Resize
            self.treeView.setModel(self.treeItemModel)

            self.treeItemModel.addRootVFS()
            self.treeItemModel.fillAllDirectory(self.treeItemModel.rootItemVFS)
            self.treeItemModel.reset()
            self.treeView.resizeAllColumn()
            self.treeView.setCurrentIndex(
                self.treeItemModel.createIndex(
                    self.treeItemModel.rootItemVFS.childNumber(), 0,
                    self.treeItemModel.rootItemVFS))

        def initCallback(self):
            self.connect(self, SIGNAL("refreshNodeView"), self.refreshNodeView)
            self.sched.set_callback("refresh_tree", self.refreshNode)
            self.vfs.set_callback("refresh_tree", self.refreshNode)

        def refreshNode(self, node):
            index = self.treeView.currentIndex()
            isExpanded = self.treeView.isExpanded(index)
            item = self.treeItemModel.getItemWithPath(node.absolute())
            self.treeItemModel.fillAllDirectory(self.treeItemModel.rootItemVFS)
            self.treeItemModel.reset()
            self.emit(SIGNAL("refreshNodeView"), index, isExpanded)
            self.emit(SIGNAL("reloadNodeView"))

        def refreshNodeView(self, index, isExpanded):
            self.treeView.expandAllIndex(index)
            self.treeView.setCurrentIndex(index)
            self.treeView.setExpanded(index, isExpanded)

        def setChild(self, child):
            if self.childSelectedLock.tryLockForWrite():
                self.childSelected = child
                self.childSelectedLock.unlock()

        def getChild(self):
            if self.childSelectedLock.tryLockForRead():
                tmp = self.childSelected
                self.childSelectedLock.unlock()
                return tmp

        def addList(self):
            dockList = DockNodeList(self.__mainWindow, self,
                                    len(self.__listFiles))
            self.__listFiles.append(dockList)
            self.__mainWindow.addNewDockWidgetTab(Qt.RightDockWidgetArea,
                                                  dockList)
            dockList.initContents(self.treeView.getCurrentItem().node,
                                  self.treeView.currentIndex())
            return dockList
コード例 #4
0
ファイル: nodetree.py プロジェクト: alepee/dff
    class __NodeTree(QWidget):
        def __init__(self, mainWindow):
            QWidget.__init__(self, mainWindow)
            self.__mainWindow = mainWindow
            #self.__action = action
            self.sched = scheduler.sched
	    self.vfs = VFS.Get()            

            self.__listFiles = []
            self.childSelected = None
            self.childSelectedLock = QReadWriteLock()
        
            self.configure()
            self.g_display()
            self.initCallback()
        
        def configure(self):
            self.setObjectName("Browser")
            self.resize(300, 300)
            
        def g_display(self):
            self.layout = QHBoxLayout(self)
            
            # Browser 
            tmp = ["Virtual File System"]
            self.treeItemModel = TreeItemModel(tmp)
            self.treeView = TreeView(self, self.__mainWindow, self.treeItemModel)

            self.layout.addWidget(self.treeView)
            
            # Set Model and Resize
            self.treeView.setModel(self.treeItemModel)
            
            self.treeItemModel.addRootVFS()
            self.treeItemModel.fillAllDirectory(self.treeItemModel.rootItemVFS)
            self.treeItemModel.reset()
            self.treeView.resizeAllColumn()
            self.treeView.setCurrentIndex(self.treeItemModel.createIndex(self.treeItemModel.rootItemVFS.childNumber(), 0,  self.treeItemModel.rootItemVFS))
            
        def initCallback(self):
            self.connect(self, SIGNAL("refreshNodeView"), self.refreshNodeView) 
            self.sched.set_callback("refresh_tree", self.refreshNode)
	    self.vfs.set_callback("refresh_tree", self.refreshNode)       
 
        def refreshNode(self, node):
            index = self.treeView.currentIndex()
            isExpanded = self.treeView.isExpanded(index)
            item = self.treeItemModel.getItemWithPath(node.absolute())
            self.treeItemModel.fillAllDirectory(self.treeItemModel.rootItemVFS)
            self.treeItemModel.reset()
            self.emit(SIGNAL("refreshNodeView"), index, isExpanded)
            self.emit(SIGNAL("reloadNodeView"))
            
        def refreshNodeView(self, index, isExpanded):
            self.treeView.expandAllIndex(index)
            self.treeView.setCurrentIndex(index)
            self.treeView.setExpanded(index, isExpanded)
        
        def setChild(self, child):
            if self.childSelectedLock.tryLockForWrite() :
                self.childSelected = child
                self.childSelectedLock.unlock()
        
        def getChild(self):
            if self.childSelectedLock.tryLockForRead():
                tmp = self.childSelected
                self.childSelectedLock.unlock()
                return tmp
        
        def addList(self):
            dockList = DockNodeList(self.__mainWindow, self, len(self.__listFiles))
            self.__listFiles.append(dockList)
            self.__mainWindow.addNewDockWidgetTab(Qt.RightDockWidgetArea, dockList)
            dockList.initContents(self.treeView.getCurrentItem().node, self.treeView.currentIndex())
            return dockList