now disables config and engine selector when engine is running

This commit is contained in:
DESKTOP-JVKHS7I\Adam 2020-06-25 07:26:17 +05:30
parent 1ae645294d
commit 1418271583
4 changed files with 10 additions and 5 deletions

View File

@ -1,2 +1,2 @@
from fishy.__main__ import main
__version__ = "0.3.6"
__version__ = "0.3.7"

View File

@ -17,6 +17,8 @@ class GUIFuncs:
def func():
self.gui._bot_running = started
self.gui._start_button["text"] = self.gui._get_start_stop_text()
self.gui._engine_select["state"] = "disabled" if self.gui._bot_running else "normal"
self.gui._config_button["state"] = "disabled" if self.gui._bot_running else "normal"
self.gui.call_in_thread(func)

View File

@ -1,4 +1,5 @@
import logging
from tkinter import OptionMenu, Button
from typing import List, Callable
import threading
@ -32,6 +33,8 @@ class GUI:
self._start_button = None
self._notify = None
self._notify_check = None
self._engine_select: OptionMenu = None
self._config_button: Button = None
self._thread = threading.Thread(target=self.create, args=())

View File

@ -96,11 +96,11 @@ def _create(gui: 'GUI'):
engine_var = StringVar(start_frame)
labels = list(engines.keys())
last_started = gui._config.get("last_started", labels[0])
engine_select = OptionMenu(start_frame, engine_var, last_started, *labels)
engine_select.pack(side=LEFT)
gui._engine_select = OptionMenu(start_frame, engine_var, last_started, *labels)
gui._engine_select.pack(side=LEFT)
config_button = Button(start_frame, text="", width=0, command=lambda: engines[engine_var.get()][0]())
config_button.pack(side=RIGHT)
gui._config_button = Button(start_frame, text="", width=0, command=lambda: engines[engine_var.get()][0]())
gui._config_button.pack(side=RIGHT)
gui._start_button = Button(start_frame, text=gui._get_start_stop_text(), width=25,
command=lambda: start_engine(engine_var.get()))