cose con i file di configurazione, non funziona bene la scrittura
This commit is contained in:
@@ -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
|
||||
|
||||
59
bananaSPLIT/libbananasplit/provawrite.json
Normal file
59
bananaSPLIT/libbananasplit/provawrite.json
Normal file
@@ -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": [
|
||||
"'",
|
||||
"@",
|
||||
"#",
|
||||
"$",
|
||||
"%",
|
||||
"^",
|
||||
"&"
|
||||
]
|
||||
}
|
||||
}
|
||||
59
test2.json
Normal file
59
test2.json
Normal file
@@ -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": [
|
||||
"'",
|
||||
"@",
|
||||
"#",
|
||||
"$",
|
||||
"%",
|
||||
"^",
|
||||
"&"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user