diff --git a/asdf.json b/asdf.json new file mode 100644 index 0000000..c4044fb --- /dev/null +++ b/asdf.json @@ -0,0 +1,43 @@ +{ + "version": "v1.1a", + "paths": { + "lastUsed": "defaults.json", + "configurationPath": "D:\\Emanuele\\Documenti\\workspace\\bananaSPLIT\\", + "INworkPath": "D:\\Emanuele\\Documenti\\workspace\\bananaSPLIT\\TestFiles\\", + "OUTworkPath": "H:\\", + "OUTnameFormat": "TEST_{docnum}_{year:04d}{month:02d}{day:02d}_{title}.txt" + }, + "docStruct": { + "docSep": "\\s*Copyright [(0-9)]+", + "dateFormat": "{month} {day:d}, {year:d}{}", + "language": "placeholder da riempire con le informazioni di languageconf.json" + }, + "settings": { + "encoding": "utf-8", + "monthPosition": 0, + "getNewsPaperName": true, + "nameNotFoundStr": "ND", + "includeTitle": true, + "removeDuplicates": true, + "showSkipped": true, + "showRemovedDuplicates": false, + "maxTitleLen": 32, + "loadTXT": true, + "loadDOCX": false, + "removeOldFiles": true, + "saveSeparateFiles": true, + "saveBodyFile": true, + "saveBodyNumber": true, + "delLF": false, + "delWordBreak": true, + "delChars": [ + "'", + "@", + "#", + "$", + "%", + "^", + "&" + ] + } +} \ No newline at end of file diff --git a/bananaSPLIT/guimain.py b/bananaSPLIT/guimain.py index 57e96a0..ad4e3be 100644 --- a/bananaSPLIT/guimain.py +++ b/bananaSPLIT/guimain.py @@ -23,7 +23,8 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow): self.logger = fancyLogger(filepath=r"./libbananasplit/loggerconf.json",fileLog=False) self.conf = bananaCONF(workdir=r"./libbananasplit", logger=self.logger) self.conf.open() - self.conf.use("testEN.json") + self.conf.use("defaults.json") + self.conf.use(self.conf.getParam('paths', 'lastUsed')) except: sys.exit() @@ -59,10 +60,17 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow): self.ui.actionSalva_Preset.triggered.connect(self.openSavePreset) #riempi pagine di interfaccia - self.ui.lbl_sorg.setText(self.conf.getParam('paths','INworkPath')) - self.ui.lbl_dest.setText(self.conf.getParam('paths','OUTworkPath')) + self.fillInterface() pass + def fillInterface(self): + #pagina principale + try: + self.ui.lbl_sorg.setText(self.conf.getParam('paths','INworkPath')) + self.ui.lbl_dest.setText(self.conf.getParam('paths','OUTworkPath')) + except: + self.log.critical("Configurazione non accettata") + def nextTab(self): self.ui.wgt_main.setCurrentIndex(self.ui.wgt_main.currentIndex()+1) self.logger.debug("Prossima Tab") @@ -75,10 +83,23 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow): def openLoadPreset(self): self.logger.debug("Apri Carica Preset") - pass + lf = PyQt5.QtWidgets.QFileDialog(self,"Carica Preset",self.conf.getParam('paths', 'configurationPath')) + lf.setAcceptMode(PyQt5.QtWidgets.QFileDialog.AcceptOpen) + lf.setFileMode(PyQt5.QtWidgets.QFileDialog.ExistingFile) + lf.setNameFilter("bananaCONF (*.json)") + if lf.exec(): + self.logger.debug("Scelto il File: {}".format(next(lf.selectedFiles()))) + pass def openSavePreset(self): self.logger.debug("Apri Salva Preset") + sf = PyQt5.QtWidgets.QFileDialog(self,"Salva Preset",self.conf.getParam('paths', 'configurationPath')) + sf.setAcceptMode(PyQt5.QtWidgets.QFileDialog.AcceptSave) + sf.setNameFilter("bananaCONF (*.json)") + if sf.exec(): + rv=str(sf.selectedFiles()[0]) + self.logger.debug("Scrivi il File: {}".format(rv)) + self.conf.save(fName=rv) pass def openAdvOpt(self): diff --git a/bananaSPLIT/libbananasplit/defaults.json b/bananaSPLIT/libbananasplit/defaults.json index 0e72b3b..055df03 100644 --- a/bananaSPLIT/libbananasplit/defaults.json +++ b/bananaSPLIT/libbananasplit/defaults.json @@ -1,7 +1,8 @@ { "version": "v1.1a", "paths": { - "configurationPath":"D:\\Emanuele\\Documenti\\workspace\\bananaSPLIT\\", + "lastUsed": "defaults.json", + "configurationPath": "D:\\Emanuele\\Documenti\\workspace\\bananaSPLIT\\", "INworkPath": "D:\\Emanuele\\Documenti\\workspace\\bananaSPLIT\\TestFiles\\", "OUTworkPath": "H:\\", "OUTnameFormat": "TEST_{docnum}_{year:04d}{month:02d}{day:02d}_{title}.txt"