forked from CountDer3k/OrangeHexCompare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorangeGUI.py
67 lines (54 loc) · 1.68 KB
/
orangeGUI.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
import PySimpleGUI as sg
import codeBase as cb
from tkinter import Tk
from tkinter.filedialog import askopenfilename
listBoxWidth = 60
listBoxHeight = 50
sg.theme('DarkGrey3')
sg.theme('Topanga')
def show_hex_differences():
s = 1
def showBothFiles(file1, file2):
windowBase.hide()
windowShow = make_windowShow(file1, file2)
def make_windowBase():
layout = [
[sg.Text("Select Files")],
[sg.Button('Show Both Files')],
]
return sg.Window('Orange Hex Compare GUI', layout, finalize=True, size=(250,250))
def make_windowShow(file1, file2):
layout=[]
item = [sg.Text('File 1 in Hex'), sg.Text('File 2 in Hex')]
layout.append(item)
# Shows the 2 files that are being compared
item = [sg.Listbox(file1, size=(listBoxWidth,listBoxHeight)),
sg.Listbox(file2, size=(listBoxWidth,listBoxHeight))]
layout.append(item)
item = [sg.Button('Show Only Differences'), sg.Button('Export Differences')]
layout.append(item)
return sg.Window('Orange Hex Compare GUI - Showing Files', layout, finalize=True)
windowBase, windowShow, windowDiff = make_windowBase(), None, None
# Main area that will load
def main():
file1Hex = ''
file2Hex = ''
while True:
window, event, values = sg.read_all_windows()
# Exits application properly
if event == 'Quit' or event == sg.WIN_CLOSED:
exit(0)
# Events for the main screen
if window == windowBase:
if event == 'Show Both Files':
file1Hex = cb.pick_file()
file2Hex = cb.pick_file()
showBothFiles(file1Hex,file2Hex)
# Events for the window showing the 2 files
if window == windowShow:
if event == 'Show Only Differences':
show_hex_differences()
elif event == 'Export Differences':
s = 1
if __name__ == "__main__":
main()