-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
70 lines (61 loc) · 3.31 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#-----------Chargment des onglets-----------------#
import Tabs.Tab_PdfCreator.PdfCreator as PdfCreatorFunctions
import Tabs.Tab_PictureObfuscation.PictureOffuscation as PictureOffuscationFunctions
import SharedFunctions.imports as Import
from Tabs.Tab_PictureObfuscation.PictureOffuscation import Tab2UpdateLangages
from SharedFunctions.imports import AppLanguages
import Tabs.Tab_Watermark.TabWatermark as AddWatermark
#Init Soft version, will be overwrite by Pipelines process
def MyUserInterface(root):
version = '1.0.0'
root.title("Office Assistant V " + version )
#Tab init Function, used at the begining and when language is changed
def InitTabs(root):
global tabControl,tab1,tab2,tab3
tabControl = Import.ttk.Notebook(root)
tab1 = PdfCreatorFunctions.PdfCreatorTab(tabControl,root)
tab2 = PictureOffuscationFunctions.PictureOffuscationTab(tabControl,root)
tab3 = AddWatermark.AddWatermark(tabControl,root)
tabControl.add(tab1, text=Texte_From_Json["Tab1"]["TabName"][AppLanguages.Language])
tabControl.add(tab2, text=Texte_From_Json["Tab2"]["TabName"][AppLanguages.Language])
tabControl.add(tab3, text=Texte_From_Json["Tab3"]["TabName"][AppLanguages.Language])
tabControl.pack(expand=1, fill="both")
def LanguageChanged(Current_Language):
global tab1,tab2,tab3,tabControl, language_menu
global Old_Language,Old_Number_Language
AppLanguages.Language,_ = Import.ConvertLanguage(Current_Language)
#Ask question if you are sure to change language
User_answer = Import.Info_Change_Language(Texte_From_Json,AppLanguages.Language)
if User_answer == "yes":
tabControl.destroy(); tab1.destroy(); tab2.destroy(); tab3.destroy(); language_menu.destroy() #Destroy all table
InitTabs(root) #REstore All tables
InitLanguageMenu() #Restore Menu languages
Old_Language,Old_Number_Language = Import.ConvertLanguage(AppLanguages.Language) #Current Language is store as Old, then save for next language update.
PictureOffuscationFunctions.Place_Zoom_Buttons_Only_Once = 0
else:
#If no, need to remember an display n-1 selected language.
AppLanguages.Language = Old_Language
selected_language.set(AppLanguages.languages[Old_Number_Language])
# Création du menu déroulant pour les langues
def InitLanguageMenu():
global language_menu
language_menu = Import.tk.OptionMenu(root, selected_language, *AppLanguages.languages, command=LanguageChanged )
language_menu.config(width=Import.Language_Button_Width, height=Import.Language_Button_Height)
language_menu.pack()
#Import string from json file.
Texte_From_Json=Import.LoadText()
# WindowCreation
root = Import.tk.Tk()
root.resizable(width=False, height=False) #blocage de la taille de la fenetre
MyUserInterface(root)
InitTabs(root)
Window_Height,Window_Width = PdfCreatorFunctions.WindowsSizeSendData()
root.iconbitmap(Import.Ressource_Path("Pictures/OfficeAssistanticone.ico"))
#Menu to display language selection
selected_language = Import.tk.StringVar(root)
selected_language.set(AppLanguages.languages[0])
#need to remember an display n-1 selected languag. By default fr when starting
Old_Language,Old_Number_Language = Import.ConvertLanguage(selected_language.get())
InitLanguageMenu()
root.geometry(str(Window_Width) + "x" + str(Window_Height)) # Taille de la fenetre
root.mainloop()