Exemplo n.º 1
0
    def __init__(self, parent):
        wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX)
        self.parent = parent
        
        # Init moteur vocal
        self.vocal = UTILS_Vocal.Vocal() 
        
        # Bandeau
        intro = _(u"Vous pouvez paramétrer et tester ici la synthèse vocale utilisée par Noethys. Attention, si ce n'est pas déjà fait, téléchargez dès à présent la voix française ci-dessous !")
        titre = _(u"Synthèse vocale")
        self.SetTitle(titre)
        self.ctrl_bandeau = CTRL_Bandeau.Bandeau(self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Vocal.png")
        
        # Paramètres
        self.box_parametres_staticbox = wx.StaticBox(self, -1, _(u"Paramètres de la voix"))
        self.label_voix = wx.StaticText(self, -1, _(u"Voix actuelle :"))
        self.ctrl_voix = CTRL_Voix(self, vocal=self.vocal)
        
        # Avertissement
        self.ctrl_avertissement = CTRL_Avertissement(self)
        self.MAJAvertissement() 
        
        # Corrections
        self.box_corrections_staticbox = wx.StaticBox(self, -1, _(u"Corrections phoniques"))
        self.ctrl_corrections = OL_Corrections_phoniques.ListView(self, id=-1, style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_SINGLE_SEL|wx.LC_HRULES|wx.LC_VRULES)
        self.ctrl_corrections.MAJ() 
        self.bouton_ajouter = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Ajouter.png"), wx.BITMAP_TYPE_ANY))
        self.bouton_modifier = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Modifier.png"), wx.BITMAP_TYPE_ANY))
        self.bouton_supprimer = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Supprimer.png"), wx.BITMAP_TYPE_ANY))

        # Test
        self.box_test_staticbox = wx.StaticBox(self, -1, _(u"Test"))
        self.ctrl_test = wx.TextCtrl(self, -1, u"")

        # Boutons
        self.bouton_test = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Vocal.png"), wx.BITMAP_TYPE_ANY))
        self.bouton_aide = CTRL_Bouton_image.CTRL(self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png")
        self.bouton_fermer = CTRL_Bouton_image.CTRL(self, id=wx.ID_CANCEL, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_CHOICE, self.OnChoixVoix, self.ctrl_voix)
        self.Bind(wx.EVT_BUTTON, self.OnAjouterCorrection, self.bouton_ajouter)
        self.Bind(wx.EVT_BUTTON, self.OnModifierCorrection, self.bouton_modifier)
        self.Bind(wx.EVT_BUTTON, self.OnSupprimerCorrection, self.bouton_supprimer)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonTest, self.bouton_test)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)
        
        if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel("parametrage_vocal", "modifier", afficheMessage=False) == False : 
            self.ctrl_voix.Enable(False)
            self.bouton_ajouter.Enable(False)
            self.bouton_modifier.Enable(False)
            self.bouton_supprimer.Enable(False)
Exemplo n.º 2
0
    def LancementProcedure(self, importationManuelle=False) :
        modeDebug = wx.GetKeyState(307) # CONSERVER LA TOUCHE ALT ENFONCEE POUR LE MODE DEBUG
        
        # Validation des données
        IDprocedure = self.ctrl_procedure.GetID() 
        if IDprocedure == None :
            dlg = wx.MessageDialog(self, _(u"Vous devez obligatoirement sélectionner une procédure !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_procedure.SetFocus()
            return False
        
        date = self.ctrl_date.GetDate()
        if date == None :
            dlg = wx.MessageDialog(self, _(u"Vous devez obligatoirement saisir une date !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_date.SetFocus()
            return False
        
        if date != datetime.date.today() :
            dlg = wx.MessageDialog(self, _(u"Vous avez sélectionné une date différente d'aujourd'hui. Confirmez-vous ce choix ?"), _(u"Date"), wx.YES_NO|wx.YES_DEFAULT|wx.ICON_EXCLAMATION)
            reponse = dlg.ShowModal()
            dlg.Destroy()
            if reponse != wx.ID_YES:
                return False

        # Vérifie si voix française disponible
        try :
            vocal = UTILS_Vocal.Vocal() 
            if vocal.VerifieSiVirginieInstallee() == False :
                dlg = wx.MessageDialog(self, _(u"Attention, la voix française n'est pas installée sur votre ordinateur.\n\nSouhaitez-vous l'installer maintenant (Conseillé) ?"), _(u"Synthèse vocale"), wx.YES_NO|wx.YES_DEFAULT|wx.ICON_EXCLAMATION)
                reponse = dlg.ShowModal()
                dlg.Destroy()
                if reponse == wx.ID_YES:
                    self.OnBoutonVocal(None)
            else :
                if vocal.VerifieSiVirginieDefaut() == False :
                    dlg = wx.MessageDialog(self, _(u"Attention, la voix française est bien installée sur votre ordinateur mais n'a pas été sélectionnée comme voix par défaut.\n\nSouhaitez-vous le faire maintenant (conseillé) ?"), _(u"Synthèse vocale"), wx.YES_NO|wx.YES_DEFAULT|wx.ICON_EXCLAMATION)
                    reponse = dlg.ShowModal()
                    dlg.Destroy()
                    if reponse == wx.ID_YES:
                        self.OnBoutonVocal(None)
        except Exception, err:
            print "Erreur dans module vocal depuis badgeage :", err
Exemplo n.º 3
0
    def LancementProcedure(self, importationManuelle=False):
        if self.mode_debug == True or wx.GetKeyState(307):
            modeDebug = True  # CONSERVER LA TOUCHE ALT ENFONCEE POUR LE MODE DEBUG
        else:
            modeDebug = False

        # Validation des données
        IDprocedure = self.ctrl_procedure.GetID()
        if IDprocedure == None:
            dlg = wx.MessageDialog(
                self,
                _(u"Vous devez obligatoirement sélectionner une procédure !"
                  ), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_procedure.SetFocus()
            return False

        date = self.ctrl_date.GetDate()
        if date == None:
            dlg = wx.MessageDialog(
                self, _(u"Vous devez obligatoirement saisir une date !"),
                _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_date.SetFocus()
            return False

        if date != datetime.date.today():
            dlg = wx.MessageDialog(
                self,
                _(u"Vous avez sélectionné une date différente d'aujourd'hui. Confirmez-vous ce choix ?"
                  ), _(u"Date"),
                wx.YES_NO | wx.YES_DEFAULT | wx.ICON_EXCLAMATION)
            reponse = dlg.ShowModal()
            dlg.Destroy()
            if reponse != wx.ID_YES:
                return False

        # Vérifie si voix française disponible
        try:
            vocal = UTILS_Vocal.Vocal()
            if vocal.VerifieSiVirginieInstallee() == False:
                if UTILS_Parametres.Parametres(mode="get",
                                               categorie="ne_plus_afficher",
                                               nom="voix_virginie",
                                               valeur=False) == False:
                    introduction = _(
                        u"Souhaitez-vous installer la voix française Virginie pour la synthèse vocale ?"
                    )
                    dlg = DLG_Messagebox.Dialog(self,
                                                titre=_(u"Avertissement"),
                                                introduction=introduction,
                                                icone=wx.ICON_EXCLAMATION,
                                                boutons=[
                                                    _(u"Oui"),
                                                    _(u"Pas maintenant"),
                                                    _(u"Ne plus demander")
                                                ],
                                                defaut=0)
                    reponse = dlg.ShowModal()
                    dlg.Destroy()
                    if reponse == 0:
                        self.OnBoutonVocal(None)
                    if reponse == 2:
                        UTILS_Parametres.Parametres(
                            mode="set",
                            categorie="ne_plus_afficher",
                            nom="voix_virginie",
                            valeur=True)
            else:
                if vocal.VerifieSiVirginieDefaut() == False:
                    dlg = wx.MessageDialog(
                        self,
                        _(u"La voix française Virginie est bien installée sur votre ordinateur mais n'a pas été sélectionnée comme voix par défaut.\n\nSouhaitez-vous le faire maintenant (conseillé) ?"
                          ), _(u"Synthèse vocale"),
                        wx.YES_NO | wx.YES_DEFAULT | wx.ICON_EXCLAMATION)
                    reponse = dlg.ShowModal()
                    dlg.Destroy()
                    if reponse == wx.ID_YES:
                        self.OnBoutonVocal(None)
        except Exception as err:
            print("Erreur dans module vocal depuis badgeage :", err)

        # Envoi l'info de lancement au log
        nomProcedure = self.ctrl_procedure.GetNom()
        self.log.AjouterAction(action=_(u"Lancement de la procédure '%s'") %
                               nomProcedure)

        # Rappel de la combinaison de touches pour quitter la fenêtre
        if importationManuelle == False and modeDebug == False:
            dlg = wx.MessageDialog(
                self,
                _(u"Appuyez sur CTRL+SHIFT+Q pour\nquitter l'interface de badgeage."
                  ), _(u"Information"), wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()

        # Ouvre la fenêtre de badgeage
        if modeDebug == True:
            style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX  # CONSERVER LA TOUCHE ALT ENFONCEE POUR EVITER L'AFFICHAGE PLEIN ECRAN
        else:
            style = wx.BORDER_NONE
        dlg = DLG_Badgeage_interface.Dialog(
            self,
            log=self.ctrl_log,
            IDprocedure=IDprocedure,
            date=date,
            dateauto=self.check_dateauto.GetValue(),
            importationManuelle=importationManuelle,
            style=style,
            mode_debug=modeDebug)
        if modeDebug == False:
            dlg.ShowFullScreen(wx.FULLSCREEN_ALL)
        dlg.ShowModal()
        try:
            dlg.Destroy()
        except:
            pass

        # Envoi l'info de l'arrêt au log
        self.log.AjouterAction(action=_(u"Arrêt de la procédure '%s'") %
                               nomProcedure)