def add(self): dialog = DirExplorer(treefilter=QDir.NoDotAndDotDot | QDir.AllDirs | QDir.Hidden, startPath="/", parent=self) if dialog.exec_(): addsource = True removesources = False selection = dialog.getselection() for source in self.configObj.getsources(): if source in selection: addsource = False quickNote = QMessageBox() quickNote.setText("Path not added as parent directory already a source") quickNote.setInformativeText("Parent path:%s" % source) quickNote.exec_() break elif selection in source: quickNote = QMessageBox() reply = QMessageBox.question(self, "Check sources", "Some of the current sources are under `%s' directory. Do you want to remove them from the list?" % dialog.getselection(), QMessageBox.Abort|QMessageBox.No|QMessageBox.Yes) if reply == QMessageBox.Yes: removesources = True elif reply == QMessageBox.Abort: addsource = False break if removesources: for row in range(self.listWidget.count()): item = self.listWidget.item(row) if selection == str(item.text())[0:len(selection)]: self.configObj.removesource(str(item.text())) item = self.listWidget.takeItem(row) del item if addsource: self.listWidget.addItem(selection) self.configObj.addsource(selection)
def updatedest(self): current = str(self.destination.text()) dialog = DirExplorer(currentSelection=current, parent=self) if dialog.exec_(): self.configObj.setdestination(dialog.getselection()) self.destination.setText(self.configObj.getdestination())