Beispiel #1
0
    def __dessiner(self, videoIHM):
        
        '''on nettoie toute la frame en supprimant les enfants widget'''
        master = self.frame
        
        """construit les widgets """
        frameFiche = tk.LabelFrame(master, width=18, height=60, text='References Playlist ')

        tk.Label(frameFiche,text='Fichier Video').grid(in_=frameFiche, pady=15, sticky=tk.W, row=1, column=1)
        self.entryFichier= tk.Entry(frameFiche, border=2, width=35)
        self.entryFichier.grid(in_=frameFiche, sticky=tk.W, row=1, column=2)
    
        '''affectation donnee '''
        self.entryFichier.insert(0, videoIHM)
        self.entryFichier.config(state=tk.DISABLED)
        
        pw = tk.PanedWindow(frameFiche, orient=tk.HORIZONTAL) #regroupe la liste et le sidebar
        
        largeurBibli = 30
        hauteurBibli = 10
        
        listboxPL = tk.Listbox(pw, width=largeurBibli, height=hauteurBibli, font=Util.getFont('font2'))
        self.listboxPL = listboxPL
        sbar = tk.Scrollbar(pw)
        sbar.config(command=listboxPL.yview)
        listboxPL.config(yscrollcommand=sbar.set)
        #sbar.pack(side=RIGHT, fill=Y)
        listboxPL.bind("<Double-Button-1>",self.evtProxy.chargerSelectionPL)
        self.evtProxy.bibliIHM.dicoWidget['listRefPL']=listboxPL
        pw.add(listboxPL)
        pw.add(sbar)
        # attach popup to frame
        #listboxPL.bind("<Button-3>", self.popup)
        
        pw.grid(row=2, column=1, columnspan = 2, padx=2, sticky=tk.NW)
        frameFiche.pack(padx=15, pady=15)
Beispiel #2
0
    def dessiner(self):

        #print (tk.font.families())
        """construit les widgets """
        #L1C3 titre global
        etatLibelle = tk.StringVar()
        self.dicoWidget['SVetatLibelle'] = etatLibelle
        largeurEtatLibelle = self._getDimension('etatLibelle')
        labelL1C2 = tk.Label(self.root,
                             textvariable=etatLibelle,
                             anchor=tk.NW,
                             width=largeurEtatLibelle,
                             bg="#FEFEE2",
                             font=Util.getFont('font3'))
        labelL1C2.grid(row=1, column=2, columnspan=3, padx=1, sticky=tk.W)
        self.dicoWidget['labelEtat'] = labelL1C2
        #L1C3 titre global
        #heureL1C6
        strHeure = tk.StringVar()
        self.dicoWidget['SVheure'] = strHeure
        largeurHeure = self._getDimension('heure')

        labelL1C5 = tk.Label(self.root,
                             textvariable=strHeure,
                             width=largeurHeure,
                             font=Util.getFont('font3'))

        labelL1C5.grid(row=1, column=5, padx=1, sticky=tk.W)
        self.miseAJourHeure(strHeure)

        pwL2C1 = tk.PanedWindow(self.root, orient=tk.VERTICAL,
                                bg="#FEFEE2")  #regroupe la liste et le sidebar

        pwL2C1bis = tk.PanedWindow(pwL2C1, orient=tk.HORIZONTAL,
                                   bg="#FEFEE2")  #regroupe les checkbox de tri
        labelTri = tk.Label(pwL2C1bis, text="Tri:", bg="#FEFEE2")
        pwL2C1bis.add(labelTri)

        self.triBibli = tk.StringVar()
        self.triBibli.set('Nom')

        radTriNom = tk.Radiobutton(
            pwL2C1bis,
            text='Nom',
            variable=self.triBibli,
            bg="#FEFEE2",
            command=lambda x='Nom': self.evtProxy.initialiserVideosBibliIHM(x),
            value='Nom')
        pwL2C1bis.add(radTriNom)

        radTriType = tk.Radiobutton(pwL2C1bis,
                                    text='Type',
                                    variable=self.triBibli,
                                    bg="#FEFEE2",
                                    command=lambda x='Type': self.evtProxy.
                                    initialiserVideosBibliIHM(x),
                                    value='Type')
        pwL2C1bis.add(radTriType)

        radTriDate = tk.Radiobutton(pwL2C1bis,
                                    text='Date',
                                    variable=self.triBibli,
                                    bg="#FEFEE2",
                                    command=lambda x='Date': self.evtProxy.
                                    initialiserVideosBibliIHM(x),
                                    value='Date')

        pwL2C1bis.add(radTriDate)

        labelL2C1 = tk.Label(pwL2C1,
                             text="Bibliotheques de films annonces",
                             fg="brown",
                             bg="#FEFEE2",
                             font=Util.getFont('font1'))
        pwL2C1.add(labelL2C1)
        pwL2C1.add(pwL2C1bis)

        pwL2C1.grid(row=2, column=1, padx=1, sticky=tk.NW)

        pwL3C1 = tk.PanedWindow(
            self.root, orient=tk.HORIZONTAL)  #regroupe la liste et le sidebar
        # first pane, which would get widgets gridded into it:
        dimBibli = self._getDimension('bibli')

        largeurBibli = dimBibli[0]
        hauteurBibli = dimBibli[1]

        listVideos = tk.Listbox(pwL3C1,
                                width=largeurBibli,
                                selectmode=tk.MULTIPLE,
                                height=hauteurBibli,
                                font=Util.getFont('font2'))
        self.dicoWidget['listVideos'] = listVideos

        sbar = tk.Scrollbar(pwL3C1)
        sbar.config(command=listVideos.yview)
        listVideos.config(yscrollcommand=sbar.set)
        #sbar.pack(side=RIGHT, fill=Y)

        pwL3C1.add(listVideos)
        self.listVideosIHM = listVideos
        pwL3C1.add(sbar)
        #ajout du menu contextuel
        self.creerMenuContextuel(listVideos)
        # attach popup to frame
        listVideos.bind("<Button-3>", self.popup)
        '''enregistrement widget bibliIHM dans evtProxy'''
        self.evtProxy.setBibliIHM(self)

        pwL3C1.grid(row=3, column=1, padx=5, rowspan=6, sticky=tk.NW)

        pwL9C1 = tk.PanedWindow(self.root,
                                orient=tk.HORIZONTAL)  #regroupe les 2 boutons

        #handler pour quitter application
        self.root.protocol("WM_DELETE_WINDOW", self.quitter)

        boutonQuitter = tk.Button(pwL9C1, command=self.quitter, text="Quitter")
        boutonAdmin=tk.Button(pwL9C1, text="Administration", command=\
                     lambda x=self.root,y=self: self.evtProxy.verifierProfilAdmin(x,y))
        dimBtnQuitter = self._getDimension('btnQuitter')
        largeurBtnQuitter = dimBtnQuitter[0]
        hauteurBtnQuitter = dimBtnQuitter[1]

        pwL9C1.add(boutonQuitter,
                   width=largeurBtnQuitter,
                   height=hauteurBtnQuitter)
        dimBtnAdmin = self._getDimension('btnAdmin')
        largeurBtnAdmin = dimBtnAdmin[0]
        hauteurBtnAdmin = dimBtnAdmin[1]

        pwL9C1.add(boutonAdmin, width=largeurBtnAdmin, height=hauteurBtnAdmin)
        pwL9C1.grid(row=9, sticky=tk.N, column=1, padx=5)

        self.photosIHM['photoRecharger'] = tk.PhotoImage(
            file=Util.configValue('commun', 'recharger'))
        boutonRechargerL2C2=tk.Button(self.root, command=self.initialiserDonnees, image=self.photosIHM['photoRecharger'])\
        .grid(row=2, column=2, padx=1, sticky=tk.NW)

        labelPlL2C3 = tk.Label(self.root,
                               text="Gestion Playlist",
                               fg="brown",
                               bg="#FEFEE2",
                               font=Util.getFont('font1'))
        labelPlL2C3.grid(row=2, column=3)

        framePlL3C3 = tk.LabelFrame(self.root,
                                    text='Definition Playlist',
                                    height=155)

        tk.Label(framePlL3C3,
                 text='Date Diffusion\n(JJMMAAAAHH)').grid(in_=framePlL3C3,
                                                           sticky=tk.NW,
                                                           row=0,
                                                           column=0)

        dateDiffu = tk.Entry(framePlL3C3)
        dateDiffu.grid(in_=framePlL3C3,
                       sticky=tk.NW,
                       row=0,
                       column=1,
                       columnspan=2)
        self.dicoWidget['dateDiffu'] = dateDiffu

        #ajout des radio bouton pout l'heure varHeureDiffu

        #duree PL=somme des dur�es des videos de la PL
        tk.Label(framePlL3C3, text='Duree').grid(in_=framePlL3C3,
                                                 sticky=tk.NW,
                                                 row=2,
                                                 column=0)

        entryDureePL = tk.Entry(framePlL3C3, state='readonly')
        entryDureePL.grid(in_=framePlL3C3,
                          sticky=tk.NW,
                          row=2,
                          column=1,
                          columnspan=2)
        self.dicoWidget['entryDureePL'] = entryDureePL

        tk.Label(framePlL3C3, text='Film projection').grid(in_=framePlL3C3,
                                                           sticky=tk.NW,
                                                           row=3,
                                                           column=0)
        largeurEntryVideoPL = self._getDimension('inputVideoPL')

        entryVideoPL = tk.Entry(framePlL3C3,
                                width=largeurEntryVideoPL,
                                state='readonly')
        entryVideoPL.grid(in_=framePlL3C3,
                          sticky=tk.NW,
                          row=3,
                          column=1,
                          columnspan=3)
        self.dicoWidget['entryVideoPL'] = entryVideoPL

        framePlL3C3.grid(row=3, column=3, padx=5, sticky=tk.NW)

        self.photosIHM['photoCopier'] = tk.PhotoImage(
            file=Util.configValue('commun', 'copier'))
        boutonTransfertL3C2 = tk.Button(
            self.root,
            image=self.photosIHM['photoCopier'],
            command=self.evtProxy.transfertCurrentVideoEntetePL)
        boutonTransfertL3C2.grid(row=3, column=2, sticky=tk.W)

        msgInfoLibelle = tk.StringVar()
        dimStatusPL = self._getDimension('statusPL')
        largeurStatusPL = dimStatusPL[0]
        hauteurStatusPL = dimStatusPL[1]

        labelStatusPlL4C3 = LabelPlus(self.root,
                                      textvariable=msgInfoLibelle,
                                      height=hauteurStatusPL,
                                      width=largeurStatusPL,
                                      fg="dark green",
                                      bg="#DF6D14",
                                      font=Util.getFont('font2'))
        labelStatusPlL4C3.grid(row=4, column=3, padx=5, sticky=tk.NW)
        self.dicoWidget['statusPL'] = labelStatusPlL4C3

        dimListPL = self._getDimension('listPL')
        largeurListPL = dimListPL[0]
        hauteurListPL = dimListPL[1]

        pwL5C3 = tk.PanedWindow(
            self.root, orient=tk.HORIZONTAL)  #regroupe la liste et le sidebar

        listPlL5C3 = tk.Listbox(pwL5C3,
                                width=largeurListPL,
                                height=hauteurListPL,
                                font=Util.getFont('font1'))
        sbar2 = tk.Scrollbar(pwL5C3)
        sbar2.config(command=listPlL5C3.yview)
        listPlL5C3.config(yscrollcommand=sbar2.set)
        pwL5C3.add(listPlL5C3)
        pwL5C3.add(sbar2)

        pwL5C3.grid(row=5, column=3, padx=5, rowspan=2, sticky=tk.NW)
        self.dicoWidget['listPlL5C3'] = listPlL5C3

        boutonTransfertL5C2=tk.Button(self.root, image=self.photosIHM['photoCopier'], command=\
                lambda x=None:self.evtProxy.ajouterVideoPL(x))
        #double click transfert vers la playlist de la video
        listVideos.bind("<Double-Button-1>", self.evtProxy.ajouterVideoPL)

        boutonTransfertL5C2.grid(row=5, column=2, rowspan=3, sticky=tk.W)

        #ajout d'un label avec StringVar pour afficher la progression de la duree video
        pwL7C3 = tk.PanedWindow(
            self.root, orient=tk.VERTICAL)  #regroupe la liste et le sidebar

        tempsEcouleVideo = tk.StringVar()
        labeltempsEcouleVideo = tk.Label(pwL7C3,
                                         textvariable=tempsEcouleVideo,
                                         font=Util.getFont('font1'))
        tempsEcouleVideo.set("0 / 0 (min)")
        labeltempsEcouleVideo.grid(in_=pwL7C3,
                                   row=1,
                                   column=1,
                                   padx=10,
                                   sticky=tk.NW)

        largeurPbarVideo = self._getDimension('pbarVideo') * 10
        pbarVideo = Pbar(master=pwL7C3,
                         strValue=tempsEcouleVideo,
                         orient="horizontal",
                         length=largeurPbarVideo,
                         mode="determinate")
        pbarVideo.grid(in_=pwL7C3,
                       row=2,
                       column=1,
                       padx=5,
                       pady=1,
                       sticky=tk.NW)
        self.dicoWidget['pbar'] = pbarVideo

        pwL7C3.grid(row=7, column=3, padx=5, sticky=tk.NW)

        dureeAttente = Util.configValue('commun', 'dureeAttenteLecturePLMax')
        #necessite de mettre variable tbaL7c4 a cause methode afficherFrameAdmin
        dimTimerBA = self._getDimension('timerBA')
        largeurTimerBA = dimTimerBA[0]
        hauteurTimerBA = dimTimerBA[1]

        tbaL7C4 = TimerBA(self.root,
                          duree=dureeAttente,
                          bg="#FEFEE2",
                          height=hauteurTimerBA,
                          width=largeurTimerBA,
                          highlightbackground="#FEFEE2")
        self.dicoWidget['tbaL7C4'] = tbaL7C4
        tbaL7C4.grid(row=7, column=4, sticky=tk.N)

        tbaL7C4.afficherChrono(False)

        self.photosIHM['photoPlay'] = tk.PhotoImage(
            file=Util.configValue('commun', 'imgPlay'))
        boutonPlayPlL8C3=tk.Button(self.root, image=self.photosIHM['photoPlay'], command=\
                lambda x=listPlL5C3,y=pbarVideo,w=tbaL7C4:self.evtProxy.playPL(x, y, w))
        boutonPlayPlL8C3.grid(row=8, column=3, padx=5, pady=5)
        self.dicoWidget['btnPlay'] = boutonPlayPlL8C3

        largeurBtnStop = self._getDimension('btnStop')
        boutonStopPlL9C3 = tk.Button(self.root,
                                     text="STOP",
                                     width=largeurBtnStop,
                                     command=self.evtProxy.stopperPL)
        boutonStopPlL9C3.grid(row=9, column=3, padx=5, sticky=tk.N)

        pwL3C4 = tk.PanedWindow(
            self.root, orient=tk.VERTICAL)  #regroupe la liste et le sidebar

        largeurBtnEnregistrer = self._getDimension('btnEnregistrer')
        boutonEnregistrer=tk.Button(pwL3C4, width=largeurBtnEnregistrer, state='disabled', text="Enregistrer", command=\
                lambda x=self:self.evtProxy.enregistrerPL(x))
        boutonEnregistrer.grid(in_=pwL3C4,
                               sticky=tk.W,
                               padx=5,
                               pady=5,
                               row=1,
                               column=1,
                               columnspan=3)
        self.dicoWidget['btnEnreg'] = boutonEnregistrer

        largeurBtnCharger = self._getDimension('btnCharger')
        boutonCharger = tk.Button(pwL3C4,
                                  width=largeurBtnCharger,
                                  text="Charger",
                                  command=self.evtProxy.chargerPL)
        boutonCharger.grid(in_=pwL3C4,
                           sticky=tk.W,
                           padx=5,
                           pady=5,
                           row=2,
                           column=1,
                           columnspan=3)

        largeurBtnVider = self._getDimension('btnVider')
        boutonVider=tk.Button(pwL3C4, width=largeurBtnVider, text="Vider", command=\
                lambda x=listPlL5C3:self.evtProxy.viderPL(x))
        boutonVider.grid(in_=pwL3C4,
                         sticky=tk.W,
                         padx=5,
                         pady=5,
                         row=3,
                         column=1,
                         columnspan=3)

        self.photosIHM['photoFlecheHaut'] = tk.PhotoImage(
            file=Util.configValue('commun', 'imgFlecheHaut'))

        boutonFlecheHaut=tk.Button(pwL3C4, image=self.photosIHM['photoFlecheHaut'] , command=\
                                   lambda x=listPlL5C3,y='PREC':self.evtProxy.inverserVideoPL(x,y))
        boutonFlecheHaut.grid(in_=pwL3C4,
                              sticky=tk.W,
                              padx=5,
                              pady=5,
                              row=4,
                              column=1)

        self.photosIHM['photoCroix'] = tk.PhotoImage(
            file=Util.configValue('commun', 'imgCroix'))

        boutonCroix=tk.Button(pwL3C4, image=self.photosIHM['photoCroix'] , command=\
                                  lambda x=listPlL5C3:self.evtProxy.supprimerVideoPL(x))
        #Demande de jean marc potier: touche suppr qui supprime la selection dans la playlist
        listPlL5C3.bind("<KeyPress-Delete>",
                        lambda x: self.evtProxy.supprimerVideoPL(listPlL5C3))

        boutonCroix.grid(in_=pwL3C4,
                         sticky=tk.W,
                         padx=5,
                         pady=5,
                         row=5,
                         column=2)

        self.photosIHM['photoFlecheBas'] = tk.PhotoImage(
            file=Util.configValue('commun', 'imgFlecheBas'))

        boutonFlecheBas=tk.Button(pwL3C4, image=self.photosIHM['photoFlecheBas'] , command=\
                                   lambda x=listPlL5C3,y='SUIV':self.evtProxy.inverserVideoPL(x,y))

        boutonFlecheBas.grid(in_=pwL3C4,
                             sticky=tk.W,
                             padx=5,
                             pady=5,
                             row=6,
                             column=1)

        pwL3C4.grid(row=3, column=4, rowspan=3, sticky=tk.NW)

        labelLancementBaL6C4 = tk.Label(self.root,
                                        text="Lancement\ndans\n(secondes) ",
                                        bg="#FEFEE2",
                                        font=Util.getFont('font1'))
        labelLancementBaL6C4.grid(row=6, column=4, padx=5, sticky=tk.NW)
        self.dicoWidget['titreOeuvre'] = tk.StringVar()

        labelTitreFilmL2C5 = tk.Label(
            self.root,
            textvariable=self.dicoWidget['titreOeuvre'],
            bg="#FEFEE2",
            font=Util.getFont('font2'))
        labelTitreFilmL2C5.grid(row=2, column=5, sticky=tk.NW)

        #Utilisation d'un panewWindow pour gerer formattage relief='ridge'
        pwL3C5 = tk.PanedWindow(self.root,
                                borderwidth=0,
                                orient=tk.VERTICAL,
                                bg="#FEFEE2")  #regroupe la liste et le sidebar
        dimCanvasAffiche = self._getDimension('canvasAffiche')
        largeurCanvasAffiche = dimCanvasAffiche[0]
        hauteurCanvasAffiche = dimCanvasAffiche[1]

        canvasAfficheFilmL3C5 = Canvas(pwL3C5,
                                       width=largeurCanvasAffiche,
                                       height=hauteurCanvasAffiche,
                                       bg="#FEFEE2",
                                       highlightbackground="#FEFEE2")
        #canvasAfficheFilmL3C5.grid(row=3, column=5, rowspan=4, sticky=tk.NW)
        self.dicoWidget['canvasAffiche'] = canvasAfficheFilmL3C5
        self.dicoWidget['infosOeuvre'] = tk.StringVar()
        largeurBtnVider = self._getDimension('btnVider')

        dimInfosAffiche = self._getDimension('infosAffiche')
        largeurInfosAffiche = dimInfosAffiche[0]
        hauteurInfosAffiche = dimInfosAffiche[1]
        labelInfosFilmL7C5 = tk.Label(
            pwL3C5,
            width=largeurInfosAffiche,
            height=hauteurInfosAffiche,
            anchor=tk.NW,
            justify=tk.LEFT,
            textvariable=self.dicoWidget['infosOeuvre'],
            wraplength=220,
            bg="#FEFEE2")
        #   labelInfosFilmL7C5.grid(row=7, column=5, rowspan=2, padx=5, sticky=tk.NS)
        pwL3C5.add(canvasAfficheFilmL3C5)
        pwL3C5.add(labelInfosFilmL7C5)
        pwL3C5.grid(row=3, column=5, rowspan=6, sticky=tk.NW)

        self.photosIHM['photoWebcam'] = tk.PhotoImage(
            file=Util.configValue('commun', 'imgWebcam'))
        boutonWebcamL9C5 = tk.Button(self.root,
                                     image=self.photosIHM['photoWebcam'],
                                     command=self.evtProxy.playVideoWebcam)
        boutonWebcamL9C5.grid(row=9, column=5, padx=5, pady=5)
        self.dicoWidget['btnWebcam'] = boutonWebcamL9C5
Beispiel #3
0
    def __init__(self, master=None, year=None, month=None, firstweekday=calendar.MONDAY, locale=None, 
                 activebackground='#b1dcfb', activeforeground='black', selectbackground='#003eff', 
                 selectforeground='white', command=None, borderwidth=1, relief="solid", on_click_month_button=None,
                 pm=PlayListManager(None)):
        """
        WIDGET OPTIONS

            locale, firstweekday, year, month, selectbackground,
            selectforeground, activebackground, activeforeground, 
            command, borderwidth, relief, on_click_month_button
        """

        if year is None:
            year = self.datetime.now().year
        
        if month is None:
            month = self.datetime.now().month

        self._selected_date = None

        self._sel_bg = selectbackground 
        self._sel_fg = selectforeground

        self._act_bg = activebackground 
        self._act_fg = activeforeground
        
        self.on_click_month_button = on_click_month_button
        
        self._selection_is_visible = False
        self._command = command
        self.pm = pm
        ttk.Frame.__init__(self, master, borderwidth=borderwidth, relief=relief)
        
        self.bind("<FocusIn>", lambda event:self.event_generate('<<DatePickerFocusIn>>'))
        self.bind("<FocusOut>", lambda event:self.event_generate('<<DatePickerFocusOut>>'))
    
        self._cal = get_calendar(locale, firstweekday)

        # custom ttk styles
        style = ttk.Style()
        style.layout('L.TButton', (
            [('Button.focus', {'children': [('Button.leftarrow', None)]})]
        ))
        style.layout('R.TButton', (
            [('Button.focus', {'children': [('Button.rightarrow', None)]})]
        ))

        self._font = tkFont.Font()
        
        self._header_var = StringVar()

        # header frame and its widgets
        hframe = ttk.Frame(self)
        lbtn = ttk.Button(hframe, style='L.TButton', command=self._on_press_left_button)
        lbtn.pack(side=LEFT)
        
        self._header = ttk.Label(hframe, width=15, font=Util.getFont('font3'), anchor=CENTER, textvariable=self._header_var)
        self._header.pack(side=LEFT, padx=12)
        
        rbtn = ttk.Button(hframe, style='R.TButton', command=self._on_press_right_button)
        rbtn.pack(side=LEFT)
        hframe.grid(columnspan=7, pady=4)

        self._day_labels = {}

        days_of_the_week = self._cal.formatweekheader(3).split()
 
        for i, day_of_the_week in enumerate(days_of_the_week):
            Tkinter.Label(self, text=day_of_the_week, font=Util.getFont('font3'), background='grey90').grid(row=1, column=i, sticky=N+E+W+S)

        for i in range(6):
            for j in range(7):
                self._day_labels[i,j] = label = Tkinter.Label(self, background = "white", font=Util.getFont('font4'))
                
                label.grid(row=i+2, column=j, sticky=N+E+W+S, padx=5, pady=10)
                #label.bind("<Enter>", lambda event: event.widget.configure(background=self._act_bg, foreground=self._act_fg))
                #label.bind("<Leave>", lambda event: event.widget.configure(background="white"))

                label.bind("<1>", self._pressed)
        
        # adjust its columns width
        font = tkFont.Font()
        maxwidth = max(font.measure(text) for text in days_of_the_week)
        for i in range(7):
            self.grid_columnconfigure(i, minsize=maxwidth, weight=1)

        self._year = None
        self._month = None

        # insert dates in the currently empty calendar
        self._build_calendar(year, month)