コード例 #1
0
 def __init__(self, parent, IDpersonne=None):
     wx.Panel.__init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL)
     self.IDpersonne = IDpersonne
     
     # Choix décoration
     self.label_decoration = wx.StaticText(self, -1, _(u"Cadre de décoration :"), style=wx.ALIGN_RIGHT)
     listeCadres = FonctionsPerso.GetListeCadresPhotos()
     self.combobox_decoration = wx.Choice(self, -1, choices=listeCadres)
     
     # Recherche du cadre de décoration attribué à la personne
     cadrePhoto, textePhoto = CTRL_Photo.GetCadreEtTexte(self.IDpersonne)
     if cadrePhoto != None and cadrePhoto != "" :
         self.combobox_decoration.SetStringSelection(cadrePhoto)
     else:
         self.combobox_decoration.SetSelection(0)
     
     # Saisie du texte personnalisé
     self.label_texte_perso = wx.StaticText(self, -1, _(u"Texte personnalisé :"), style=wx.ALIGN_RIGHT)
     self.texte_perso = wx.TextCtrl(self, -1, textePhoto)
     
     # Layout
     grid_sizer_base = wx.FlexGridSizer(rows=1, cols=4, vgap=10, hgap=10)
     grid_sizer_base.Add(self.label_decoration, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 0)
     grid_sizer_base.Add(self.combobox_decoration, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 0)
     grid_sizer_base.Add(self.label_texte_perso, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 0)
     grid_sizer_base.Add(self.texte_perso, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 0)
     grid_sizer_base.AddGrowableCol(3)
     self.SetSizer(grid_sizer_base)
     self.Layout()
     
     # Binds
     self.Bind(wx.EVT_CHOICE, self.OnChoixDecoration, self.combobox_decoration)
     self.Bind(wx.EVT_TEXT, self.OnTextePerso, self.texte_perso)
コード例 #2
0
 def Menu_ChoixCadre(self, event):
     index = event.GetId() - 500
     if index == 0:
         nomCadre = ""
     else:
         nomCadre = FonctionsPerso.GetListeCadresPhotos()[index]
         if six.PY2:
             nomCadre = nomCadre.decode("iso-8859-15")
     # Sauvegarde le choix du cadre
     DB = GestionDB.DB()
     DB.ReqMAJ("personnes", [
         ("cadre_photo", nomCadre),
     ], "IDpersonne", self.IDindividu)
     DB.Close()
     # MAJ de la photo affichée
     self.SetPhoto(IDindividu=self.IDindividu,
                   nomFichier=self.nomFichier,
                   taillePhoto=self.taillePhoto)
コード例 #3
0
    def MenuPhoto(self, event):
        """Ouverture du menu contextuel de la photo """

        # Création du menu contextuel
        menuPop = UTILS_Adaptations.Menu()

        # Item Ajouter
        item = wx.MenuItem(menuPop, 10, _(u"Importer une photo"))
        bmp = wx.Bitmap(
            Chemins.GetStaticPath("Images/16x16/Importer_photo.png"),
            wx.BITMAP_TYPE_PNG)
        item.SetBitmap(bmp)
        menuPop.AppendItem(item)
        self.Bind(wx.EVT_MENU, self.Menu_Ajouter, id=10)

        # Item Capturer à partir d'une caméra
        item = wx.MenuItem(menuPop, 20,
                           _(u"Capturer une photo à partir d'une webcam"))
        bmp = wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Webcam.png"),
                        wx.BITMAP_TYPE_PNG)
        item.SetBitmap(bmp)
        menuPop.AppendItem(item)
        self.Bind(wx.EVT_MENU, self.Menu_Capturer, id=20)

        # Item Imprimer
        item = wx.MenuItem(menuPop, 40, _(u"Imprimer la photo"))
        bmp = wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Imprimante.png"),
                        wx.BITMAP_TYPE_PNG)
        item.SetBitmap(bmp)
        menuPop.AppendItem(item)
        self.Bind(wx.EVT_MENU, self.Menu_Imprimer, id=40)
        if self.IDphoto == None: item.Enable(False)

        menuPop.AppendSeparator()

        # Item Supprimer
        item = wx.MenuItem(menuPop, 30, _(u"Supprimer"))
        bmp = wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Supprimer.png"),
                        wx.BITMAP_TYPE_PNG)
        item.SetBitmap(bmp)
        menuPop.AppendItem(item)
        self.Bind(wx.EVT_MENU, self.Menu_Supprimer, id=30)
        if self.IDphoto == None: item.Enable(False)

        menuPop.AppendSeparator()

        # Choix d'un cadre de décoration
        nomCadrePersonne, textePhoto = GetCadreEtTexte(self.IDindividu)
        sousmenu1 = UTILS_Adaptations.Menu()
        indexID = 500
        for nomCadre in FonctionsPerso.GetListeCadresPhotos():
            if six.PY2:
                nomCadre = nomCadre.decode("iso-8859-15")
            sousmenu1.Append(
                indexID, nomCadre,
                _(u"Choisir le cadre de décoration '") + nomCadre +
                _(u"' pour cette personne"), wx.ITEM_RADIO)
            if nomCadre == nomCadrePersonne:
                sousmenu1.Check(indexID, True)
            self.Bind(wx.EVT_MENU, self.Menu_ChoixCadre, id=indexID)
            indexID += 1
        menuPop.AppendMenu(50, _(u"Choisir un cadre de décoration"),
                           sousmenu1)

        self.PopupMenu(menuPop)
        menuPop.Destroy()
コード例 #4
0
    def __init__(self,
                 parent,
                 image=None,
                 tailleCadre=(384, 384),
                 titre=_(u"Editeur photo")):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           title=titre,
                           name="frm_photo",
                           size=(700, 600))

        # Widgets
        self.imgbox = ImgBox(self, -1, image=image, tailleCadre=tailleCadre)

        self.staticBox_rotation = wx.StaticBox(self, -1, _(u"Rotation"))
        self.bouton_rotation_gauche = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath("Images/22x22/RotationGauche.png"),
                      wx.BITMAP_TYPE_PNG))
        self.bouton_rotation_droite = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath("Images/22x22/RotationDroite.png"),
                      wx.BITMAP_TYPE_PNG))

        self.staticBox_zoom = wx.StaticBox(self, -1, _(u"Zoom"))
        self.slider_zoom = wx.Slider(self,
                                     -1,
                                     500,
                                     1,
                                     1000,
                                     size=(-1, -1),
                                     style=wx.SL_HORIZONTAL)
        self.img_loupe_plus = wx.StaticBitmap(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath("Images/22x22/ZoomPlus.png"),
                      wx.BITMAP_TYPE_ANY))
        self.img_loupe_moins = wx.StaticBitmap(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath("Images/22x22/ZoomMoins.png"),
                      wx.BITMAP_TYPE_ANY))

        self.staticBox_decoration = wx.StaticBox(self, -1,
                                                 _(u"Cadre de décoration"))
        listeCadres = FonctionsPerso.GetListeCadresPhotos()
        self.combobox_decoration = wx.Choice(self, -1, choices=listeCadres)

        self.staticBox_texte_photo = wx.StaticBox(self, -1,
                                                  _(u"Texte personnalisé"))
        self.texte_photo = wx.TextCtrl(self, -1, "")

        self.staticBox_reinit = wx.StaticBox(self, -1, _(u"Réinitialisation"))
        self.bouton_reinit = wx.BitmapButton(
            self,
            -1,
            wx.Bitmap(Chemins.GetStaticPath("Images/22x22/Photo.png"),
                      wx.BITMAP_TYPE_ANY),
            size=(70, -1))

        # Boutons
        self.bouton_aide = CTRL_Bouton_image.CTRL(
            self,
            texte=_(u"Aide"),
            cheminImage=Chemins.GetStaticPath("Images/32x32/Aide.png"))
        self.bouton_ok = CTRL_Bouton_image.CTRL(
            self,
            texte=_(u"Ok"),
            cheminImage=Chemins.GetStaticPath("Images/32x32/Valider.png"))
        self.bouton_annuler = CTRL_Bouton_image.CTRL(
            self,
            id=wx.ID_CANCEL,
            texte=_(u"Annuler"),
            cheminImage=Chemins.GetStaticPath("Images/32x32/Annuler.png"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnBoutonRotationGauche,
                  self.bouton_rotation_gauche)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonRotationDroite,
                  self.bouton_rotation_droite)
        self.Bind(wx.EVT_SCROLL, self.OnScrollSlider, self.slider_zoom)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonReinit, self.bouton_reinit)
        self.Bind(wx.EVT_CHOICE, self.OnChoixDecoration,
                  self.combobox_decoration)

        self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok)