def insertBlock(self, block, index=-1): if index < 0: index = self.count() item = BlockItem() if block.__class__.__name__ == 'BreakPoint': item.setSizeHint(QtCore.QSize(50, 40)) opWidget = block_widgets.BreakPointWidget(block, item) else: item.setSizeHint(QtCore.QSize(50, 80)) opWidget = block_widgets.BlockWidget(block, item) opWidget.runBlockSignal.connect(self.runBlockCallback) opWidget.itemDeleted.connect(self.deleteBlock) item.widget, opWidget.item = opWidget, item mainWindow = getMainWindow(self) opWidget.nameEdited.connect(mainWindow.editorDock.setWindowTitle) self.insertItem(index, item) self.builder.insertBlock(block, index=index) self.setItemWidget(item, opWidget) self.clearSelection() item.setSelected(True) self.itemOrderChanged.emit() return item
class BaseBlockWidget(QtWidgets.QWidget): itemDeleted = QtCore.Signal(object) activeStateEdited = QtCore.Signal(bool) nameEdited = QtCore.Signal(str) runBlockSignal = QtCore.Signal(object) def __init__(self, block, item, parent=None): super(BaseBlockWidget, self).__init__(parent=parent) self.editorWidget = None self.deleteButton = None self.activeCheckBox = None self.blockNameField = None self.block = block self.item = item self._headerStyleSheet = None def _connectSignals(self): self.deleteButton.clicked.connect(self.delete) self.activeCheckBox.clicked.connect(self.switchActiveState) self.blockNameField.editingFinished.connect(self.blockNameFieldEdited) self.blockNameField.returnPressed.connect(self.blockNameFieldEdited) def delete(self): self.itemDeleted.emit(self.block) item = self.item lw = item.listWidget() idx = lw.indexFromItem(item).row() lw.takeItem(idx) def switchActiveState(self): currState = self.activeCheckBox.isChecked() self.setEnableDisplay(currState) self.syncData() self.activeStateEdited.emit(currState) def blockNameFieldEdited(self): self.blockNameField.clearFocus() val = self.blockNameField.getValue() self.syncData() self.nameEdited.emit(val) def switchIndicator(self, state): return def syncData(self): return def currentName(self): return self.blockNameField.getValue()
def _initUI(self): layout = VBoxLayout(self) layout.setContentsMargins(2, 0, 2, 0) with layout: mainLayout = qcreate(HBoxLayout) mainLayout.setContentsMargins(0, 0, 0, 0) with mainLayout: self.indicatorWidget = qcreate(QtWidgets.QStackedWidget) self.indicatorWidget.setFixedWidth(15) self.nothing = qcreate(QtWidgets.QLabel) self.indicatorWidget.addWidget(self.nothing) self.frame = qcreate(QtWidgets.QFrame, layoutType=HBoxLayout) self.frame.layout().setContentsMargins(0, 0, 0, 0) with self.frame.layout(): self.activeCheckBox = qcreate(Checkbox) self.blockType = qcreate(QtWidgets.QLabel, "Break Point") self.blockNameField = qcreate(StringField) self.blockNameField.setHidden(True) qcreate(Spacer) with qcreate(VBoxLayout): icon = IconManager.get("delete.svg", type="icon") self.deleteButton = qcreate(Button, "", icon=icon) self.deleteButton.setFixedSize(QtCore.QSize(15, 15)) qcreate(SeparatorLine) # self.setEnableDisplay(True) self.activeCheckBox.setValue(self.block.active) self.setEnableDisplay(self.block.active)
def __init__(self, itemData, parentWidget=None): super(AttrItem, self).__init__() self.signal = ItemEditSignal() self.setSizeHint(1, QtCore.QSize(100, 30)) self.parentWidget = parentWidget attrName, (attrType, defaultValue) = itemData if isinstance(attrType, (str, unicode)): attrType = attr_type.getTypeFromName(attrType) self.attrType = attrType self.setText(0, attrName) self.setTextAlignment(0, QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.fieldWidget = attrField.AttrFieldMaker.create(attrType) if defaultValue is not None and defaultValue != '': self.fieldWidget.setValue(defaultValue) # mainWindow = getMainWindow(self.parentWidget) # if isinstance(parentWidget, HeaderWidget): self.fieldWidget.editFinished.connect(self.emitSignal)
class AttrField(object): editFinished = QtCore.Signal() @property def sizePolicy(self): return QtCore.QSizePolicy(QtCore.QSizePolicy.Preferred, QtCore.QSizePolicy.Fixed) def emitSignal(self): self.editFinished.emit()
class SaveBlueprintDialog(BaseSaveLoadDialog): saveSignalled = QtCore.Signal(tuple) def __init__(self, parentDialog): super(SaveBlueprintDialog, self).__init__(parentDialog=parentDialog) def initUI(self): super(SaveBlueprintDialog, self).initUI() self.saveButton = QtWidgets.QPushButton('Save') self.actionButtonLayout.addWidget(self.saveButton) self.cancelButton = QtWidgets.QPushButton('Cancel') self.actionButtonLayout.addWidget(self.cancelButton) def initSignals(self): super(SaveBlueprintDialog, self).initSignals() self.saveButton.clicked.connect(self.callSaveBlueprint) self.cancelButton.clicked.connect(self.close) self.blueprintTreeWidget.itemDoubleClicked.connect(self.callSaveBlueprint) self.blueprintNameField.returnPressed.connect(self.callSaveBlueprint) def callSaveBlueprint(self): baseDir = Path(self.baseDirField.text()) blueprintName = Path(self.blueprintNameField.text()) notes = self.notesField.toPlainText() or "" if not all([baseDir, blueprintName]): log.warn("please fill all input fields.") return if not blueprintName.endswith(BLUEPRINT_EXTENSION): blueprintName = blueprintName + BLUEPRINT_EXTENSION blueprintPath = baseDir / blueprintName if blueprintPath.exists(): confirm = QtWidgets.QMessageBox.question(None, 'Message', "file exists. overwrite?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No) if confirm == QtWidgets.QMessageBox.No: return if not baseDir.exists(): baseDir.makeDirs() log.info('saved blueprint path: {0}'.format(blueprintPath)) settings.addRecentBlueprint(blueprintPath) self.setting_file_updated_signal.emit() self.saveSignalled.emit((blueprintPath, notes)) # self.parentDialog.blueprintWidget.save(blueprintPath, notes) self.close()
class RenameAttrDialog(QtWidgets.QDialog): renamed_signal = QtCore.Signal(str) def __init__(self, *args, **kwargs): super(RenameAttrDialog, self).__init__(*args, **kwargs) layout = VBoxLayout(self) with layout: self.nameField = qcreate(StringField, label="attr name: ") self.okBtn = qcreate(Button, "Rename") self.okBtn.clicked.connect(self.emitRenameAttr) self.nameField.returnPressed.connect(self.emitRenameAttr) def emitRenameAttr(self): val = self.nameField.getValue() self.renamed_signal.emit(val) self.close()
def loadData(self): blueprintData = lib.loadData(self._filePath) or {} self._name = self._filePath.baseName() self._notes = blueprintData.get('notes', None) if self.isValid(): # column 0 self.setText(0, self._name) # column 1 self.setText(1, self._notes) # column 2 self.deleteButton = DeleteButton() self.deleteButton.clicked.connect(self.removeItem) self.setSizeHint(2, QtCore.QSize(15, 15))
def _populateBlocks(self): blockMap = lib.collectBlocksByCategory() with self.blockMenuLayout: qcreate(Spacer, mode="vertical") for category, blockClasses in blockMap.items(): gbox = qcreate(QtWidgets.QGroupBox, layoutType=VBoxLayout) gbox.setTitle(category) with gbox.layout(): lwidget = qcreate(BlockMenuListWidget) for blockClass in blockClasses: icon = IconManager.get(blockClass.ui_icon_name, type="icon") item = QtWidgets.QListWidgetItem( icon, blockClass.__name__) item.blockClass = blockClass item.setSizeHint(QtCore.QSize(100, 30)) lwidget.addItem(item) qcreate(Spacer, mode="vertical")
class AddAttrDialog(QtWidgets.QDialog): title = "Add Attr" attrAdded = QtCore.Signal(dict) def __init__(self, parent=None): super(AddAttrDialog, self).__init__(parent=parent) self.setWindowTitle(self.title) layout = VBoxLayout(self) with layout: self.attrNameInput = qcreate(StringField, label="Attr Name: ") with qcreate(HBoxLayout): qcreate(QtWidgets.QLabel, "Attr Type: ") self.fieldWidget = qcreate(attrField.AttrTypeChooser) with qcreate(HBoxLayout): qcreate(Spacer, mode="horizontal") buttonBox = qcreate(QtWidgets.QDialogButtonBox) self.addButton = buttonBox.addButton( "Add", QtWidgets.QDialogButtonBox.AcceptRole) self.addButton.clicked.connect(self._addAttr) def _addAttr(self): attrName = self.attrNameInput.getValue() if not attrName: log.warn("please fill the attribute name.") return attrField = self.fieldWidget.getData() attrType = attrField.attrType defaultValue = None data = {} data['name'], data['type'], data[ 'value'] = attrName, attrType, defaultValue self.attrAdded.emit(data) self.close()
class ScriptEditor(QtWidgets.QDialog): scriptAccepted = QtCore.Signal(unicode) def __init__(self, script=None): super(ScriptEditor, self).__init__() self.initUI() self.initSignal() if script: self.loadScript(script) def initUI(self): self.setWindowTitle('Script Editor') layout = VBoxLayout(self) with layout: self.editor = qcreate(PythonTextEditor) with qcreate(HBoxLayout) as hlayout: icon = IconManager.get("save.png", type='icon') self.setBtn = qcreate(Button, 'Save', icon=icon) self.cancelBtn = qcreate(Button, 'Cancel') hlayout.setRatio(2, 1) layout.setRatio(1, 0) self.resize(800, 800) def initSignal(self): self.cancelBtn.clicked.connect(self.close) self.setBtn.clicked.connect(self.acceptEdit) def loadScript(self, script): self.editor.setPlainText(script) def acceptEdit(self): currentScript = self.editor.getCurrentText() self.scriptAccepted.emit(currentScript) self.close()
class LoadBlueprintDialog(BaseSaveLoadDialog): load_signal = QtCore.Signal(unicode) def initUI(self): super(LoadBlueprintDialog, self).initUI() self.blueprintNameLabel.setParent(None) self.blueprintNameField.setParent(None) self.notesField.setParent(None) self.notesLabel.setParent(None) self.loadButton = QtWidgets.QPushButton('Load') self.actionButtonLayout.addWidget(self.loadButton) self.cancelButton = QtWidgets.QPushButton('Cancel') self.actionButtonLayout.addWidget(self.cancelButton) def initSignals(self): super(LoadBlueprintDialog, self).initSignals() self.loadButton.clicked.connect(self.callLoadBlueprint) self.cancelButton.clicked.connect(self.close) self.blueprintTreeWidget.itemDoubleClicked.connect(self.callLoadBlueprint) def callLoadBlueprint(self): baseDir = Path(self.baseDirField.text()) selectedBlueprint = self.blueprintTreeWidget.currentItem() fileName = selectedBlueprint.name filePath = baseDir / fileName settings.addRecentBlueprint(filePath) self.setting_file_updated_signal.emit() self.load_signal.emit(filePath) self.close()
def _initUI(self): layout = VBoxLayout(self) layout.setContentsMargins(2, 0, 2, 0) with layout: mainLayout = qcreate(HBoxLayout) mainLayout.setContentsMargins(0, 0, 0, 0) with mainLayout: self.indicatorWidget = qcreate(QtWidgets.QStackedWidget) self.indicatorWidget.setFixedWidth(15) self.nothing = qcreate(QtWidgets.QLabel) self.nothing.setStyleSheet( 'background-color:rgb(126, 126, 126)') self.success = qcreate(QtWidgets.QLabel) self.success.setStyleSheet('background-color:rgb(52, 141, 3)') self.fail = qcreate(QtWidgets.QLabel) self.fail.setStyleSheet('background-color:rgb(149, 0, 2)') self.next = qcreate(QtWidgets.QLabel) self.next.setStyleSheet('background-color:rgb(244, 244, 0)') self.indicatorWidget.addWidget(self.nothing) self.indicatorWidget.addWidget(self.success) self.indicatorWidget.addWidget(self.fail) self.indicatorWidget.addWidget(self.next) # self.indicatorWidget.setCurrentIndex(1) self.frame = qcreate(QtWidgets.QFrame, layoutType=HBoxLayout) self.frame.layout().setContentsMargins(0, 0, 0, 0) with self.frame.layout(): self.activeCheckBox = qcreate(Checkbox) icon = IconManager.get(self.block.ui_icon_name, type="path") self.labelIcon = qcreate(Image, icon, w=15, h=15) self.blockTypeLabel = qcreate(QtWidgets.QLabel, "Block Type") self.blockNameField = qcreate(StringField) qcreate(Spacer) with qcreate(VBoxLayout): with qcreate(HBoxLayout): icon = IconManager.get("play.svg", type="icon") self.runBlockButton = qcreate(Button, icon, "") qcreate(QtWidgets.QLabel, " ") icon = IconManager.get("delete.svg", type="icon") self.deleteButton = qcreate(Button, "", icon=icon) self.deleteButton.setFixedSize(QtCore.QSize(15, 15)) # self.runBlockButton = qcreate(Button,">") # self.runBlockButton.setFixedWidth(20) # self.runBlockButton.setFixedHeight(60) qcreate(SeparatorLine) self.blockTypeLabel.setText("{} : ".format( self.block.__class__.__name__)) self.blockTypeLabel.setText("{} : ".format( self.block.__class__.__name__)) self.blockNameField.setValue(self.block.name) self.activeCheckBox.setValue(self.block.active) self.setEnableDisplay(self.block.active)
class EmittingStream(QtCore.QObject): textWritten = QtCore.Signal(str) def write(self, text): self.textWritten.emit(text)
class ItemEditSignal(QtCore.QObject): attrEdited = QtCore.Signal()
class AttrTree(QtWidgets.QTreeWidget): stylesheet = """ QTreeView { border: none; } """ _headers = ('attribute', 'value') attrEdited = QtCore.Signal() def __init__(self, parent=None): super(AttrTree, self).__init__(parent=parent) self._parent = parent self.setColumnCount(len(self._headers)) self.setHeaderLabels(self._headers) self.setStyleSheet(self.stylesheet) self.setAlternatingRowColors(True) def contextMenuEvent(self, event): self.menu = QtWidgets.QMenu() action = QtWidgets.QAction('add attr', self) action.triggered.connect(self.showAddAttrDialog) icon = IconManager.get("add.svg", type="icon") action.setIcon(icon) self.menu.addAction(action) action = QtWidgets.QAction('rename attr', self) action.triggered.connect(self.renameAttrDialog) icon = IconManager.get("edit.svg", type="icon") action.setIcon(icon) self.menu.addAction(action) action = QtWidgets.QAction('remove attr', self) action.triggered.connect(self.removeSelectedAttr) icon = IconManager.get("trashbin.svg", type="icon") action.setIcon(icon) self.menu.addAction(action) action = QtWidgets.QAction('copy attr', self) action.triggered.connect(self.copyAttr) icon = IconManager.get("copy.png", type="icon") action.setIcon(icon) self.menu.addAction(action) action = QtWidgets.QAction('paste attr', self) action.triggered.connect(self.pasteAttr) icon = IconManager.get("paste.png", type="icon") action.setIcon(icon) self.menu.addAction(action) self.menu.exec_(event.globalPos()) def copyAttr(self): item = self.currentItem() data = [] keyval = (item.getName(), (item.getType().__name__, item.getValue())) data.append(keyval) settings.dumpAttrs(data) self.emitSignal() def pasteAttr(self): attrData = settings.loadAttrs() for each in attrData: self.addAttr(each) self.emitSignal() def addAttr(self, attrData): attrItem = AttrItem(attrData, parentWidget=self) self.addTopLevelItem(attrItem) attrItem.setFlags(attrItem.flags() ^ QtCore.Qt.ItemIsSelectable) attrItem.setWidget() attrItem.signal.attrEdited.connect(self.emitSignal) if hasattr(self._parent, "sizeUp"): self._parent.sizeUp() def emitSignal(self): self.attrEdited.emit() def setAttr(self, key, val): for item in self.allItems(): if key == item.attrName: item.setValue(val) def allItems(self): items = [] for idx in range(self.topLevelItemCount()): item = self.topLevelItem(idx) items.append(item) return items def removeSelectedAttr(self): currItem = self.currentItem() if currItem: confirm = QtWidgets.QMessageBox.question( None, 'Message', "delete attribute {0} ?".format(currItem.attrName), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No) if confirm == QtWidgets.QMessageBox.Yes: self.removeAttr(currItem) self.emitSignal() def removeAttr(self, attrItem): idx = self.indexOfTopLevelItem(attrItem) self.takeTopLevelItem(idx) log.info('take attribute: {0}'.format(attrItem)) def renameAttrDialog(self): dialog = RenameAttrDialog() dialog.renamed_signal.connect(self.renameAttrCallback) dialog.exec_() def renameAttrCallback(self, newName): currItem = self.currentItem() currItem.setName(newName) self.emitSignal() def showAddAttrDialog(self): dialog = AddAttrDialog(parent=self) dialog.attrAdded.connect(self.attrAddedCallback) dialog.exec_() def attrAddedCallback(self, data): itemData = (data.get("name"), (data.get("type"), data.get("value"))) self.addAttr(itemData) self.emitSignal() def attrs(self): labels = [] for idx in range(self.topLevelItemCount()): item = self.topLevelItem(idx) labels.append(item.text(0)) return labels
def sizePolicy(self): return QtCore.QSizePolicy(QtCore.QSizePolicy.Preferred, QtCore.QSizePolicy.Fixed)
class BlockListWidget(QtWidgets.QListWidget): stylesheet = """ QListView::item {margin:0px; selection-background-color: rgb(60,60,60)}; } """ itemOrderChanged = QtCore.Signal() currentIndexSet = QtCore.Signal(int) def __init__(self, parent=None, blueprintWidget=None): super(BlockListWidget, self).__init__(parent=parent) self.blueprintWidget = blueprintWidget self.setDragDropMode(self.InternalMove) # self.setDragDropMode(self.DragDrop) self.setSelectionMode(self.ExtendedSelection) self.setStyleSheet(self.stylesheet) self.setAlternatingRowColors(True) self.contextMenu = ContextMenu(self) # self.contextMenu.addCommand("edit annotation", self.editAnnotationCallback) # self.contextMenu.addSeparator() icon = IconManager.get("copy.png", type="icon") self.contextMenu.addCommand("copy", self.copyBlock, icon=icon) icon = IconManager.get("paste.png", type="icon") self.contextMenu.addCommand("paste", self.pasteBlock, icon=icon) self.contextMenu.addSeparator() icon = IconManager.get("start_from_here.png", type="icon") self.contextMenu.addCommand("start from here", self.setNextToSelected, icon=icon) self._currItemRow = None @property def builder(self): return self.blueprintWidget.builder @property def blockWidgets(self): return [self.item(idx).widget for idx in range(self.count())] def duplicateSelected(self): copyIndex = self.copyBlock() inserted_indices = self.pasteBlock(index=copyIndex + 1) self.clearSelection() for idx in inserted_indices: self.item(idx).setSelected(True) def copyBlock(self): items = self.selectedItems() blocks = [] last_index = 0 for item in items: index = self.indexFromItem(item).row() block = item.block blocks.append(block) if index > last_index: last_index = index settings.dumpBlocks(blocks) return last_index def pasteBlock(self, index=None): blockDataList = settings.loadBlocks() inserted_indices = [] for data in blockDataList: block = Block.load(data) newName = self.builder.getNextUniqueName(prefix="Copy of " + data.get("name")) block.new_uuid() block.name = newName if index is not None: item = self.insertBlock(block, index=index) # self.scrollToItem(item, QtWidgets.QAbstractItemView.PositionAtTop) inserted_indices.append(index) index += 1 return inserted_indices def mousePressEvent(self, event, *args, **kwargs): self.setDragDropMode(self.InternalMove) super(BlockListWidget, self).mousePressEvent(event) btn = event.button() if btn == QtCore.Qt.MiddleButton or btn == QtCore.Qt.LeftButton: self._currItemRow = self.currentRow() def mouseMoveEvent(self, event): super(BlockListWidget, self).mouseMoveEvent(event) newRow = self.currentRow() if newRow != self._currItemRow: self._currItemRow = newRow def rowsInserted(self, *args, **kwargs): super(BlockListWidget, self).rowsInserted(*args, **kwargs) # self.scrollToBottom() def setNextToSelected(self): index = self.currentIndex() self.currentIndexSet.emit(index) def editAnnotationCallback(self): pass def currentIndex(self): indices = self.selectedIndexes() if indices: return indices[0].row() def dropEvent(self, event): data = event.mimeData() source = event.source() if isinstance(source, BlockListWidget): # self.setDragDropMode(self.InternalMove) ret = super(BlockListWidget, self).dropEvent(event) self.itemOrderChanged.emit() return ret elif isinstance(source, BlockMenuListWidget): # DIRTY TRICK TO GET WHERE THE NEW ITEM SHOULD BE INSERTED # use default behaviour of dropevent to put the item super(BlockListWidget, self).dropEvent(event) idx = 0 insertIndex = -1 while idx < self.count(): item = self.item(idx) if not hasattr(item, "widget"): insertIndex = idx self.takeItem(idx) break idx += 1 ######################################### blockTypes = [each.path() for each in data.urls()] for blockType in blockTypes: block = self.blueprintWidget.builder.createBlock(blockType) self.insertBlock(block, index=insertIndex) def allItems(self): return [self.item(idx) for idx in range(self.count())] def addBlock(self, block): index = self.count() self.insertBlock(block, index) def insertBlock(self, block, index=-1): if index < 0: index = self.count() item = BlockItem() if block.__class__.__name__ == 'BreakPoint': item.setSizeHint(QtCore.QSize(50, 40)) opWidget = block_widgets.BreakPointWidget(block, item) else: item.setSizeHint(QtCore.QSize(50, 80)) opWidget = block_widgets.BlockWidget(block, item) opWidget.runBlockSignal.connect(self.runBlockCallback) opWidget.itemDeleted.connect(self.deleteBlock) item.widget, opWidget.item = opWidget, item mainWindow = getMainWindow(self) opWidget.nameEdited.connect(mainWindow.editorDock.setWindowTitle) self.insertItem(index, item) self.builder.insertBlock(block, index=index) self.setItemWidget(item, opWidget) self.clearSelection() item.setSelected(True) self.itemOrderChanged.emit() return item def runBlockCallback(self, blockWidget): item = blockWidget.item index = self.indexFromItem(item).row() self.blueprintWidget.setBuilderIndex(index) self.blueprintWidget.buildNext() def deleteBlock(self, block): self.builder.blocks.remove(block) self.blueprintWidget.syncBuilder() log.debug("deleted: {0}".format(self.builder.blocks))
class BaseSaveLoadDialog(QtWidgets.QDialog): """ A base class for save /import blueprint dialog. """ _uifile = os.path.join(UIDIR, "saveLoadBlueprintDialog.ui") setting_file_updated_signal = QtCore.Signal() def __init__(self, parentDialog=None): super(BaseSaveLoadDialog, self).__init__() loadUi(self._uifile, self) self.parentDialog = parentDialog self.initUI() self.initSignals() self.initData() def initUI(self): icon = IconManager.get("load.png",type="icon") self.browseFolderButton.setIcon(icon) self.blueprintTreeWidget = BlueprintTreeWidget(self) self.blueprintListLayout.addWidget(self.blueprintTreeWidget) def initSignals(self): self.baseDirField.textChanged.connect(self.populateBlueprintList) self.browseFolderButton.clicked.connect(self.browseFolder) def browseFolder(self): baseDir = settings.getLastOpenedDir() dirPath = QtWidgets.QFileDialog.getExistingDirectory(self, 'Set Dir', baseDir) if dirPath: settings.setLastOpenedDir(dirPath) self.baseDirField.setText(dirPath) self.populateBlueprintList() def populateBlueprintList(self): self.blueprintTreeWidget.clear() baseDir = Path(self.baseDirField.text()) if not baseDir.exists(): return for eachFile in baseDir.listdir(): if not eachFile.endswith(BLUEPRINT_EXTENSION): continue try: newItem = BlueprintTreeItem(eachFile) except ValueError: continue if newItem.isValid(): self.blueprintTreeWidget.addTopLevelItem(newItem) self.blueprintTreeWidget.setItemWidget(newItem, 2, newItem.deleteButton) def initData(self): baseDir = settings.getLastOpenedDir() self.baseDirField.setText(baseDir) self.populateBlueprintList()