Compare commits
No commits in common. "3f1103d3b8d03d20a51000af8a0cc6ae8a63ed30" and "8c4f0a02bcabfc1c71566ff093115c293eeca529" have entirely different histories.
3f1103d3b8
...
8c4f0a02bc
|
@ -1,4 +1,5 @@
|
||||||
from PySide6 import QtWidgets
|
from PySide6 import QtWidgets
|
||||||
|
#import gui_helper
|
||||||
import util
|
import util
|
||||||
|
|
||||||
app = QtWidgets.QApplication([])
|
app = QtWidgets.QApplication([])
|
||||||
|
@ -51,17 +52,6 @@ class Window(QtWidgets.QMainWindow):
|
||||||
menu_item = menu.addAction(entry)
|
menu_item = menu.addAction(entry)
|
||||||
menu_item.triggered.connect(menu_dict[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:
|
#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
|
# - 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
|
# - 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
|
||||||
|
@ -71,6 +61,5 @@ class Message(QtWidgets.QMessageBox):
|
||||||
# Idea for a workaround for both:
|
# 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.
|
# 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.
|
# 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():
|
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()
|
app.exec()
|
||||||
|
|
|
@ -1,18 +1,9 @@
|
||||||
import util
|
import util
|
||||||
import gui_handler
|
|
||||||
|
|
||||||
def not_implemented():
|
def not_implemented():
|
||||||
util.warn("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:
|
# format:
|
||||||
# "":{} -> menu or submenu
|
# "":{} -> menu or submenu
|
||||||
# "":function -> menu entry
|
# "":function -> menu entry
|
||||||
|
@ -69,6 +60,6 @@ menu_structure = {
|
||||||
},
|
},
|
||||||
"Help": {
|
"Help": {
|
||||||
"Manual...": not_implemented,
|
"Manual...": not_implemented,
|
||||||
"About IDE...": about_concorde,
|
"About IDE...": not_implemented,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
main.py
5
main.py
|
@ -26,10 +26,9 @@ configuration = Config(configuration_file_path, default_configuration)
|
||||||
# PROGRAM MAIN WINDOW
|
# PROGRAM MAIN WINDOW
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
main_window = gui_handler.Window()
|
# It seems like opening multiple instances already works as intended
|
||||||
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)
|
main_window.update_menus(gui_helper.menu_structure)
|
||||||
|
|
||||||
|
|
||||||
|
|
1
util.py
1
util.py
|
@ -27,6 +27,7 @@ def error(message, is_exception=True, handle_gracefully=True):
|
||||||
sys.exit(EXIT_ERROR)
|
sys.exit(EXIT_ERROR)
|
||||||
|
|
||||||
# easy way to communicate across events
|
# easy way to communicate across events
|
||||||
|
#TODO: make thread safe
|
||||||
class Communication:
|
class Communication:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.lock = threading.Lock()
|
self.lock = threading.Lock()
|
||||||
|
|
Reference in New Issue