From 6076ea9b45dd72caa3c3ae08d2fcfbccd5bf63cf Mon Sep 17 00:00:00 2001 From: 78Alpha <37676834+78Alpha@users.noreply.github.com> Date: Tue, 20 Oct 2020 21:28:55 -0700 Subject: [PATCH] Update Scanner Add exception handling to the scanner, in the most inefficient way --- Applications/Scanner.py | 118 ++++++++++++++++++++++++++++++++-------- 1 file changed, 94 insertions(+), 24 deletions(-) diff --git a/Applications/Scanner.py b/Applications/Scanner.py index 27e9ce0..a2d7816 100644 --- a/Applications/Scanner.py +++ b/Applications/Scanner.py @@ -2,30 +2,74 @@ import pyautogui import PySimpleGUI as gui import sys +import os -version = "0.0.5" + +version = "0.1.0" _C_BUTTON_ = b"iVBORw0KGgoAAAANSUhEUgAAAGQAAAAjCAYAAABiv6+AAAAACXBIWXMAAAOkAAADpAGRLZh1AAAC0UlEQVRoge2br24iURSHfyXBgJkaDIhBY4rB0kdAXtk+QeENtk/Q7hO0dVfyCJCgMGAwGEaAwTAGDGbzm5zLDgVaIMB0l/MlhKYJDHO+nHvunzM3OABrrQegBqAKwAdwB8A75DuugBBAH0AAoA2gaYwJ973tvYRYa+8BPIkM5HK56JXJZJDNZq9dwBrz+RyLxQLT6TR6CU0Av40xre8+/6UQay2z4IUiKMD3fRSLxdPfxX/MaDRCEARODsU0jDHBrjveKcRa+0AZ2WzWq1QqUUYox0Mh3W6XGRSKlPe9hVhr65TBbCiXy0in06riBCyXS/R6vShrRMrr52/dEOJkMCt0eDoPFMJs2SZlTYgMU28q4/zEpDzGh6+U+8MVcIpQGecnFucXiX1EKnblqICzZiiXgbFmzGUm+1eIrDNqHKq0gF8OxpoxZ+zFwSpDntxiT7kssbhz4Y0b2Q6ZaSFPjliBv0257RCVkRyFQsFdu0YhVR2qkoW1RBxUKcRXIckjDnwKueOurZIs4uCOQjzdQk8eceClfvjvvDoiIdyFVJLFOaCQVhjufcKonAlx0KKQcDabaZwTRhyEFNKOnf0qCSEO2hTS5Pg1mUzURUIw9lJDmik5cG+pkOSQI90WX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W+/YWzaornjj3DkaDSNHUJUS08AWi9fCj/S3BKdjnV442V1AW21jIhTVGA0V1SEp04cMITaJs/e8ytf9kEaDiPY8+2RDiLi0KChEvCh36xEXqf4b/7mU2XLwxFNp/XyY5QHrzTwSkn+9FQCJLBCSyREAiSwQkskRAIksEJLKEAgD+Ab0ShUDln1yWAAAAAElFTkSuQmCC' +_V_SCAN_ = "" + + +def dumpToFile(_V_SCAN_=_V_SCAN_): + with open('temp.log', 'w+') as last_scan: + last_scan.write(_V_SCAN_) + last_scan.close() -def message_window(): +def loadFromFile(_V_SCAN_=_V_SCAN_): + try: + print("Loading file...") + with open('temp.log', 'r') as last_scan: + _V_SCAN_ = last_scan.read() + last_scan.close() + return _V_SCAN_ + except: + print("File Not Found") + return "" + + +def message_window(message, button_name, keep_alive=True): layout = [ - [gui.Text("Scanning will start 5 seconds after button is clicked!", text_color='orange', background_color='white')], - [gui.Button("CLOSE", border_width=0, image_data=_C_BUTTON_, enable_events=True)] + [gui.Text(f"{message}", + text_color='orange', + background_color='white')], + [gui.Button(f"{button_name}", + border_width=0, + image_data=_C_BUTTON_, + enable_events=True, + key="close")] ] - window = gui.Window("Alert", layout=layout, background_color='white', button_color=('orange', 'white'), icon=_C_LOGO_) - events, values = window.Read() + window = gui.Window("Alert", + layout=layout, + background_color='white', + button_color=('orange', 'white'), + icon=_C_LOGO_, + keep_on_top=keep_alive, + no_titlebar=True, + grab_anywhere=True) + while True: + events, extra = window.Read() + print(events) + if events == "close": + break window.Close() -def dummy(): +def popupButton(): layout = [ - [gui.Text("Click 'Close' when ready!", text_color='orange', background_color='white')], - [gui.Button("CLOSE", image_data=_C_BUTTON_, border_width=0, enable_events=True)] + [gui.Text("Click 'Close' when ready!", + text_color='orange', + background_color='white')], + [gui.Button("CLOSE", + image_data=_C_BUTTON_, + border_width=0, + enable_events=True)] ] - win = gui.Window("", layout=layout, background_color='white', button_color=('orange', 'white'), border_depth=0, keep_on_top=True, icon=_C_LOGO_) + win = gui.Window("", layout=layout, background_color='white', button_color=('orange', 'white'), border_depth=0, + keep_on_top=True, icon=_C_LOGO_) events, values = win.Read() if events == "CLOSE": win.Close() @@ -41,33 +85,59 @@ def generic_scanner(scan_material, delay, enable_popup): time.sleep(delay) pyautogui.typewrite(f"{item}\n") if enable_popup: - dummy() + popupButton() else: pass def test_window(): + global _V_SCAN_ layout = [ - # [gui.Text(f"Scanner {version}", text_color='orange', background_color='white')], - [gui.Multiline("", size=(60, 5))], - [gui.Button("SCAN", image_data=_C_BUTTON_, border_width=0), gui.Text("Popup Between Scans", text_color='orange', background_color='white'), gui.Spin((False, True)), gui.Text("Delay (seconds)", background_color='white', text_color='orange'), gui.Spin([i for i in range(10)])] + [gui.Multiline(default_text=_V_SCAN_, + size=(60, 5))], + [gui.Button("SCAN", + image_data=_C_BUTTON_, + border_width=0), + gui.Text("Popup Between Scans", + text_color='orange', + background_color='white'), + gui.Spin((False, True)), + gui.Text("Delay (seconds)", + background_color='white', + text_color='orange'), + gui.Spin([i for i in range(10)])] ] - window = gui.Window(f"Scanner {version}", layout=layout, background_color='white', button_color=('orange', 'white'), icon=_C_LOGO_) + window = gui.Window(f"Scanner {version}", + layout=layout, + background_color='white', + button_color=('orange', 'white'), + icon=_C_LOGO_) while True: events, values = window.Read(timeout=100) print(events, values) + print(events is None) + print(values is None) + if events is None: + window.Close() + sys.exit(0) + _V_SCAN_ = values[0] + dumpToFile(_V_SCAN_) if events == "SCAN": - message_window() - time.sleep(5) + message_window(message="First scan will occur after you click 'CLOSE'", button_name="CLOSE") generic_scanner(split_list(values[0]), enable_popup=values[1], delay=values[2]) - elif events is None and values is None: - window.Close() - sys.exit() else: pass - -test_window() - - +while True: + try: + _V_SCAN_ = loadFromFile().strip("\n") + test_window() + os.remove("temp.log") + sys.exit() + except SystemExit: + os.remove("temp.log") + sys.exit() + except: + message_window("Application Crashed! Progress was saved and will be reloaded...", button_name="RELOAD") + dumpToFile(_V_SCAN_)