Compare commits

..

No commits in common. "603acb60f6fcfd89b06147f45b33f334bc2bac67" and "39a5da7716874b469110430bc252323103e266f4" have entirely different histories.

2 changed files with 10 additions and 41 deletions

View File

@ -1,22 +1,21 @@
from PySide6 import QtWidgets
#import gui_helper
import util
app = QtWidgets.QApplication([])
class Window(QtWidgets.QMainWindow):
def __init__(self, size=(640, 480), title="Concorde"):
super().__init__()
self.setWindowTitle(title)
self.resize(size[0], size[1])
self.show()
class Window:
def __init__(self, title="Concorde", size_x=640, size_y=480):
self.window = QtWidgets.QWidget()
self.window.setWindowTitle(title)
self.window.resize(size_x, size_y)
self.window.show()
def __del__(self):
#TODO: whatever needs to be done here
pass
def set_title(self, title):
self.setWindowTitle(title)
self.window.setWindowTitle(title)
def get_size(self):
#TODO: implement
@ -24,34 +23,11 @@ class Window(QtWidgets.QMainWindow):
return None
def set_size(self, size_x, size_y):
self.resize(size_x, size_y)
self.window.resize(size_x, size_y)
def update_menus(self, menu_dict):
menu = self.menuBar()
#Looping through entire menu_dict
for topmenu, submenu in menu_dict.items():
#making top level menu
menu_item = menu.addMenu(topmenu)
#adding menu items (populating menu)
for inner, data in submenu.items():
#Adding submenu and populating it
if type(data) == dict:
sub = menu_item.addMenu(inner)
for label, func in data.items():
sub.addAction(label)
if func == None:
sub.triggered.connect(lambda x: None)
else:
sub.triggered.connect(func)
#Adding separators
elif inner == None:
menu_item.addSeparator()
else:
item = menu_item.addAction(inner)
item.triggered.connect(data)
#TODO: implement
util.warn("Not implemented!")
#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

View File

@ -26,18 +26,11 @@ 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_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
#TODO: check if the GUI encountered an error in a toolkit agnostic way