mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
close splash when gui finishes loading
hide fishy window until its ready to show draw splash screen above fishy window
This commit is contained in:
parent
4ea27ae7da
commit
17c014d690
@ -70,7 +70,7 @@ def initialize(window_to_hide):
|
||||
def main():
|
||||
active.init()
|
||||
config.init()
|
||||
splash.start()
|
||||
finish_splash = splash.start()
|
||||
hotkey.init()
|
||||
|
||||
print("launching please wait...")
|
||||
@ -86,7 +86,7 @@ def main():
|
||||
return
|
||||
|
||||
bot = EngineEventHandler(lambda: gui_window)
|
||||
gui_window = GUI(lambda: bot)
|
||||
gui_window = GUI(lambda: bot, finish_splash)
|
||||
|
||||
hotkey.start()
|
||||
|
||||
@ -96,7 +96,8 @@ def main():
|
||||
gui_window.start()
|
||||
active.start()
|
||||
|
||||
bot.start_event_handler()
|
||||
bot.start_event_handler() # main thread loop
|
||||
|
||||
config.stop()
|
||||
hotkey.stop()
|
||||
active.stop()
|
||||
|
@ -25,9 +25,10 @@ class EngineRunner:
|
||||
|
||||
|
||||
class GUI:
|
||||
def __init__(self, get_engine: Callable[[], IEngineHandler]):
|
||||
def __init__(self, get_engine: Callable[[], IEngineHandler], on_ready: Callable):
|
||||
self.funcs = GUIFuncs(self)
|
||||
self.get_engine = get_engine
|
||||
self.on_ready = on_ready
|
||||
|
||||
self.config = config
|
||||
self._start_restart = False
|
||||
|
@ -31,6 +31,7 @@ def _create(gui: 'GUI'):
|
||||
engines = gui.engines
|
||||
|
||||
gui._root = ThemedTk(theme="equilux", background=True)
|
||||
gui._root.attributes('-alpha', 0.0)
|
||||
gui._root.title("Fishybot for Elder Scrolls Online")
|
||||
gui._root.iconbitmap(helper.manifest_file('icon.ico'))
|
||||
|
||||
@ -138,6 +139,9 @@ def _create(gui: 'GUI'):
|
||||
|
||||
gui._root.protocol("WM_DELETE_WINDOW", set_destroy)
|
||||
gui._destroyed = False
|
||||
gui._root.update()
|
||||
gui.on_ready()
|
||||
gui._root.after(0, gui._root.attributes, "-alpha", 1.0)
|
||||
|
||||
while True:
|
||||
gui._root.update()
|
||||
|
@ -1,6 +1,7 @@
|
||||
import logging
|
||||
import time
|
||||
import tkinter as tk
|
||||
from multiprocessing import Process
|
||||
from multiprocessing import Process, Queue
|
||||
|
||||
from PIL import Image, ImageTk
|
||||
|
||||
@ -8,12 +9,14 @@ from fishy.helper import helper
|
||||
from fishy.helper.config import config
|
||||
|
||||
|
||||
def show(win_loc):
|
||||
def show(win_loc, q):
|
||||
logging.debug("started splash process")
|
||||
dim = (300, 200)
|
||||
top = tk.Tk()
|
||||
|
||||
top.overrideredirect(True)
|
||||
top.lift()
|
||||
top.attributes('-topmost', True)
|
||||
|
||||
top.title("Loading...")
|
||||
top.resizable(False, False)
|
||||
@ -32,9 +35,20 @@ def show(win_loc):
|
||||
top.geometry("{}x{}+{}+{}".format(dim[0], dim[1], int(loc[0]) + int(dim[0] / 2), int(loc[1]) + int(dim[1] / 2)))
|
||||
|
||||
top.update()
|
||||
time.sleep(3)
|
||||
q.get()
|
||||
time.sleep(0.2)
|
||||
top.destroy()
|
||||
logging.debug("ended splash process")
|
||||
|
||||
|
||||
def create_finish(q):
|
||||
def finish():
|
||||
q.put("stop")
|
||||
|
||||
return finish
|
||||
|
||||
|
||||
def start():
|
||||
Process(target=show, args=(config.get("win_loc"),)).start()
|
||||
q = Queue()
|
||||
Process(target=show, args=(config.get("win_loc"), q,)).start()
|
||||
return create_finish(q)
|
||||
|
Loading…
Reference in New Issue
Block a user