-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
74 lines (59 loc) · 2.6 KB
/
app.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
71
72
73
74
# License: http://creativecommons.org/licenses/by-sa/3.0/
from tkinter import Tk
from tkinter import *
from baydetect.gui.homepage import HomePage
from baydetect.gui.processpage import ProcessingPage, JSONCreator, RunMegaDetector, CSVConvertor, ImageSorter
from baydetect.gui.utilpage import UtilityPage, FindReplaceFolderNames, FindReplaceFileNames, FindReplaceContentInFiles
from baydetect.gui.batchpage import BatchPage, Batchrun_BatchInputJSON, Batchrun_RunMegaDetector, \
Batchrun_MetadataCSV, Batchrun_SortImages, Batchrun_CombinedTXT
pages = {
"HomePage": HomePage,
"ProcessingPage": ProcessingPage,
"JSON Creator Page": JSONCreator,
"Run MegaDetector Page": RunMegaDetector,
"CSV Convertor Page": CSVConvertor,
"Image Sorter Page": ImageSorter,
"UtilityPage": UtilityPage,
"Find & Replace Folder Names": FindReplaceFolderNames,
"Find & Replace File Names": FindReplaceFileNames,
"Find & Replace Content in File": FindReplaceContentInFiles,
"BatchPage": BatchPage,
"Batchrun BatchInput JSON": Batchrun_BatchInputJSON,
"Batchrun Run MegaDetector": Batchrun_RunMegaDetector,
"Batchrun Metadata CSV": Batchrun_MetadataCSV,
"Batchrun Sort Images": Batchrun_SortImages,
"Batchrun Create Combined TXT": Batchrun_CombinedTXT,
}
LARGE_FONT = ("Calibri", 12)
"""
------------------------------------------------------------------------------------------------------------------------
Main window for the Bay Detect App
------------------------------------------------------------------------------------------------------------------------
"""
class BayDetectApp(Tk):
def __init__(self):
Tk.__init__(self)
favico = PhotoImage(file="./baydetect/gui/resources/lwf_icon-1.png")
# self.iconbitmap(self, default='./baydetect/gui/resources/lwf_icon.ico')
self.iconphoto(False, favico)
Tk.title(self, "BayDetect App")
w = Tk.winfo_reqwidth(self)
h = Tk.winfo_reqheight(self)
ws = Tk.winfo_screenwidth(self)
hs = Tk.winfo_screenheight(self)
x = (ws / 2) - (w / 2)
y = (hs / 2) - (h / 2)
Tk.geometry(self, '+%d+%d' % (x, y))
self._frame = None
self.switch_frame("HomePage")
def switch_frame(self, page_name):
"""Destroys current frame and replaces it with a new one."""
cls = pages[page_name]
new_frame = cls(master=self)
if self._frame is not None:
self._frame.destroy()
self._frame = new_frame
self._frame.pack(padx=10, pady=10, expand=1)
if __name__ == "__main__":
app = BayDetectApp()
app.mainloop()