From ff31e47c7e4fefb441f704b1bb1d4298fe9df661 Mon Sep 17 00:00:00 2001 From: Milan Suman Date: Sun, 20 Mar 2022 14:48:02 +0530 Subject: [PATCH 1/2] removed extra debug window --- gui_helper.py | 18 +----------------- main.py | 4 ---- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/gui_helper.py b/gui_helper.py index f9f2b73..c4c1063 100644 --- a/gui_helper.py +++ b/gui_helper.py @@ -65,20 +65,4 @@ menu_structure = { } } -#FIXME: come up with a way to uniquely declare separators so they don't become the same element of a dict - -def build_menu(structure_dict, menu): - for entry in structure_dict: - if structure_dict[entry]==None: - if entry==None: - menu.add_separator() - else: - menu.add_command(label=entry) - menu.entryconfig(entry, state="disabled") - if isinstance(structure_dict[entry], dict): - submenu = tk.Menu(menu, tearoff=False) - build_menu(structure_dict[entry], submenu) - menu.add_cascade(label=entry, menu=submenu) - if callable(structure_dict[entry]): - menu.add_command(label=entry, command=structure_dict[entry]) - +#FIXME: come up with a way to uniquely declare separators so they don't become the same element of a dict \ No newline at end of file diff --git a/main.py b/main.py index 70f34a2..6eaecac 100644 --- a/main.py +++ b/main.py @@ -29,14 +29,10 @@ configuration = Config(configuration_file_path, default_configuration) # It seems like opening multiple instances already works as intended main_window = gui_handler.Window() -main_window2 = gui_handler.Window() main_window.set_title("Concorde IDE") -main_window2.set_title("Another window") main_window.set_size(configuration.get_configuration_value("window size")["x"], configuration.get_configuration_value("window size")["y"]) -main_window2.set_size(400, 500) main_window.update_menus(gui_helper.menu_structure) -main_window2.update_menus(gui_helper.menu_structure) #TODO: get resolution of main window on exit and save it back to the configuration From 739ce9d8d8e90645a91b1e7d655501089db92921 Mon Sep 17 00:00:00 2001 From: Milan Suman Date: Sun, 20 Mar 2022 15:44:57 +0530 Subject: [PATCH 2/2] added about dialog, need to improve how it looks --- gui_handler.py | 13 ++++++++++++- gui_helper.py | 13 +++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/gui_handler.py b/gui_handler.py index b14616d..fbb69de 100644 --- a/gui_handler.py +++ b/gui_handler.py @@ -1,5 +1,5 @@ +from email import message from PySide6 import QtWidgets -#import gui_helper import util app = QtWidgets.QApplication([]) @@ -52,6 +52,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 diff --git a/gui_helper.py b/gui_helper.py index 43a5885..b65fe4b 100644 --- a/gui_helper.py +++ b/gui_helper.py @@ -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, } }