Compare commits

...

7 Commits

Author SHA1 Message Date
BodgeMaster 3f1103d3b8 update comment to document failure 2022-03-21 05:39:54 +01:00
BodgeMaster cfa7117d8a remove left over TODO 2022-03-21 04:21:42 +01:00
BodgeMaster e0966570f6 remove useless import 2022-03-21 04:18:16 +01:00
BodgeMaster bddd43e51b Merge branch 'milan' 2022-03-21 04:16:47 +01:00
Milan Suman 739ce9d8d8 added about dialog, need to improve how it looks 2022-03-20 15:44:57 +05:30
Milan Suman f805295620 merges 2022-03-20 14:52:34 +05:30
Milan Suman ff31e47c7e removed extra debug window 2022-03-20 14:48:02 +05:30
4 changed files with 26 additions and 6 deletions

View File

@ -1,5 +1,4 @@
from PySide6 import QtWidgets
#import gui_helper
import util
app = QtWidgets.QApplication([])
@ -52,6 +51,17 @@ class Window(QtWidgets.QMainWindow):
menu_item = menu.addAction(entry)
menu_item.triggered.connect(menu_dict[entry])
class Message(QtWidgets.QMessageBox):
def __init__(self, title, text):
super().__init__()
self.setWindowTitle(title)
self.setText(text)
self.setStandardButtons(QtWidgets.QMessageBox.Ok)
self.exec()
#TODO: This needs to run in a thread but Qt really doesn't want it to. There are two ways around this:
# - create the QtWidgets.QApplication inside a thread and run all QT stuff inside that thread
# - make a generic wrapper for window mainloop that will always run in the main thread while the actual main control flow of the program gets moved to another thread
@ -61,5 +71,6 @@ class Window(QtWidgets.QMainWindow):
# Idea for a workaround for both:
# Maybe Qt has scheduled events in which case a scheduled polling event could run a function inside the Qt thread that fetches commands and executes them.
# This could work by passing (lambda) functions through a Communication object.
#UPDATE: Tried implementing both approaches, neither worked. :(
def fixme_window_mainloop_workaround_to_just_get_a_window_started_really_should_not_be_implemented_this_way_for_reasons_stated_in_the_comment_above_the_definition_of_this_function():
app.exec()

View File

@ -1,9 +1,18 @@
import util
import gui_handler
def not_implemented():
util.warn("Not implemented!")
def about_concorde():
dialog = gui_handler.Message("About Concorde",
"""
Version: 0.0.1
Made by BodgeMaster and Shwoomple
""")
# format:
# "":{} -> menu or submenu
# "":function -> menu entry
@ -60,6 +69,6 @@ menu_structure = {
},
"Help": {
"Manual...": not_implemented,
"About IDE...": not_implemented,
"About IDE...": about_concorde,
}
}

View File

@ -26,9 +26,10 @@ configuration = Config(configuration_file_path, default_configuration)
# PROGRAM MAIN WINDOW
################################################################################
# It seems like opening multiple instances already works as intended
main_window = gui_handler.Window()
main_window.set_title("Concorde IDE")
main_window.set_size(configuration.get_configuration_value("window size")["x"], configuration.get_configuration_value("window size")["y"])
main_window = gui_handler.Window(title="Concorde IDE", size=(configuration.get_configuration_value("window size")["x"], configuration.get_configuration_value("window size")["y"]))
main_window.update_menus(gui_helper.menu_structure)

View File

@ -27,7 +27,6 @@ def error(message, is_exception=True, handle_gracefully=True):
sys.exit(EXIT_ERROR)
# easy way to communicate across events
#TODO: make thread safe
class Communication:
def __init__(self):
self.lock = threading.Lock()