def on_test_promowear_button_clicked(self, button): msg = _( """PROVIAMO IL MODULO DI TAGLIA E COLORE o PROMOWEAR, Procedo? """ ) if not YesNoDialog(msg=msg, transient=self.getTopLevel()): return from data.createSchemaDb import orderedInstallPromoWear if orderedInstallPromoWear(): if not setconf("PromoWear","mod_enable",value="yes"): a = SetConf() a.section = "PromoWear" a.tipo_section ="Modulo" a.description = "Modulo Taglia e colore" a.tipo = "bool" a.key = "mod_enable" a.value = "yes" a.persist() messageInfo(msg=_("RIAVVIA IL PROMOGEST")) Environment.delete_pickle() Environment.restart_program()
def on_test_promoshop_button_clicked(self, button): from promogest.dao.Setconf import SetConf msg = _(""" PROVIAMO IL MODULO VENDITA DETTAGLIO o PROMOSHOP, Procedo? """) if not YesNoDialog(msg=msg, transient=self.getTopLevel()): return if not setconf("VenditaDettaglio","mod_enable",value="yes"): a = SetConf() a.section = "VenditaDettaglio" a.tipo_section ="Modulo" a.description = "Modulo Vendita Dettaglio" a.tipo = "bool" a.key = "mod_enable" a.value = "yes" a.persist() a = SetConf() a.section = "VenditaDettaglio" a.tipo_section ="Modulo" a.description = "Nome del movimento generato" a.tipo = "str" a.key = "operazione" a.value = "Scarico venduto da cassa" a.persist() a = SetConf() a.section = "VenditaDettaglio" a.tipo_section ="Modulo" a.description = "disabilita_stampa" a.tipo = "bool" a.key = "disabilita_stampa" a.value = "True" a.active = True a.persist() from data.createSchemaDb import orderedInstallVenditaDettaglio orderedInstallVenditaDettaglio() messageInfo(msg=_("RIAVVIA IL PROMOGEST")) Environment.delete_pickle() Environment.restart_program() else: messageInfo(msg=_("RISULTA GIA' ATTIVATO"))
def on_button_login_clicked(self, button=None): """ """ #username = self.username_comboxentry.child.get_text() username = self.username_entry.get_text() password = self.password_entry.get_text() if username == '' or password == '': messageInfo(msg=_('Inserire nome utente e password')) return elif Environment.engine.name != "sqlite" and \ findStrFromCombobox(self.azienda_combobox, 0) == '': messageInfo(msg=_("Occorre selezionare un'azienda")) return else: #if hasattr(self,"azienda_combobox"): self.azienda = findStrFromCombobox(self.azienda_combobox, 0) findComboboxRowFromStr(self.azienda_combobox, self.azienda, 0) self.azienda_combobox.get_active() != -1 #if not self.azienda: #self.azienda = "AziendaPromo" #superati i check di login users = User().select(username=username, password=hashlib.md5(username + password).hexdigest()) if not users: users = User().select(username=str(username).strip()) if users: try: from promogest.lib.utils import AESCipher, ops r = AESCipher(ops).decrypt( users[0].password) if r != password: messageInfo(msg=_('Password errata')) except: rows = [] if len(users) == 1: if users[0].active == False: messageInfo(msg=_('Utente Presente Ma non ATTIVO')) return else: Environment.workingYear = str(self.anno_lavoro_spinbutton.get_value_as_int()) oldSchema = Environment.params["schema"] Environment.azienda = self.azienda for a in self.azs: if a.schemaa == self.azienda: a.tipo_schemaa = "last" else: a.tipo_schemaa = "" Environment.session.add(a) Environment.session.commit() if Environment.tipodb == "postgresql": Environment.params["schema"] = self.azienda Environment.fk_prefix = Environment.params["schema"] + '.' if self.azienda not in Environment.meta._schemas: print(" PICKLE NON VA BENE") #Environment.azienda = oldSchema Environment.delete_pickle() # import pickle # cachefile = 'orm.p' # Environment.meta.create_all() # with open(cachefile, 'w') as cache: # pickle.dump(Environment.meta, cache) # cache.close() # Lancio la funzione di generazione della dir di configurazione from promogest.buildEnv import set_configuration Environment.conf = set_configuration(Environment.azienda, Environment.workingYear) # if setconf("Feed","feed"): # if True == True: # thread = threading.Thread(target=self.feddretreive) # thread.start() # thread.join(2.3) files = glob.glob(Environment.tempDir+"/*") for f in files: os.remove(f) Environment.params['usernameLoggedList'][0] = users[0].id Environment.params['usernameLoggedList'][1] =\ users[0].username try: Environment.params['usernameLoggedList'][2] =\ users[0].id_role except: Environment.params['usernameLoggedList'][2] = 1 if hasAction(actionID=1): self.login_window.hide() Environment.windowGroup.remove(self.getTopLevel()) installId() Environment.pg2log.info( "LOGIN id, user, role azienda: %s, %s" % ( repr(Environment.params['usernameLoggedList']), self.azienda)) checkInstallation() from promogest.dao.Setconf import SetConf avv = SetConf().select(key="avvii") if avv: avv[0].value = int(avv[0].value)+1 Environment.avvii = int(avv[0].value)+1 avv[0].persist() Environment.settaggi = Environment.session.query( SetConf.key, SetConf.value).all() Environment.pg2log.info( "SETAGGI: %s" % (str(Environment.settaggi))) self.importModulesFromDir('promogest/modules') # ATTENZIONE!!! RIATTIVARE!!! from promogest.dao.DaoOrderedImport import orderedImport orderedImport() def mainmain(): from Main import Main main = Main(self.azienda, self.anagrafiche_modules, self.parametri_modules, self.anagrafiche_dirette_modules, self.frame_modules, self.permanent_frames) main.getTopLevel().connect("destroy", on_main_window_closed, self.login_window) main.show() glib.idle_add(mainmain) else: messageInfo(msg=_('Nome utente o password errati, Riprova'))