Compare commits
7 Commits
8c4f0a02bc
...
3f1103d3b8
Author | SHA1 | Date |
---|---|---|
BodgeMaster | 3f1103d3b8 | |
BodgeMaster | cfa7117d8a | |
BodgeMaster | e0966570f6 | |
BodgeMaster | bddd43e51b | |
Milan Suman | 739ce9d8d8 | |
Milan Suman | f805295620 | |
Milan Suman | ff31e47c7e |
|
@ -1,5 +1,4 @@
|
||||||
from PySide6 import QtWidgets
|
from PySide6 import QtWidgets
|
||||||
#import gui_helper
|
|
||||||
import util
|
import util
|
||||||
|
|
||||||
app = QtWidgets.QApplication([])
|
app = QtWidgets.QApplication([])
|
||||||
|
@ -52,6 +51,17 @@ 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
|
||||||
|
@ -61,5 +71,6 @@ class Window(QtWidgets.QMainWindow):
|
||||||
# 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,9 +1,18 @@
|
||||||
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
|
||||||
|
@ -60,6 +69,6 @@ menu_structure = {
|
||||||
},
|
},
|
||||||
"Help": {
|
"Help": {
|
||||||
"Manual...": not_implemented,
|
"Manual...": not_implemented,
|
||||||
"About IDE...": not_implemented,
|
"About IDE...": about_concorde,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
main.py
5
main.py
|
@ -26,9 +26,10 @@ configuration = Config(configuration_file_path, default_configuration)
|
||||||
# PROGRAM MAIN WINDOW
|
# 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)
|
main_window.update_menus(gui_helper.menu_structure)
|
||||||
|
|
||||||
|
|
||||||
|
|
1
util.py
1
util.py
|
@ -27,7 +27,6 @@ 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