179 lines
5.6 KiB
Python
179 lines
5.6 KiB
Python
'''
|
|
Created on 2 nov 2019
|
|
|
|
@author: Emanuele Trabattoni
|
|
'''
|
|
import sys
|
|
import PyQt5.QtWidgets
|
|
|
|
from mainwindow import Ui_mainwin
|
|
from selezout import Ui_selezout
|
|
from titolow import Ui_titolo
|
|
from avanzatetitolo3 import Ui_advtitolo3 as Ui_advtitolo
|
|
from opzioniavanzate import Ui_advoption
|
|
|
|
from libfancylogger import fancyLogger
|
|
from libconfload import bananaCONF
|
|
from libsplit import bananaSPLITTER
|
|
|
|
class bananaMain(PyQt5.QtWidgets.QMainWindow):
|
|
def __init__(self):
|
|
PyQt5.QtWidgets.QMainWindow.__init__(self)
|
|
try:
|
|
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")
|
|
except:
|
|
sys.exit()
|
|
|
|
# inizializzazione interfaccia
|
|
self.ui = Ui_mainwin()
|
|
self.ui.setupUi(self)
|
|
self.titolo = bananaTitolo(self.conf)
|
|
self.titoloav = bananaTitoloAvanzate(self.conf)
|
|
self.selezout = bananaSelezOut(self.conf)
|
|
self.advopt = bananaAdvOpt(self.conf)
|
|
|
|
#popola le tab con le finestre giuste
|
|
self.ui.wgt_main.addTab(self.titolo, "Titolo")
|
|
self.ui.wgt_main.addTab(self.selezout, "SelezioneOutput")
|
|
|
|
# connetti bottoni avanti
|
|
self.ui.btn_avanti.clicked.connect(self.nextTab)
|
|
self.titolo.titoloui.btn_avanti.clicked.connect(self.nextTab)
|
|
self.selezout.selezoutui.btn_avanti.clicked.connect(self.nextTab)
|
|
|
|
#connetti bottoni indietro
|
|
self.titolo.titoloui.btn_indietro.clicked.connect(self.prevTab)
|
|
self.selezout.selezoutui.btn_indietro.clicked.connect(self.prevTab)
|
|
|
|
#connetti bottoni selezione cartelle
|
|
self.ui.btn_cartellasorg.clicked.connect(self.selezSorg)
|
|
self.ui.btn_cartelladest.clicked.connect(self.selezDest)
|
|
|
|
#connetti action tab
|
|
self.ui.actionLingua.triggered.connect(self.openLanguage)
|
|
self.ui.actionAvanzate.triggered.connect(self.openAdvOpt)
|
|
self.ui.actionCarica_Preset.triggered.connect(self.openLoadPreset)
|
|
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'))
|
|
pass
|
|
|
|
def nextTab(self):
|
|
self.ui.wgt_main.setCurrentIndex(self.ui.wgt_main.currentIndex()+1)
|
|
self.logger.debug("Prossima Tab")
|
|
pass
|
|
|
|
def prevTab(self):
|
|
self.ui.wgt_main.setCurrentIndex(self.ui.wgt_main.currentIndex()-1)
|
|
self.logger.debug("Tab Precedente")
|
|
pass
|
|
|
|
def openLoadPreset(self):
|
|
self.logger.debug("Apri Carica Preset")
|
|
pass
|
|
|
|
def openSavePreset(self):
|
|
self.logger.debug("Apri Salva Preset")
|
|
pass
|
|
|
|
def openAdvOpt(self):
|
|
self.logger.debug("Apri Opzioni Avanzate")
|
|
pass
|
|
|
|
def openLanguage(self):
|
|
self.logger.debug("Apri Opzioni Lingua")
|
|
pass
|
|
|
|
def selezSorg(self):
|
|
rv = PyQt5.QtWidgets.QFileDialog.getExistingDirectory(self,"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.debug("Selezionata Cartella Sorgente: {}".format(rv))
|
|
pass
|
|
|
|
def selezDest(self):
|
|
rv = PyQt5.QtWidgets.QFileDialog.getExistingDirectory(self,"Seleziona Cartella Destinazione",self.conf.getParam('paths','OUTworkPath'))
|
|
if rv is not "":
|
|
self.conf.setParam(keys=('paths','OUTworkPath',), val=rv)
|
|
self.ui.btn_dest.setText(rv)
|
|
self.logger.debug("Selezionata Cartella Destinazione: {}".format(rv))
|
|
pass
|
|
|
|
def openFileDialog(self, name, path):
|
|
self.log.debug("Apro in directory: {}".format(path))
|
|
return
|
|
|
|
#############################################################
|
|
####################### INTERFACES ##########################
|
|
#############################################################
|
|
|
|
class bananaTitolo(PyQt5.QtWidgets.QWidget):
|
|
def __init__(self, confloader=None):
|
|
PyQt5.QtWidgets.QWidget.__init__(self)
|
|
self.titoloui = Ui_titolo()
|
|
self.titoloui.setupUi(self)
|
|
self.conf = confloader
|
|
if self.conf is not None:
|
|
self.advtitolo = bananaTitoloAvanzate(self.conf)
|
|
self.titoloui.btn_avanzate.clicked.connect(self.spawnAvanzate)
|
|
pass
|
|
|
|
def spawnAvanzate(self):
|
|
self.advtitolo.show()
|
|
pass
|
|
|
|
|
|
class bananaTitoloAvanzate(PyQt5.QtWidgets.QWidget):
|
|
def __init__(self, confloader=None):
|
|
PyQt5.QtWidgets.QWidget.__init__(self)
|
|
self.titoloavui = Ui_advtitolo()
|
|
self.titoloavui.setupUi(self)
|
|
self.titoloavui.btn_OK.clicked.connect(self.returnOk)
|
|
self.titoloavui.btn_annulla.clicked.connect(self.returnKo)
|
|
pass
|
|
|
|
def returnOk(self, conf):
|
|
pass
|
|
|
|
def returnKo(self, conf):
|
|
pass
|
|
|
|
|
|
class bananaSelezOut(PyQt5.QtWidgets.QWidget):
|
|
def __init__(self, confloader=None):
|
|
PyQt5.QtWidgets.QWidget.__init__(self)
|
|
self.selezoutui = Ui_selezout()
|
|
self.selezoutui.setupUi(self)
|
|
pass
|
|
|
|
class bananaAdvOpt(PyQt5.QtWidgets.QWidget):
|
|
def __init__(self, confloader=None):
|
|
PyQt5.QtWidgets.QWidget.__init__(self)
|
|
self.advoptui = Ui_advoption()
|
|
self.advoptui.setupUi(self)
|
|
pass
|
|
|
|
class bananaSplitterInterface(PyQt5.QtWidgets.QWidget):
|
|
def __init__(self, confloader=None):
|
|
PyQt5.QtWidgets.QWidget.__init__(self)
|
|
pass
|
|
|
|
#############################################################
|
|
####################### MAIN ################################
|
|
#############################################################
|
|
|
|
if __name__ == '__main__':
|
|
app = PyQt5.QtWidgets.QApplication(sys.argv)
|
|
window = bananaMain()
|
|
window.resize(window.sizeHint().width(), window.size().height())
|
|
window.show()
|
|
rv = app.exec()
|
|
print("ExitCode: {}".format(rv))
|
|
sys.exit(rv)
|
|
pass |