def create_form(project, name): folder = project.folder formfolder = os.path.join(folder, name) templateform = os.path.join(templatefolder, "templateform") shutil.copytree(templateform, formfolder) config = dict(label=name, type='auto', widgets=[]) form = project.addformconfig(name, config) logger.debug(form.settings) logger.debug(form.settings == config) return form
def newform(project): folder = project.folder foldername = newfoldername("form", folder, "Form") formfolder = os.path.join(folder, foldername) templateform = os.path.join(templatefolder, "templateform") shutil.copytree(templateform, formfolder) config = dict(label=foldername, type='auto', widgets=[]) form = project.addformconfig(foldername, config) logger.debug(form.settings) logger.debug(form.settings == config) return form
def _saveproject(self): """ Save the project config to disk. """ title = self.titleText.text() description = self.descriptionText.toPlainText() version = str(self.versionText.text()) settings = self.project.settings settings['title'] = title settings['description'] = description settings['version'] = version form = self.currentform if form: form.settings['widgets'] = list(self.widgetmodel.widgets()) logger.debug(form.settings) self.project.save() self.projectsaved.emit()