From 05b794029c60d73413c8ac8d96b6063b68a60067 Mon Sep 17 00:00:00 2001 From: Emanuele Date: Mon, 2 Mar 2020 19:17:47 +0100 Subject: [PATCH] cose con i file di configurazione, non funziona bene la scrittura --- bananaSPLIT/guimain.py | 17 ++++++- bananaSPLIT/libbananasplit/provawrite.json | 59 ++++++++++++++++++++++ test2.json | 59 ++++++++++++++++++++++ 3 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 bananaSPLIT/libbananasplit/provawrite.json create mode 100644 test2.json diff --git a/bananaSPLIT/guimain.py b/bananaSPLIT/guimain.py index 32b3610..94bbe3c 100644 --- a/bananaSPLIT/guimain.py +++ b/bananaSPLIT/guimain.py @@ -21,6 +21,7 @@ from libsplit import bananaSPLITTER from PyQt5.QtCore import QDir,pyqtSignal from slugify import slugify + class bananaMain(PyQt5.QtWidgets.QMainWindow): def __init__(self): PyQt5.QtWidgets.QMainWindow.__init__(self) @@ -65,7 +66,7 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow): self.ui.actionSalva_Preset.triggered.connect(self.openSavePreset) #riempi pagine di interfaccia - self.fillInterface() + self.fillAllInterfaces() pass def fillInterface(self): @@ -75,6 +76,13 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow): self.ui.lbl_dest.setText(self.conf.getParam('paths','OUTworkPath')) except: self.log.critical("MainWindow: Configurazione non accettata") + + def fillAllInterfaces(self): + self.fillInterface() + self.titolo.fillInterface() + self.titoloav.fillInterface() + self.selezout.fillInterface() + self.advopt.fillInterface() def nextTab(self): self.ui.wgt_main.setCurrentIndex(self.ui.wgt_main.currentIndex()+1) @@ -93,7 +101,11 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow): lf.setFileMode(PyQt5.QtWidgets.QFileDialog.ExistingFile) lf.setNameFilter("bananaCONF (*.json)") if lf.exec(): - self.logger.debug("Scelto il File: {}".format(next(lf.selectedFiles()))) + cf = str(lf.selectedFiles()[0].split('/')[-1]) + self.logger.debug("Scelto il File: {}".format(cf)) + self.conf.open() + self.conf.use(cf) + self.fillAllInterfaces() pass def openSavePreset(self): @@ -103,6 +115,7 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow): sf.setNameFilter("bananaCONF (*.json)") if sf.exec(): rv=str(sf.selectedFiles()[0]) + self.conf.setParam(('paths','lastUsed'),rv) self.logger.debug("Scrivi il File: {}".format(rv)) self.conf.save(fName=rv) pass diff --git a/bananaSPLIT/libbananasplit/provawrite.json b/bananaSPLIT/libbananasplit/provawrite.json new file mode 100644 index 0000000..ef4e8e1 --- /dev/null +++ b/bananaSPLIT/libbananasplit/provawrite.json @@ -0,0 +1,59 @@ +{ + "version": "v1.1a", + "paths": { + "lastUsed": "D:/Emanuele/Documenti/workspace/bananaSPLIT/bananaSPLIT/libbananasplit/provawrite.json", + "configurationPath": "D:\\Emanuele\\Documenti\\workspace\\bananaSPLIT\\", + "INworkPath": "D:/Test", + "OUTworkPath": "D:/Emanuele/Desktop" + }, + "docStruct": { + "language": "scelto da languageconf.json", + "docSep": "\\s*Copyright [(0-9)]+", + "dateFormat": "{month} {day:d}, {year:d}{}", + "outPrefix": "789", + "outSuffix": "123", + "outDateType": "ita", + "outNameFormat": "", + "outDate": true, + "outNumber": true, + "outTitle": false, + "numberPos": 1, + "datePos": 1, + "titlePos": 1, + "maxTitleLen": 6, + "outNameSep": "_", + "customSep": "~", + "dateFormats": { + "jpn": "{year:04d}{month:02d}{day:02d}", + "it": "{day:02d}{month:02d}{year:04d}", + "usa": "{month:02d}{year:04d}{day:02d}" + } + }, + "settings": { + "encoding": "utf-8", + "monthPosition": 0, + "getNewsPaperName": true, + "nameNotFoundStr": "ND", + "includeTitle": true, + "removeDuplicates": true, + "showSkipped": true, + "showRemovedDuplicates": false, + "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/test2.json b/test2.json new file mode 100644 index 0000000..4fe631f --- /dev/null +++ b/test2.json @@ -0,0 +1,59 @@ +{ + "version": "v1.1a", + "paths": { + "lastUsed": "defaults.json", + "configurationPath": "D:\\Emanuele\\Documenti\\workspace\\bananaSPLIT\\", + "INworkPath": "D:\\Emanuele\\Documenti\\workspace\\bananaSPLIT\\TestFiles\\", + "OUTworkPath": "D:\\Emanuele\\" + }, + "docStruct": { + "language": "scelto da languageconf.json", + "docSep": "\\s*Copyright [(0-9)]+", + "dateFormat": "{month} {day:d}, {year:d}{}", + "outPrefix": "123", + "outSuffix": "456", + "outDateType": "ita", + "outNameFormat": "", + "outDate": false, + "outNumber": false, + "outTitle": false, + "numberPos": 1, + "datePos": 1, + "titlePos": 1, + "maxTitleLen": 10, + "outNameSep": "_", + "customSep": "~", + "dateFormats": { + "jpn": "{year:04d}{month:02d}{day:02d}", + "it": "{day:02d}{month:02d}{year:04d}", + "usa": "{month:02d}{year:04d}{day:02d}" + } + }, + "settings": { + "encoding": "utf-8", + "monthPosition": 0, + "getNewsPaperName": true, + "nameNotFoundStr": "ND", + "includeTitle": true, + "removeDuplicates": true, + "showSkipped": true, + "showRemovedDuplicates": false, + "loadTXT": true, + "loadDOCX": false, + "removeOldFiles": true, + "saveSeparateFiles": true, + "saveBodyFile": true, + "saveBodyNumber": true, + "delLF": false, + "delWordBreak": true, + "delChars": [ + "'", + "@", + "#", + "$", + "%", + "^", + "&" + ] + } +} \ No newline at end of file