예제 #1
0
    def on_main_iconview_select(self, icon_view, model=None):

        selected = icon_view.get_selected_items()
        if len(selected) == 0:
            return
        i = selected[0]
        selection = self.iconview_listore[i][0]

        if selection == 3:
            if not hasAction(actionID=2):
                return
            from promogest.ui.anagDocumenti.AnagraficaDocumenti import AnagraficaDocumenti
            anag = AnagraficaDocumenti(aziendaStr=self.aziendaStr)
            showAnagrafica(self.getTopLevel(), anag, mainClass=self)
            icon_view.unselect_all()
            return
        elif selection == 4:
            if not hasAction(actionID=15):
                return
            from promogest.modules.PrimaNota.ui.AnagraficaPrimaNota import AnagraficaPrimaNota
            anag = AnagraficaPrimaNota(aziendaStr=self.aziendaStr)
            showAnagrafica(self.getTopLevel(), anag, mainClass=self)
            icon_view.unselect_all()
            return
        elif selection == 5:
            if posso("PR"):
                from promogest.ui.anagPromemoria.AnagraficaPromemoria import AnagraficaPromemoria
                anag = AnagraficaPromemoria(self.aziendaStr)
                showAnagrafica(self.getTopLevel(), anag, mainClass=self)
                icon_view.unselect_all()
                return
            else:
                fencemsg()
        elif selection == 10: #gestione commessa
            #if posso("GC"):
            from promogest.modules.GestioneCommesse.ui.AnagraficaCommesse import AnagraficaCommesse
            anag = AnagraficaCommesse(aziendaStr=self.aziendaStr)
            showAnagrafica(self.getTopLevel(), anag, mainClass=self)
            icon_view.unselect_all()
            return

        else:
            i = selected[0][0]
            selection = self.iconview_listore[i][0]
            module = self.iconview_listore[i][3]

            if self.currentFrame is not None:
                self.main_hbox.remove(self.currentFrame)
                self.currentFrame.destroy()
                self.currentFrame = None
            if module.VIEW_TYPE[0] == 'anagrafica_diretta':
                anag = module.getApplication()
                showAnagrafica(self.getTopLevel(), anag, mainClass=self)
                icon_view.unselect_all()
                return
            elif module.VIEW_TYPE[0] == 'frame':
                frame = module.getApplication()
                self.currentFrame = frame.getTopLevel()
        self.main_notebook.set_current_page(0)
        self._refresh()
예제 #2
0
 def on_articoli_button_clicked(self, toggleButton):
     if not hasAction(actionID=2):
         return
     if toggleButton.get_property('active') is False:
         return
     from promogest.ui.anagArti.AnagraficaArticoli import AnagraficaArticoli
     anag = AnagraficaArticoli(aziendaStr=Environment.azienda)
     showAnagrafica(self.getTopLevel(), anag, toggleButton, mainClass=self)
예제 #3
0
    def on_documenti_button_clicked(self, toggleButton):
        if toggleButton.get_property('active') is False:
            return
        if not hasAction(actionID=2):return
        from promogest.ui.anagDocumenti.AnagraficaDocumenti import AnagraficaDocumenti
        anag = AnagraficaDocumenti(aziendaStr=self.aziendaStr)

        showAnagrafica(self.mainWindow, anag, toggleButton)
예제 #4
0
 def on_imballaggi_button_clicked(self, toggleButton):
     if toggleButton.get_property('active') is False:
         return
     if not hasAction(actionID=6):
         toggleButton.set_active(False)
         return
     from AnagraficaImballaggi import AnagraficaImballaggi
     anag = AnagraficaImballaggi()
     showAnagrafica(self.getTopLevel(), anag, toggleButton, mainClass=self)
예제 #5
0
 def on_aliquote_iva_button_clicked(self, toggleButton):
     if toggleButton.get_property('active') is False:
         return
     if not hasAction(actionID=6):
         toggleButton.set_active(False)
         return
     from AnagraficaAliquoteIva import AnagraficaAliquoteIva
     anag = AnagraficaAliquoteIva()
     showAnagrafica(self.getTopLevel(), anag, toggleButton, mainClass=self)
예제 #6
0
 def on_categorie_contatti_button_clicked(self, toggleButton):
     if toggleButton.get_property('active') is False:
         return
     if not hasAction(actionID=6):
         toggleButton.set_active(False)
         return
     from promogest.ui.Contatti.AnagraficaCategorieContatti import AnagraficaCategorieContatti
     anag = AnagraficaCategorieContatti()
     showAnagrafica(self.getTopLevel(), anag, toggleButton, mainClass=self)
예제 #7
0
    def on_stadio_commessa_button_toggled(self, toggleButton):

        if toggleButton.get_property('active') is False:
            return
        if not hasAction(actionID=6):
            toggleButton.set_active(False)
            return
#        if posso("GC"):
#        messageInfo(msg="""RICORDIAMO CHE QUESTO MODULO E' ANCORA IN FASE DI TEST """)
        from promogest.modules.GestioneCommesse.ui.AnagraficaStadioCommessa import AnagraficaStadioCommessa
        anag = AnagraficaStadioCommessa()
        showAnagrafica(self.getTopLevel(), anag, toggleButton, mainClass=self)
예제 #8
0
 def on_ruoli_azioni_button_toggled(self, toggleButton):
     if toggleButton.get_property('active') is False:
         return
     if not hasAction(actionID=6):
         toggleButton.set_active(False)
         return
     if posso("RA"):
         from promogest.modules.RuoliAzioni.ui.ManageRoleAction import ManageRuoloAzioni
         anag = ManageRuoloAzioni()
         showAnagrafica(self.getTopLevel(), anag, toggleButton, mainClass=self)
     else:
         fencemsg()
         toggleButton.set_property('active', False)
예제 #9
0
 def on_agenti_button_clicked(self, toggleButton):
     if toggleButton.get_property('active') is False:
         return
     if not hasAction(actionID=6):
         toggleButton.set_active(False)
         return
     if posso("AG"):
         from promogest.ui.anagAgenti.AnagraficaAgenti import AnagraficaAgenti
         anag = AnagraficaAgenti(aziendaStr=self.aziendaStr)
         showAnagrafica(self.getTopLevel(), anag, toggleButton, mainClass=self)
     else:
         fencemsg()
         toggleButton.set_active(False)
예제 #10
0
    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'))
예제 #11
0
    def on_configurazione_menu_activate(self, widget):
        if not hasAction(actionID=14):return
        configuraWindow = ConfiguraWindow(self)
#        configuraWindow = SetConfUI(self)
        showAnagrafica(self.getTopLevel(), configuraWindow)
예제 #12
0
 def create_parametri_frame(self):
     if not hasAction(actionID=6):return
     if self.currentFrame is not None:
         self.main_hbox.remove(self.currentFrame)
     frame = ParametriFrame(self.main_window, self.aziendaStr, modules=self.parametri_modules)
     return frame.getTopLevel()
예제 #13
0
 def create_registrazioni_frame(self):
     if not hasAction(actionID=2):return
     if self.currentFrame is not None:
         self.main_hbox.remove(self.currentFrame)
     frame = RegistrazioniFrame(self.main_window, self.aziendaStr)
     return frame.getTopLevel()
예제 #14
0
    def create_anagrafiche_principali_frame(self):
        if not hasAction(actionID=11):return
#        if self.currentFrame is not None:
#            self.main_hbox.remove(self.currentFrame)
        frame = AnagrafichePrincipaliFrame(self.main_window, self.aziendaStr, modules=self.anagrafiche_modules)
        return frame.getTopLevel()