integrazione con traduzione

This commit is contained in:
2020-04-13 20:00:05 +02:00
parent 38461fbe33
commit 4351889aae
17 changed files with 20837 additions and 142 deletions

View File

@@ -5,6 +5,5 @@ encoding//bananaSPLIT/UserInterface/compiledUI/avanzatetitolo.py=utf-8
encoding//bananaSPLIT/UserInterface/compiledUI/avanzatetitolo2.py=utf-8
encoding//bananaSPLIT/UserInterface/compiledUI/avanzatetitolo3.py=utf-8
encoding//bananaSPLIT/UserInterface/compiledUI/mainwindow.py=utf-8
encoding//bananaSPLIT/UserInterface/compiledUI/resources_rc.py=utf-8
encoding//bananaSPLIT/UserInterface/compiledUI/selezout.py=utf-8
encoding//bananaSPLIT/UserInterface/compiledUI/titolow.py=utf-8

View File

@@ -52,15 +52,15 @@ class Ui_about(object):
self.label_2.setText(_translate("about", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:7pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:20pt; font-weight:600;\">About SPEx<br /></span><span style=\" font-size:12pt;\">Versione {ver}</span></p>\n"
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">SPEx (Split Parse &amp; Extract) e\' un tool, utile ai linguisti che devono costruire un corpus, che ha come funzione principale dividere e ripulire da elementi non necessari raccolte di &quot;articoli&quot; scaricati da database online quali </span><span style=\" font-size:12pt; font-style:italic;\">LexisNexis</span><span style=\" font-size:12pt;\">.</span></p>\n"
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">Pui tranquillamente suggerire SPEx ad un tuo collega, ci fa molto piacere! Ricordati solo di mandarci (o farci mandare) una mail con scopo e impressioni di utilizzo: questo ci aiuta a tenere traccia di quanti ricercatori stanno usando SPEx e pensare a sviluppi futuri di questo tool. </span></p>\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt;\">SPEx non e\' soggetto ad alcun tipo di licenza e viene distribuito senza alcuna garanzia.<br />Essendo un progetto &quot;del tempo libero&quot;, bug e proposte di espansione verranno sicuramente presi in considerazione ma non possiamo dirvi nulla riguardo alle tempistiche.</span></p>\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">Contatti:</span><br /><span style=\" font-size:10pt;\">12parsec.software@gmail.com</span></p>\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">Download:<br /></span><a href=\"https://drive.google.com/open?id=10zUm7uHk9st36PVotMwh9wqOeXU3xrr8\"><span style=\" text-decoration: underline; color:#0000ff;\">https://drive.google.com/open?id=10zUm7uHk9st36PVotMwh9wqOeXU3xrr8</span></a></p></body></html>"))
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:20pt; font-weight:600;\">About SPEx<br /></span><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt;\">Versione {ver}</span></p>\n"
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:7pt;\"><br /></span></p>\n"
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt;\">SPEx (Split Parse &amp; Extract) e\' un tool utile per gli specialisti di linguistica dei corpora che intendono rifinire il loro corpus, eliminando tutti gli elementi non </span><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt;\">necessari e dividendo in file singoli le raccolte di</span><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt;\"> &quot;articoli&quot; scaricate da database online quali </span><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt; font-style:italic;\">Lexis Uni</span><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt;\">.</span></p>\n"
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt;\">Puoi tranquillamente suggerire SPEx ad un tuo collega: ci fa molto piacere! Ricordati solo di mandarci una mail con scopo e impressioni di utilizzo: questo ci aiuta a tenere traccia di quanti ricercatori stanno usando SPEx e pensare a sviluppi futuri di questo tool. </span></p>\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:7pt;\"><br /></span></p>\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:10pt;\">SPEx non e\' soggetto ad alcun tipo di licenza e viene distribuito senza alcuna garanzia.<br />Essendo un progetto &quot;del tempo libero&quot;, bug e proposte di espansione verranno sicuramente presi in considerazione, anche se le tempistiche potrebbero variare.</span></p>\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt;\">Contatti:</span><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:7pt;\"><br /></span><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:10pt;\">12parsec.software@gmail.com</span></p>\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt;\">Download:<br /></span><a href=\"https://drive.google.com/open?id=10zUm7uHk9st36PVotMwh9wqOeXU3xrr8\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:7pt; text-decoration: underline; color:#0000ff;\">https://drive.google.com/open?id=10zUm7uHk9st36PVotMwh9wqOeXU3xrr8</span></a></p></body></html>"))
import resources_rc

File diff suppressed because it is too large Load Diff

View File

@@ -318,7 +318,7 @@ class Ui_titolo(object):
_translate = QtCore.QCoreApplication.translate
titolo.setWindowTitle(_translate("titolo", "Nomi file di Uscita"))
self.lbl_ncarat.setText(_translate("titolo", "Numero di caratteri"))
self.btn_avanzate.setText(_translate("titolo", "Avanzate Titolo"))
self.btn_avanzate.setText(_translate("titolo", "Opzioni Avanzate (Titolo)"))
self.btn_indietro.setText(_translate("titolo", "Indietro"))
self.btn_avanti.setText(_translate("titolo", "Avanti"))
self.rad_datajpn.setText(_translate("titolo", "YYYY MM DD, es. 2000 12 31 (jpn)"))

View File

@@ -18,13 +18,12 @@
<file>icons/logo4.png</file>
</qresource>
<qresource prefix="tr">
<file>translations/mainwindow_en.qm</file>
<file>translations/about_en.qm</file>
<file>translations/advopt_en.qm</file>
<file>translations/avanzatetitolo_en.qm</file>
<file>translations/avanzatetitolo2_en.qm</file>
<file>translations/avanzatetitolo3_en.qm</file>
<file>translations/guimain.qm</file>
<file>translations/guimain_en.qm</file>
<file>translations/libconfload_en.qm</file>
<file>translations/libsplit_en.qm</file>
<file>translations/mainwindow_en.qm</file>
<file>translations/selezout_en.qm</file>
<file>translations/titolow_en.qm</file>

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<<<<<<< gui-devel
<!DOCTYPE TS>
<TS version="2.1" language="en">
<context>
@@ -157,6 +158,165 @@
<location filename="../../../guimain.py" line="533"/>
<source>Parametri inseriti validi, configurazione accettata</source>
<translation>Valid input parameters, configuration accepted</translation>
=======
<!DOCTYPE TS><TS version="2.0">
<context>
<name>@default</name>
<message>
<location filename="../../../guimain.py" line="41"/>
<source>Impostazioni Titolo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="42"/>
<source>Selezione Output</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="87"/>
<source>MainWindow: Configurazione non accettata</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="107"/>
<source>Prossima Tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="112"/>
<source>Tab Precedente</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="116"/>
<source>Apri Carica Preset</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="117"/>
<source>Carica Preset</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="126"/>
<source>Riempio tutte le tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="131"/>
<source>Apri Salva Preset</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="151"/>
<source>Apri Opzioni Avanzate</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="157"/>
<source>Apri Opzioni Lingua</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="161"/>
<source>Apri Finestra About</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="165"/>
<source>Seleziona Cartella Sorgente</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="169"/>
<source>Selezionata Cartella Sorgente: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="174"/>
<source>Seleziona Cartella Destinazione</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="178"/>
<source>Selezionata Cartella Destinazione: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="186"/>
<source>Apro in directory: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="241"/>
<source>Titolo: Configurazione non accettata</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="244"/>
<source>Mostro la finestra avanzate titolo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="249"/>
<source>Applico impostazioni Titolo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="306"/>
<source>AvanzateTitolo: Configurazione non accettata</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="360"/>
<source>Avanzate Titolo Accettate</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="366"/>
<source>Avanzate Titolo Rifiutate</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="431"/>
<source>SelezUscita: Configurazione non accettata</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="435"/>
<source>Applico Impostazioni File Uscita</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="475"/>
<source>Sto SPLITTANDO, attendi..</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="476"/>
<source>Sto Splittando..</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="495"/>
<source>FINITO!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="519"/>
<source>AdvancedOptions: Configurazione non accettata</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="525"/>
<source>Avanzate Globali</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../guimain.py" line="533"/>
<source>Parametri inseriti validi, configurazione accettata</source>
<translation type="unfinished"></translation>
>>>>>>> b35a471 aggiornati script anche per tradurre messaggi python
</message>
</context>
</TS>

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<<<<<<< gui-devel
<!DOCTYPE TS>
<TS version="2.1" language="en_US" sourcelanguage="it_IT">
<context>
@@ -65,6 +66,71 @@
<location filename="../../../libbananasplit/libconfload.py" line="96"/>
<source>Parametro di configurazione non valido! [{}]</source>
<translation>Configuration parameter not valid! [{}]</translation>
=======
<!DOCTYPE TS><TS version="2.0">
<context>
<name>@default</name>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="21"/>
<source>Cerco le configurazioni in: [{}]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="23"/>
<source>Non mi e&apos; stata fornita una directory per i file di configurazione</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="27"/>
<source>Carico i file di configurazione</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="36"/>
<source>Caricato correttamente: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="39"/>
<source>Impossibile leggere la configurazione:{}
<byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/>Controlla il file a riga: {} e colonna:{}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="42"/>
<source>Impossibile aprire il file: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="44"/>
<source>Eccezione inaspettata: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="46"/>
<source>Non ho trovato alcun file di configurazione!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="63"/>
<source>Salvo la configurazione: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="69"/>
<source>Impossibile salvare il file: {} - [{}]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="71"/>
<source>Errore imprevisto nella scrittura del file: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libconfload.py" line="96"/>
<source>Parametro di configurazione non valido! [{}]</source>
<translation type="unfinished"></translation>
>>>>>>> b35a471 aggiornati script anche per tradurre messaggi python
</message>
</context>
</TS>

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<<<<<<< gui-devel
<!DOCTYPE TS>
<TS version="2.1" language="en_US" sourcelanguage="it_IT">
<context>
@@ -158,6 +159,160 @@
<location filename="../../../libbananasplit/libsplit.py" line="386"/>
<source>Salvo gli articoli in un singolo file vicino agli originali...</source>
<translation>Saving articles in a single file near the originals...</translation>
=======
<!DOCTYPE TS><TS version="2.0">
<context>
<name>@default</name>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="27"/>
<source>Sto operando sul file: {}..</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="36"/>
<source>Non e&apos; stato fornito il nome di alcun file da splittare!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="40"/>
<source>Nuovo SPLITTER su file: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="51"/>
<source>Controllo se ci sono dei duplicati..</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="57"/>
<source>Salto il controllo dei duplicati..</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="66"/>
<source>Non posso sovrascrivere i vecchi file, eliminali manualmente!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="74"/>
<source>L&apos;elaborazione del file ha richiesto {:4.2f} sec</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="77"/>
<source>Il file [{}] contiene caratteri non compatibili con la codifica scelta! [{}]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="89"/>
<source>Carico il contenuto..</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="94"/>
<source>Impossibile aprire il file: {}! [{}]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="102"/>
<source>Elimino righe vuote e caratteri inutili..</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="114"/>
<source>Errore inaspettato durante l&apos;eliminazione delle righe vuote!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="225"/>
<source>Individuo il contenuto..</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="275"/>
<source>Ho trovato una riga ambigua.. potrebbe essere una data ma non so: [{}]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="270"/>
<source>E&apos; successo qualcosa mentre stavo cercando il nome della pubblicazione,<byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/>controlla i file di uscita! [{}]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="289"/>
<source>Errore inaspettato, contatta il tuo sviluppatore di fiducia!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="187"/>
<source>Ho individuato una separatore valido prima che si chiusesse l&apos;articolo precedente, controlla i tuoi file in uscita!
<byte value="x9"/><byte value="x9"/><byte value="x9"/>L&apos;errore dovrebbe essere intorno all&apos;articolo {} ma non sono sicuro!
<byte value="x9"/><byte value="x9"/><byte value="x9"/>[{}]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="324"/>
<source>Stato Interno Sconosciuto</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="328"/>
<source>Nel file ho trovato {0} articoli..</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="330"/>
<source>Attentione, LexisNexis ne ha saltati {} !!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="249"/>
<source>Il conto dei documenti non torna! LexisNexis ne ha saltato qualcuno!
Precedente:{0}-Attuale:{1}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="307"/>
<source>Ho individuato una separatore valido prima che si chiusesse l&apos;articolo precedente, controlla i tuoi file in uscita!
<byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/><byte value="x9"/>L&apos;errore dovrebbe essere intorno all&apos;articolo {} ma non sono sicuro!
<byte value="x9"/><byte value="x9"/>[{}]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="347"/>
<source>Duplicato: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="351"/>
<source>Ho rimosso {} duplicati di {} articoli..</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="357"/>
<source>Salvo gli articoli in file separati...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="387"/>
<source>Persorso: {0}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="397"/>
<source>Qualcosa e&apos; andato storto, non riesco a scrivere il file: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="382"/>
<source>Ho salvato meno file rispetto a quelli trovati!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../libbananasplit/libsplit.py" line="386"/>
<source>Salvo gli articoli in un singolo file vicino agli originali...</source>
<translation type="unfinished"></translation>
>>>>>>> b35a471 aggiornati script anche per tradurre messaggi python
</message>
</context>
</TS>

View File

@@ -36,7 +36,7 @@
}
},
"settings": {
"uiLang": "it",
"uiLang": "en",
"winW": 800,
"winH": 700,
"encoding": "windows-1252",

View File

@@ -40,8 +40,8 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow):
#popola le tab con le finestre giuste
self.ui.wgt_main.addTab(self.titolo, tr("Impostazioni Titolo"))
self.ui.wgt_main.addTab(self.selezout, tr("Selezione Output"))
self.ui.wgt_main.addTab(self.titolo, self.tr("Impostazioni Titolo"))
self.ui.wgt_main.addTab(self.selezout, self.tr("Selezione Output"))
# connetti bottoni avanti
self.ui.btn_avanti.clicked.connect(self.nextTab)
@@ -86,7 +86,7 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow):
self.ui.rad_fileOld.setChecked(not self.conf.getParam('docStruct', 'fileVersNew'))
self.fillFileList()
except:
self.log.critical(tr("MainWindow: Configurazione non accettata"))
self.log.critical(self.tr("MainWindow: Configurazione non accettata"))
def fillAllInterfaces(self):
self.fillInterface()
@@ -106,31 +106,31 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow):
def nextTab(self):
self.ui.wgt_main.setCurrentIndex(self.ui.wgt_main.currentIndex()+1)
self.logger.debug(tr("Prossima Tab"))
self.logger.debug(self.tr("Prossima Tab"))
pass
def prevTab(self):
self.ui.wgt_main.setCurrentIndex(self.ui.wgt_main.currentIndex()-1)
self.logger.debug(tr("Tab Precedente"))
self.logger.debug(self.tr("Tab Precedente"))
pass
def openLoadPreset(self):
self.logger.debug(tr("Apri Carica Preset"))
lf = PyQt5.QtWidgets.QFileDialog(self,tr("Carica Preset"),self.conf.getParam('paths', 'configurationPath'))
self.logger.debug(self.tr("Apri Carica Preset"))
lf = PyQt5.QtWidgets.QFileDialog(self,self.tr("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():
cf = str(lf.selectedFiles()[0].split('/')[-1])
self.logger.info(tr(f"Apro la configurazione: {cf}"))
self.logger.info(self.tr(f"Apro la configurazione: {cf}"))
self.conf.open()
self.conf.use(cf)
self.logger.debug(tr("Riempio tutte le tab"))
self.logger.debug(self.tr("Riempio tutte le tab"))
self.fillAllInterfaces()
pass
def openSavePreset(self):
self.logger.debug(tr("Apri Salva Preset"))
self.logger.debug(self.tr("Apri Salva Preset"))
self.applicaTutto()
sf = PyQt5.QtWidgets.QFileDialog(self,"Salva Preset",self.conf.getParam('paths', 'configurationPath'))
sf.setAcceptMode(PyQt5.QtWidgets.QFileDialog.AcceptSave)
@@ -145,47 +145,47 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow):
self.conf.save(fName="defaults.json")
self.conf.use(prev)
##
self.logger.debug(tr(f"Scrivo la configurazione: {rv}"))
self.logger.debug(self.tr(f"Scrivo la configurazione: {rv}"))
self.conf.save(fName=rv)
pass
def openAdvOpt(self):
self.logger.debug(tr("Apri Opzioni Avanzate"))
self.logger.debug(self.tr("Apri Opzioni Avanzate"))
self.advopt.fillInterface()
self.advopt.show()
pass
def openLanguage(self):
self.logger.debug(tr("Apri Opzioni Lingua"))
self.logger.debug(self.tr("Apri Opzioni Lingua"))
pass
def openAbout(self):
self.logger.debug(tr("Apri Finestra About"))
self.logger.debug(self.tr("Apri Finestra About"))
self.spxabt=spexAbout()
def selezSorg(self):
rv = PyQt5.QtWidgets.QFileDialog.getExistingDirectory(self,tr("Seleziona Cartella Sorgente"),self.conf.getParam('paths','INworkPath'))
rv = PyQt5.QtWidgets.QFileDialog.getExistingDirectory(self,self.tr("Seleziona Cartella Sorgente"),self.conf.getParam('paths','INworkPath'))
if rv is not "":
self.conf.setParam(keys=('paths','INworkPath',), val=rv+"/")
self.ui.lbl_sorg.setText(rv)
self.logger.info(tr("Selezionata Cartella Sorgente: {}").format(rv+"/"))
self.logger.info(self.tr("Selezionata Cartella Sorgente: {}").format(rv+"/"))
self.fillFileList()
pass
def selezDest(self):
rv = PyQt5.QtWidgets.QFileDialog.getExistingDirectory(self,tr("Seleziona Cartella Destinazione"),self.conf.getParam('paths','OUTworkPath'))
rv = PyQt5.QtWidgets.QFileDialog.getExistingDirectory(self,self.tr("Seleziona Cartella Destinazione"),self.conf.getParam('paths','OUTworkPath'))
if rv is not "":
self.conf.setParam(keys=('paths','OUTworkPath',), val=rv+"/")
self.ui.lbl_dest.setText(rv)
self.logger.info(tr("Selezionata Cartella Destinazione: {}").format(rv+"/"))
self.logger.info(self.tr("Selezionata Cartella Destinazione: {}").format(rv+"/"))
pass
def selezVers(self):
self.conf.setParam(('docStruct','fileVersNew'), self.ui.rad_fileNew.isChecked())
self.logger.debug(tr(f"Selezionata Versione File"))
self.logger.debug(self.tr(f"Selezionata Versione File"))
def openFileDialog(self, name, path):
self.log.debug(tr("Apro in directory: {}").format(path))
self.log.debug(self.tr("Apro in directory: {}").format(path))
return
def applicaTutto(self):
@@ -240,15 +240,15 @@ class bananaTitolo(PyQt5.QtWidgets.QWidget):
#finestra avanzate
self.advtitolo.fillInterface()
except:
self.log.critical(tr("Titolo: Configurazione non accettata"))
self.log.critical(self.tr("Titolo: Configurazione non accettata"))
def spawnAvanzate(self):
self.log.debug(tr("Mostro la finestra avanzate titolo"))
self.log.debug(self.tr("Mostro la finestra avanzate titolo"))
self.advtitolo.show()
pass
def applica(self):
self.log.info(tr("Applico impostazioni Titolo"))
self.log.info(self.tr("Applico impostazioni Titolo"))
self.conf.setParam(('docStruct','outDate'),self.titoloui.chk_data.isChecked())
self.conf.setParam(('docStruct','outNumber'),self.titoloui.chk_docnum.isChecked())
self.conf.setParam(('docStruct','outTitle'),self.titoloui.chk_titolo.isChecked())
@@ -305,7 +305,7 @@ class bananaTitoloAvanzate(PyQt5.QtWidgets.QWidget):
self.titoloavui.txt_prefisso.setText(self.conf.getParam('docStruct','outPrefix'))
self.titoloavui.txt_suffisso.setText(self.conf.getParam('docStruct','outSuffix'))
except:
self.log.critical(tr("AvanzateTitolo: Configurazione non accettata"))
self.log.critical(self.tr("AvanzateTitolo: Configurazione non accettata"))
def gestisciBottoni(self):
#PRIMO
@@ -359,13 +359,13 @@ class bananaTitoloAvanzate(PyQt5.QtWidgets.QWidget):
pass
def returnOk(self):
self.log.info(tr("Avanzate Titolo Accettate"))
self.log.info(self.tr("Avanzate Titolo Accettate"))
self.applica()
self.hide()
pass
def returnKo(self):
self.log.info(tr("Avanzate Titolo Rifiutate"))
self.log.info(self.tr("Avanzate Titolo Rifiutate"))
self.hide()
pass
@@ -430,11 +430,11 @@ class bananaSelezOut(PyQt5.QtWidgets.QWidget):
self.selezoutui.lin_specialChars.setText(''.join(self.conf.getParam('settings', 'delChars')))
pass
except:
self.log.critical(tr("SelezUscita: Configurazione non accettata"))
self.log.critical(self.tr("SelezUscita: Configurazione non accettata"))
pass
def applica(self):
self.log.info(tr("Applico Impostazioni File Uscita"))
self.log.info(self.tr("Applico Impostazioni File Uscita"))
self.conf.setParam(('docStruct', 'language'), self.selezoutui.cmb_lingua.currentText())
self.conf.setParam(('docStruct', 'languageIdx'), self.selezoutui.cmb_lingua.currentIndex())
self.conf.setParam(('settings', 'saveBodyFile'), self.selezoutui.rad_mainbody.isChecked()
@@ -474,8 +474,8 @@ class bananaSelezOut(PyQt5.QtWidgets.QWidget):
splconf['docStruct']['outNameFormat'] = splconf['docStruct']['outNameSep'].join(nametemp)+splconf['docStruct']['outExt']
#costruisco messageBox
msgb = QMessageBox(parent=self, icon=QMessageBox.Warning, text=tr("Sto SPLITTANDO, attendi.."))
msgb.setWindowTitle(tr("Sto Splittando.."))
msgb = QMessageBox(parent=self, icon=QMessageBox.Warning, text=self.tr("Sto SPLITTANDO, attendi.."))
msgb.setWindowTitle(self.tr("Sto Splittando.."))
msgb.show()
@pyqtSlot()
@@ -492,9 +492,9 @@ class bananaSelezOut(PyQt5.QtWidgets.QWidget):
tDict[f].run()
#QThreadPool.globalInstance().start(tDict[f])
except Exception as e:
self.log.error(tr(f"Impossibile avviare lo splitter: {e}"))
self.log.error(self.tr(f"Impossibile avviare lo splitter: {e}"))
msgb.setText(tr("FINITO!"))
msgb.setText(self.tr("FINITO!"))
pass
class bananaAdvOpt(PyQt5.QtWidgets.QWidget):
@@ -518,28 +518,28 @@ class bananaAdvOpt(PyQt5.QtWidgets.QWidget):
try:
self.advoptui.txt_confFile.setPlainText(json.dumps(self.conf.dump(),indent=2))
except:
self.log.critical(tr("AdvancedOptions: Configurazione non accettata"))
self.log.critical(self.tr("AdvancedOptions: Configurazione non accettata"))
pass
def accetta(self):
self.errmsg = QMessageBox()
self.errmsg.setModal(True)
self.errmsg.setWindowTitle(tr("Avanzate Globali"))
self.errmsg.setWindowTitle(self.tr("Avanzate Globali"))
icon = PyQt5.QtGui.QIcon()
icon.addPixmap(PyQt5.QtGui.QPixmap(":/icons/icons8-smartphone-ram-100.png"), PyQt5.QtGui.QIcon.Normal, PyQt5.QtGui.QIcon.Off)
self.errmsg.setWindowIcon(icon)
try:
self.conf.loads(self.advoptui.txt_confFile.toPlainText())
self.log.info(tr("Parametri inseriti validi, configurazione accettata"))
self.log.info(self.tr("Parametri inseriti validi, configurazione accettata"))
self.errmsg.setIcon(QMessageBox.Information)
self.errmsg.setText(tr("Parametri inseriti validi, configurazione accettata"))
self.errmsg.setText(self.tr("Parametri inseriti validi, configurazione accettata"))
self.errmsg.show()
self.update.emit()
self.hide()
except Exception as e:
self.log.error(tr(f"Errore nei parametri! {e}"))
self.log.error(self.tr(f"Errore nei parametri! {e}"))
self.errmsg.setIcon(QMessageBox.Critical)
self.errmsg.setText(tr(f"Errore nei parametri!\n{e}"))
self.errmsg.setText(self.tr(f"Errore nei parametri!\n{e}"))
self.errmsg.show()
pass
@@ -580,11 +580,12 @@ if __name__ == '__main__':
iflan = conf.getParam('settings','uiLang')
if iflan != 'it':
t = QTranslator()
t.load(f":/tr/translations/mainwindow_{iflan}.qm")
print(t.load(f":/tr/translations/mainwindow_{iflan}.qm"))
print(t.load(f":/tr/translations/libconfload_{iflan}.qm"))
app.installTranslator(t)
except Exception as e:
print(e)
print(f"Errore main: {e}")
sys.exit()
window = bananaMain(logger=LOGGER, confloader=conf)

View File

@@ -4,27 +4,32 @@ Created on 2 nov 2019
@author: Emanuele Trabattoni
'''
import json,os,glob,copy
from PyQt5.QtCore import QObject
class bananaCONF(object):
class bananaCONF(QObject):
'''
Carica e Salva file di configurazione per bananaSPLITTER
'''
def __init__(self, workdir=None, logger=None):
self.log = logger
self.fileList = None
self.workdir = None
self.inUse = None
self.settingsList = dict()
if workdir is not None:
self.workdir = workdir
os.chdir(workdir)
self.log.debug(tr("Cerco le configurazioni in: [{}]").format(os.getcwd()))
else:
self.log.error(tr("Non mi e' stata fornita una directory per i file di configurazione"))
pass
try:
QObject.__init__(self)
self.log = logger
self.fileList = None
self.workdir = None
self.inUse = None
self.settingsList = dict()
if workdir is not None:
self.workdir = workdir
os.chdir(workdir)
self.log.debug(self.tr("Cerco le configurazioni in: [{}]").format(os.getcwd()))
else:
self.log.error(self.tr("Non mi e' stata fornita una directory per i file di configurazione"))
pass
except Exception as e:
print(f"libConfload Exception: {e}")
def open(self):
self.log.info(tr("Carico i file di configurazione"))
self.log.info(self.tr("Carico i file di configurazione"))
self.fileList = glob.glob(r"*.json")
if len(self.fileList) > 0:
for f in self.fileList:
@@ -33,17 +38,17 @@ class bananaCONF(object):
tf = json.load(fp)
fName = f.split("\\")[-1]
self.settingsList[fName] = copy.deepcopy(tf)
self.log.info(tr("Caricato correttamente: {}").format(fName))
self.log.info(self.tr("Caricato correttamente: {}").format(fName))
fp.close()
except json.JSONDecodeError as e:
self.log.error(tr("Impossibile leggere la configurazione:{}\n \
self.log.error(self.tr("Impossibile leggere la configurazione:{}\n \
Controlla il file a riga: {} e colonna:{}").format(e.doc, e.lineno, e.colno))
except IOError as ee:
self.log.error(tr("Impossibile aprire il file: {}").format(ee))
self.log.error(self.tr("Impossibile aprire il file: {}").format(ee))
except Exception as eee:
self.log.critical(tr("Eccezione inaspettata: {}").format(eee))
self.log.critical(self.tr("Eccezione inaspettata: {}").format(eee))
else:
self.log.error(tr("Non ho trovato alcun file di configurazione!"))
self.log.error(self.tr("Non ho trovato alcun file di configurazione!"))
pass
def reload(self):
@@ -60,15 +65,15 @@ class bananaCONF(object):
def save(self, fName=None):
if fName is None:
fName=self.inUse
self.log.info(tr("Salvo la configurazione: {}").format(fName))
self.log.info(self.tr("Salvo la configurazione: {}").format(fName))
try:
f=open(fName, 'w')
json.dump(self.settingsList[self.inUse], f, indent='\t')
f.close()
except IOError as e:
self.log.error(tr("Impossibile salvare il file: {} - [{}]").format(fName,e))
self.log.error(self.tr("Impossibile salvare il file: {} - [{}]").format(fName,e))
except Exception as ei:
self.log.error(tr("Errore imprevisto nella scrittura del file: {}").format(ei))
self.log.error(self.tr("Errore imprevisto nella scrittura del file: {}").format(ei))
pass
def getFiles(self):
@@ -81,7 +86,7 @@ class bananaCONF(object):
rv = rv[k]
return rv
except ValueError as ve:
self.log.error(tr("Parametro di configurazione non valido! [{}]").format(ve))
self.log.error(self.tr("Parametro di configurazione non valido! [{}]").format(ve))
return False
pass
@@ -93,7 +98,7 @@ class bananaCONF(object):
sv[keys[-1]] = val
return True
except ValueError as ve:
self.log.error(tr("Parametro di configurazione non valido! [{}]").format(ve))
self.log.error(self.tr("Parametro di configurazione non valido! [{}]").format(ve))
return False
pass

View File

@@ -52,6 +52,8 @@ class fancyLogger(QObject):
self.LOGGER.addHandler(cl)
except IOError as e:
print("Impossibile caricare la configurazione del logger: [{}]".format(e))
except Exception as ee:
print(f"libFancylogger error: {e}")
pass
def debug(self, msg="Undefined Debug"):

View File

@@ -14,31 +14,34 @@ class bananaSPLITTER(QObject):
sendStatus = pyqtSignal(str)
def __init__(self, fileParams=None, logger=None):
QObject.__init__(self)
self.fileParams = fileParams
self.log = logger
self.rawFile = None
self.status = "first"
self.contentList = list()
self.bodyCounter=0
self.duplicateNumber=0
#self.log.debug(f"Configurazione: \n {json.dumps(fileParams, indent=2)}")
if fileParams is not None:
self.log.debug(tr("Sto operando sul file: {}..").format(self.fileParams['name']))
self.paths = self.fileParams['paths']
self.docStruct = self.fileParams['docStruct']
self.settings = self.fileParams['settings']
self.fileName = self.fileParams['name']
self.outPath = self.paths['OUTworkPath']+slugify(self.fileName)+'/'
self.beginTime = time.time()
pass
else:
self.log.critical(tr("Non e' stato fornito il nome di alcun file da splittare!"))
try:
QObject.__init__(self)
self.fileParams = fileParams
self.log = logger
self.rawFile = None
self.status = "first"
self.contentList = list()
self.bodyCounter=0
self.duplicateNumber=0
#self.log.debug(f"Configurazione: \n {json.dumps(fileParams, indent=2)}")
if fileParams is not None:
self.log.debug(self.self.tr("Sto operando sul file: {}..").format(self.fileParams['name']))
self.paths = self.fileParams['paths']
self.docStruct = self.fileParams['docStruct']
self.settings = self.fileParams['settings']
self.fileName = self.fileParams['name']
self.outPath = self.paths['OUTworkPath']+slugify(self.fileName)+'/'
self.beginTime = time.time()
pass
else:
self.log.critical(self.self.tr("Non e' stato fornito il nome di alcun file da splittare!"))
except Exception as e:
print(f"libSplit error: {e}")
pass
def run(self):
self.log.info(tr("Nuovo SPLITTER su file: {}").format(self.fileName))
self.sendStatus.emit(tr(f"Inizio {self.fileName}"))
self.log.info(self.tr("Nuovo SPLITTER su file: {}").format(self.fileName))
self.sendStatus.emit(self.tr(f"Inizio {self.fileName}"))
try:
self.openFile()
self.remEmptyLines()
@@ -48,13 +51,13 @@ class bananaSPLITTER(QObject):
self.splitFile()
if self.settings['removeDuplicates']:
self.log.info(tr("Controllo se ci sono dei duplicati.."))
self.log.info(self.tr("Controllo se ci sono dei duplicati.."))
self.removeDuplicates()
else:
for idx, ff in enumerate(self.contentList):
ff['duplicate']=False
self.contentList[idx]=ff
self.log.warn(tr("Salto il controllo dei duplicati.."))
self.log.warn(self.tr("Salto il controllo dei duplicati.."))
# se il parse e la rimozione dei duplicati e' andata bene
# preparo e inizio il salvataggio
if os.path.exists(self.outPath):
@@ -63,7 +66,7 @@ class bananaSPLITTER(QObject):
for f in os.listdir(self.outPath):
os.remove(self.outPath+f)
else:
raise FileExistsError(tr("Non posso sovrascrivere i vecchi file, eliminali manualmente!"))
raise FileExistsError(self.tr("Non posso sovrascrivere i vecchi file, eliminali manualmente!"))
else:
os.mkdir(self.outPath)
#os.chdir(self.outPath)
@@ -71,10 +74,10 @@ class bananaSPLITTER(QObject):
self.saveSeparate()
if self.settings['saveBodyFile']:
self.saveBody()
self.log.info(tr("L'elaborazione del file ha richiesto {:4.2f} sec").format(time.time()-self.beginTime))
self.log.info(self.tr("L'elaborazione del file ha richiesto {:4.2f} sec").format(time.time()-self.beginTime))
except UnicodeDecodeError as ee:
self.log.critical(tr("Il file [{}] contiene caratteri non compatibili con la codifica scelta! [{}]")
self.log.critical(self.tr("Il file [{}] contiene caratteri non compatibili con la codifica scelta! [{}]")
.format(self.fileParams['name'],ee))
except FileExistsError as fe:
self.log.critical(fe)
@@ -86,12 +89,12 @@ class bananaSPLITTER(QObject):
def openFile(self):
try:
#os.chdir(self.paths["INworkPath"])
self.log.info(tr("Carico il contenuto.."))
self.log.info(self.tr("Carico il contenuto.."))
fp = open(self.paths["INworkPath"]+'/'+self.fileParams['name'], mode='r', encoding=self.settings['encoding'])
self.rawFile = fp.readlines()
fp.close()
except IOError as e:
self.log.critical(tr("Impossibile aprire il file: {}! [{}]").format(self.fileName,e))
self.log.critical(self.tr("Impossibile aprire il file: {}! [{}]").format(self.fileName,e))
raise BaseException("OpenFile")
os.rmdir(self.outPath)
except Exception as ee:
@@ -99,7 +102,7 @@ class bananaSPLITTER(QObject):
pass
def remEmptyLines(self):
self.log.info(tr("Elimino righe vuote e caratteri inutili.."))
self.log.info(self.tr("Elimino righe vuote e caratteri inutili.."))
tempContent = []
try:
for ll in self.rawFile:
@@ -111,12 +114,12 @@ class bananaSPLITTER(QObject):
self.rawFile.append('\n') #linea vuota finale per essere sicuri di parsare bene
return True
except:
self.log.error(tr("Errore inaspettato durante l'eliminazione delle righe vuote!"))
self.log.error(self.tr("Errore inaspettato durante l'eliminazione delle righe vuote!"))
raise BaseException("DelLines")
del tempContent
def newSplitFile(self): #porting del codice dal programma originale
self.log.info(tr("Individuo il contenuto.."))
self.log.info(self.tr("Individuo il contenuto.."))
self.bodyCounter=0
self.duplicateNumber=0
docNumber = 0
@@ -142,7 +145,7 @@ class bananaSPLITTER(QObject):
docDate['month']=self.docStruct['language']['dateWords'].index(docDate['month'])+1
# dopo la data inizia il titolo, ma prima si cerca il nome del giornale
except:
self.log.warn(tr("Ho trovato una riga ambigua.. potrebbe essere una data ma non so: [{}]"). format(l.strip('\r\n')))
self.log.warn(self.tr("Ho trovato una riga ambigua.. potrebbe essere una data ma non so: [{}]"). format(l.strip('\r\n')))
pass
elif lineWords[0].upper() in self.docStruct['language']['headWords']:
#cambio stato e inizializzo un nuovo documento da riempire
@@ -166,13 +169,13 @@ class bananaSPLITTER(QObject):
else:
newsPaperName = self.settings['nameNotFoundStr']
except:
self.log.warn(tr("E' successo qualcosa mentre stavo cercando il nome della pubblicazione,\
self.log.warn(self.tr("E' successo qualcosa mentre stavo cercando il nome della pubblicazione,\
controlla i file di uscita! [{}]").format(l.strip()))
else:
newsPaperName = self.settings['nameNotFoundStr']
newsName = False
except IndexError:
self.log.error(tr("Errore inaspettato, contatta il tuo sviluppatore di fiducia!"))
self.log.error(self.tr("Errore inaspettato, contatta il tuo sviluppatore di fiducia!"))
pass
elif self.status == 'head':
tempContent = list()
@@ -184,7 +187,7 @@ class bananaSPLITTER(QObject):
#self.status = 'body'
elif self.status == 'body':
if re.match(self.docStruct['endOfDocument'],l) is not None: #controlla se ci sono articoli che non hanno le parole chiave finali
self.log.warn(tr("Ho individuato una separatore valido prima che si chiusesse l'articolo precedente, controlla i tuoi file in uscita!\n\
self.log.warn(self.tr("Ho individuato una separatore valido prima che si chiusesse l'articolo precedente, controlla i tuoi file in uscita!\n\
L'errore dovrebbe essere intorno all'articolo {} ma non sono sicuro! \n\t\t\t[{}]").format(docNumber, l.strip()))
self.status = 'tail'
anomaly = True
@@ -211,18 +214,18 @@ class bananaSPLITTER(QObject):
self.bodyCounter +=1
pass
else:
self.log.critical(tr("Stato Interno Sconosciuto"))
self.log.critical(self.tr("Stato Interno Sconosciuto"))
prevLine=l #salva sempre e comunque il contenuto della linea precedente
pass
#ricerca terminata, espongo i risultati
self.log.info(tr("Nel file ho trovato {0} articoli..").format(self.bodyCounter))
self.log.info(self.tr("Nel file ho trovato {0} articoli..").format(self.bodyCounter))
if docSkipped > 0:
self.log.warn(tr("Attentione, LexisNexis ne ha saltati {} !!!").format(docSkipped))
self.log.warn(self.tr("Attentione, LexisNexis ne ha saltati {} !!!").format(docSkipped))
pass
pass
def splitFile(self): #porting del codice dal programma originale
self.log.info(tr("Individuo il contenuto.."))
self.log.info(self.tr("Individuo il contenuto.."))
self.bodyCounter=0
self.duplicateNumber=0
docNumber = 0
@@ -246,7 +249,7 @@ class bananaSPLITTER(QObject):
pass
else:
if self.settings["showSkipped"]:
self.log.warn(tr("Il conto dei documenti non torna! LexisNexis ne ha saltato qualcuno!\n Precedente:{0}-Attuale:{1}").format(docNumber,nn["current"]))
self.log.warn(self.tr("Il conto dei documenti non torna! LexisNexis ne ha saltato qualcuno!\n Precedente:{0}-Attuale:{1}").format(docNumber,nn["current"]))
docSkipped+=1
docNumber = nn["current"]
except:
@@ -267,12 +270,12 @@ class bananaSPLITTER(QObject):
else:
newsPaperName = self.settings['nameNotFoundStr']
except:
self.log.warn(tr("E' successo qualcosa mentre stavo cercando il nome della pubblicazione,\
self.log.warn(self.tr("E' successo qualcosa mentre stavo cercando il nome della pubblicazione,\
controlla i file di uscita! [{}]").format(prevLine.strip()))
else:
newsPaperName = self.settings['nameNotFoundStr']
except:
self.log.warn(tr("Ho trovato una riga ambigua.. potrebbe essere una data ma non so: [{}]").format(l.strip('\r\n')))
self.log.warn(self.tr("Ho trovato una riga ambigua.. potrebbe essere una data ma non so: [{}]").format(l.strip('\r\n')))
pass
elif lineWords[0] in self.docStruct['language']['headWords']:
#cambio stato e inizializzo un nuovo documento da riempire
@@ -286,7 +289,7 @@ class bananaSPLITTER(QObject):
if titleBegin:
title += l.strip().capitalize()
except IndexError:
self.log.error(tr("Errore inaspettato, contatta il tuo sviluppatore di fiducia!"))
self.log.error(self.tr("Errore inaspettato, contatta il tuo sviluppatore di fiducia!"))
pass
elif self.status == 'head':
tempContent = list()
@@ -304,7 +307,7 @@ class bananaSPLITTER(QObject):
self.status = 'tail'
anomaly = False
if docSep.match(l) is not None: #controlla se ci sono articoli che non hanno le parole chiave finali
self.log.warn(tr("Ho individuato una separatore valido prima che si chiusesse l'articolo precedente, controlla i tuoi file in uscita!\n\
self.log.warn(self.tr("Ho individuato una separatore valido prima che si chiusesse l'articolo precedente, controlla i tuoi file in uscita!\n\
L'errore dovrebbe essere intorno all'articolo {} ma non sono sicuro! \n\t\t[{}]").format(docNumber, l.strip()))
self.status = 'tail'
anomaly = True
@@ -321,13 +324,13 @@ class bananaSPLITTER(QObject):
self.bodyCounter +=1
pass
else:
self.log.critical(tr("Stato Interno Sconosciuto"))
self.log.critical(self.tr("Stato Interno Sconosciuto"))
prevLine=l #salva sempre e comunque il contenuto della linea precedente
pass
#ricerca terminata, espongo i risultati
self.log.info(tr("Nel file ho trovato {0} articoli..").format(self.bodyCounter))
self.log.info(self.tr("Nel file ho trovato {0} articoli..").format(self.bodyCounter))
if docSkipped > 0:
self.log.warn(tr("Attentione, LexisNexis ne ha saltati {} !!!").format(docSkipped))
self.log.warn(self.tr("Attentione, LexisNexis ne ha saltati {} !!!").format(docSkipped))
pass
pass
@@ -344,18 +347,18 @@ class bananaSPLITTER(QObject):
if ff['title'] not in duplicateList:
duplicateList.append(ff['title'])
if self.settings['showRemovedDuplicates']:
self.log.info(tr("Duplicato: {}").format(ff['title'].strip()))
self.log.info(self.tr("Duplicato: {}").format(ff['title'].strip()))
ff['duplicate'] = True
self.contentList[idx]=ff
self.duplicateNumber+=1
self.log.info(tr("Ho rimosso {} duplicati di {} articoli..").format(self.duplicateNumber, len(duplicateList)))
self.log.info(self.tr("Ho rimosso {} duplicati di {} articoli..").format(self.duplicateNumber, len(duplicateList)))
pass
def saveSeparate(self):
outFileCounter = 0
self.paths['OUTworkPath']=self.paths['OUTworkPath']+slugify(self.fileName)
self.log.info(tr("Salvo gli articoli in file separati..."))
self.log.debug(tr("Persorso: {0}").format(self.outPath))
self.log.info(self.tr("Salvo gli articoli in file separati..."))
self.log.debug(self.tr("Persorso: {0}").format(self.outPath))
for ff in self.contentList:
try:
if ff['duplicate'] == False:
@@ -371,20 +374,20 @@ class bananaSPLITTER(QObject):
out.close()
outFileCounter+=1
except IOError as e:
self.log.error(tr("Qualcosa e\' andato storto, non riesco a scrivere il file: {}").format(e))
self.log.error(self.tr("Qualcosa e\' andato storto, non riesco a scrivere il file: {}").format(e))
continue
except KeyError as ke:
self.log.error(tr(f"Chiave {ke} non trovata per:{outFileCounter} {ff['title']} "))
self.log.error(self.tr(f"Chiave {ke} non trovata per:{outFileCounter} {ff['title']} "))
except Exception as ee:
traceback.print_exc()
self.log.error(tr(f"Errore generale nel salvataggio: {ee}"))
self.log.error(self.tr(f"Errore generale nel salvataggio: {ee}"))
if outFileCounter < self.bodyCounter:
self.log.error(tr("Ho salvato meno file rispetto a quelli trovati!"))
self.log.error(self.tr("Ho salvato meno file rispetto a quelli trovati!"))
pass
def saveBody(self):
self.log.info(tr('Salvo gli articoli in un singolo file vicino agli originali...'))
self.log.debug(tr('Persorso: {0}').format(self.outPath))
self.log.info(self.tr('Salvo gli articoli in un singolo file vicino agli originali...'))
self.log.debug(self.tr('Persorso: {0}').format(self.outPath))
#os.chdir(self.outPath)
try:
fName=slugify(self.fileName)
@@ -394,9 +397,9 @@ class bananaSPLITTER(QObject):
out.write(fileContent.encode(self.settings['encoding']))
out.close()
except IOError as e:
self.log.error(tr("Qualcosa e\' andato storto, non riesco a scrivere il file: {}").format(e))
self.log.error(self.tr("Qualcosa e\' andato storto, non riesco a scrivere il file: {}").format(e))
except Exception as ee:
self.log.error(tr(f"Errore generale nel salvataggio: {ee}"))
self.log.error(self.tr(f"Errore generale nel salvataggio: {ee}"))
pass

View File

@@ -16,7 +16,7 @@ if __name__ == '__main__':
fp = open(r".\\CompiledUI\\"+f.replace("ui","py"), 'w')
fp.write(str(rv.stdout, encoding='utf-8').replace('\r', ''))
fp.close()
command = r'pyrcc5.exe '+'.resources\\resources.qrc'
command = r'pyrcc5.exe '+'.\\resources\\resources.qrc'
print (command)
rv = subprocess.run(command, capture_output=True)
fp = open(r".\\compiledUI\\resources_rc.py", 'w')