modification chemin images pour phase test et executable

This commit is contained in:
VincentLeduc 2017-08-05 21:41:02 +02:00 committed by GitHub
parent 88dc5cbf56
commit e6229d3ac0

View file

@ -1,14 +1,12 @@
# -*- coding: utf-8 -*-
import sys
import os
from tkinter import *
from tkinter.messagebox import *
from PIL import Image, ImageTk
DOSSIER_COURRANT = os.path.dirname(os.path.abspath(__file__))
DOSSIER_PARENT = os.path.dirname(DOSSIER_COURRANT)
sys.path.append(DOSSIER_PARENT)
from Views.quickTask import QuickTask
from tkinter import *
from tkinter.messagebox import *
from PIL import Image, ImageTk
class BarreOutils():
@ -47,37 +45,68 @@ class BarreOutils():
#liste_projets.insert(END, "gestt")
#liste_projets.insert(END, "ratatouille")
#liste_projets.insert(END, "chouxfleur")
# Chemin Images
# Chemin des images pour créer executable
deco = self.resource_path("deco.jpg")
fleche = self.resource_path("fleche.png")
graphe = self.resource_path("graphe.png")
loupe = self.resource_path("loupe.jpg")
plus = self.resource_path("plus4.png")
# Chemin en phase de test
deco2 = "Menu\\deco.jpg"
fleche2 = "Menu\\fleche.png"
graphe2 = "Menu\\graphe.png"
loupe2 = "Menu\\loupe.jpg"
plus2 = "Menu\\plus4.png"
################################################################################################################
# Bouton tache rapides
image = Image.open("Menu\\fleche.png")
try:
image = Image.open(fleche)
except Exception:
image = Image.open(fleche2)
photo = ImageTk.PhotoImage(image)
self.bouton_tache_rapide = Button(self.fenetre, image=photo,width=self.largeurBoutons,height=self.hauteurBoutons, command=self.open_taches_rapides)
self.bouton_tache_rapide.grid(row=3,column=1, padx = self.largeur * 0.02)
self.bouton_tache_rapide.image = photo
################################################################################################################
# Bouton Nouveau Projet
image = Image.open("Menu\\plus4.png")
try:
image = Image.open(plus)
except Exception:
image = Image.open(plus2)
photo = ImageTk.PhotoImage(image)
self.bouton_deconnexion = Button(self.fenetre, image=photo,width=self.largeurBoutons,height=self.hauteurBoutons, command=self.open_nouveau_projet)
self.bouton_deconnexion.grid(row=4,column=1)
self.bouton_deconnexion.image = photo
################################################################################################################
# Bouton Rapports
image = Image.open("Menu\\graphe.png")
try:
image = Image.open(graphe)
except Exception:
image = Image.open(graphe2)
photo = ImageTk.PhotoImage(image)
self.bouton_deconnexion = Button(self.fenetre, image=photo,width=self.largeurBoutons,height=self.hauteurBoutons, command=self.open_rapports)
self.bouton_deconnexion.grid(row=5,column=1)
self.bouton_deconnexion.image = photo
################################################################################################################
# Bouton Naviguer
image = Image.open("Menu\\loupe.jpg")
try:
image = Image.open(loupe)
except Exception:
image = Image.open(loupe2)
photo = ImageTk.PhotoImage(image)
self.bouton_naviguer = Button(self.fenetre, image=photo,width=self.largeurBoutons,height=self.hauteurBoutons, command=self.naviguer)
self.bouton_naviguer.grid(row=6,column=1)
self.bouton_naviguer.image = photo
################################################################################################################
# Bouton Deconnexion
image = Image.open("Menu\\deco.jpg")
try:
image = Image.open(deco)
except Exception:
image = Image.open(deco2)
photo = ImageTk.PhotoImage(image)
self.bouton_deconnexion = Button(self.fenetre, image=photo,width=self.largeurBoutons,height=self.hauteurBoutons, command=self.deconnexion)
self.bouton_deconnexion.grid(row=7,column=1)
@ -90,7 +119,8 @@ class BarreOutils():
self.fenetre.destroy()
def open_taches_rapides(self,*args):
"""L'utilisateur veut ouvrir la fenetre des taches rapides"""
QuickTask(mother=self.fenetre)
toplevel = Toplevel(self.fenetre)
toplevel.title('Subroot')
# TODO : ouvrir la fenetre des taches rapides
def open_nouveau_projet(self,*args):
"""L'utilisateur veut ouvrir la fenetre des nouveaux projets"""
@ -108,6 +138,25 @@ class BarreOutils():
return [int(g[0:r[0]]),int(g[r[0]+1:r[1]]),int(g[r[1]+1:r[2]]),int(g[r[2]+1:])]
def callback(self):
self.fermer = askyesno('Deconnexion', 'Êtes-vous sûr de vouloir vous deconnecter ?')
if askyesno('Deconnexion', 'Êtes-vous sûr de vouloir vous deconnecter ?'):
self.fermer = True
else:
#showinfo('Titre 3', 'Vous avez peur!')
#showerror("Titre 4", "Aha")
self.fermer = False
def resource_path(self, relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
#b = BarreOutils()
#print(b.fenetre.geometry())
#print(b.largeurBoutons)
#print(b.hauteurBoutons)
#b.fenetre.mainloop()