Ejemplo n.º 1
0
class SelectNodes(QDialog,  UiSelectNodes):
    def __init__(self,  parent):
        QDialog.__init__(self,  parent)
        UiSelectNodes.__init__(self)
        self.setupUi(self)
        self.vfs = vfs.vfs()
        self.g_display()
        self.initCallback()
        
    def g_display(self):
        self.comboBoxPath = NodeComboBox(self)
        self.comboBoxPath.setMinimumSize(QSize(251, 23))
        self.comboBoxPath.setMaximumSize(QSize(16777215, 23))
        
        self.modelNodes = SelectNodesModel()
        self.listViewer = SelectNodesListView(self)
        self.listViewer.setModel(self.modelNodes)
        
        self.hboxlayout.insertWidget(1, self.comboBoxPath)
        self.vboxlayout.insertWidget(1, self.listViewer)
        
        icon = QIcon(":top.png")
        self.topButton.setIcon(icon)
        
    def initCallback(self):
        self.connect(self.topButton, SIGNAL("clicked()"),  self.moveToTop)
        self.connect(self.comboBoxPath, SIGNAL("currentIndexChanged(const QString & )"),  self.comboBoxPathChanged)
    
    def moveToTop(self):
        self.displayDirectory(self.modelNodes.currentNode.parent)
    
    def comboBoxPathChanged(self, text):
        node = self.comboBoxPath.currentNode()
        self.displayDirectory(node)
    
    def displayDirectory(self, node):
        listNode = self.vfs.listingDirectoriesAndFiles(node)
        self.comboBoxPath.addPathAndSelect(node)
        self.modelNodes.newPath(node, listNode)
        
        self.currentSelectionEdit.clear()
    
    def returnSelection(self):
        index = self.listViewer.currentIndex()
        item = self.modelNodes.itemFromIndex(index)
        if item is None :
            return None
        return item.node
        
    def changeLineEdit(self, node):
        self.currentSelectionEdit.clear()
        self.currentSelectionEdit.insert(node.name)
Ejemplo n.º 2
0
 def g_display(self):
     self.comboBoxPath = NodeComboBox(self)
     self.comboBoxPath.setMinimumSize(QSize(251, 23))
     self.comboBoxPath.setMaximumSize(QSize(16777215, 23))
     
     self.modelNodes = SelectNodesModel()
     self.listViewer = SelectNodesListView(self)
     self.listViewer.setModel(self.modelNodes)
     
     self.hboxlayout.insertWidget(1, self.comboBoxPath)
     self.vboxlayout.insertWidget(1, self.listViewer)
     
     icon = QIcon(":top.png")
     self.topButton.setIcon(icon)