Compare commits
	
		
			No commits in common. "72d30b4688666df6ce11f62fab27714e31295469" and "34176805d24b8689a4dab152138445ed2a0850b7" have entirely different histories. 
		
	
	
		
			72d30b4688
			...
			34176805d2
		
	
		|  | @ -1,16 +1,14 @@ | ||||||
| from PySide6 import QtWidgets, QtCore, QtGui | from PySide6 import QtWidgets | ||||||
| import util | import util | ||||||
| 
 | 
 | ||||||
| app = QtWidgets.QApplication([]) | app = QtWidgets.QApplication([]) | ||||||
| 
 | 
 | ||||||
| #TODO: Implement separate editor, terminal and main_window classes using Window as a parent |  | ||||||
| 
 |  | ||||||
| class Window(QtWidgets.QMainWindow): | class Window(QtWidgets.QMainWindow): | ||||||
|     def __init__(self, size=(640, 480), title="Concorde", on_resize=lambda event: None): |     def __init__(self, size=(640, 480), title="Concorde"): | ||||||
|         super().__init__() |         super().__init__() | ||||||
|         self.setWindowTitle(title) |         self.setWindowTitle(title) | ||||||
|         self.resize(size[0], size[1]) |         self.resize(size[0], size[1]) | ||||||
|         self.__on_resize = on_resize |         self.show() | ||||||
| 
 | 
 | ||||||
|     def __del__(self): |     def __del__(self): | ||||||
|         #TODO: whatever needs to be done here |         #TODO: whatever needs to be done here | ||||||
|  | @ -27,9 +25,6 @@ class Window(QtWidgets.QMainWindow): | ||||||
|     def set_size(self, size_x, size_y): |     def set_size(self, size_x, size_y): | ||||||
|         self.resize(size_x, size_y) |         self.resize(size_x, size_y) | ||||||
| 
 | 
 | ||||||
|     def on_resize(self, function): |  | ||||||
|         self.__on_resize = function |  | ||||||
| 
 |  | ||||||
|     def update_menus(self, menu_dict, menu=None): |     def update_menus(self, menu_dict, menu=None): | ||||||
|         # if not a sub menu |         # if not a sub menu | ||||||
|         if menu == None: |         if menu == None: | ||||||
|  | @ -56,40 +51,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]) | ||||||
| 
 | 
 | ||||||
|     # Toolkit specific! Do not use outside gui_handler. |  | ||||||
|     def resizeEvent(self, event): |  | ||||||
|         self.__on_resize(event) |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| class Editor(Window): |  | ||||||
|     def __init__(self, size=(640, 480)): |  | ||||||
|         super().__init__(size, "Editor") |  | ||||||
| 
 |  | ||||||
|         #TODO: Figure out a way to do the fucking line numbers |  | ||||||
| 
 |  | ||||||
|         #Text Editor |  | ||||||
|         self.text_edit = QtWidgets.QPlainTextEdit(self) |  | ||||||
|         self.text_edit.setFrameStyle(QtWidgets.QFrame.NoFrame) |  | ||||||
| 
 |  | ||||||
|         self.set_size(size[0], size[1]) |  | ||||||
| 
 |  | ||||||
|         #layout |  | ||||||
|         #FIXME: Somehow this places the editor behind the menu bar so that the |  | ||||||
|         #       first couple lines are cut off |  | ||||||
|         layout = QtWidgets.QHBoxLayout() |  | ||||||
|         layout.addChildWidget(self.text_edit) |  | ||||||
| 
 |  | ||||||
|         self.setLayout(layout) |  | ||||||
|          |  | ||||||
|         super().on_resize(lambda event: self.set_size(event.size().width(), event.size().height())) |  | ||||||
| 
 |  | ||||||
|     #FIXME: This function is inherently flawed because it doesn't take the |  | ||||||
|     #       actual height of the usable area inside the window into account. |  | ||||||
|     #       On a side note: This should be taken care of by the toolkit (Qt). |  | ||||||
|     def set_size(self, size_x, size_y): |  | ||||||
|         self.text_edit.resize(size_x, size_y) |  | ||||||
|         self.resize(size_x, size_y) |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| class Message(QtWidgets.QMessageBox): | class Message(QtWidgets.QMessageBox): | ||||||
|     def __init__(self, title, text): |     def __init__(self, title, text): | ||||||
|  |  | ||||||
							
								
								
									
										8
									
								
								main.py
								
								
								
								
							
							
						
						
									
										8
									
								
								main.py
								
								
								
								
							|  | @ -26,13 +26,11 @@ configuration = Config(configuration_file_path, default_configuration) | ||||||
| # PROGRAM MAIN WINDOW | # PROGRAM MAIN WINDOW | ||||||
| ################################################################################ | ################################################################################ | ||||||
| 
 | 
 | ||||||
| #Commented out so that I can work on the dockable windows | main_window = gui_handler.Window() | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| main_window = gui_handler.Editor((configuration.get_configuration_value("window size")["x"], configuration.get_configuration_value("window size")["y"])) |  | ||||||
| main_window.set_title("Concorde IDE") | 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.update_menus(gui_helper.menu_structure) | main_window.update_menus(gui_helper.menu_structure) | ||||||
| main_window.show() |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| #TODO: get resolution of main window on exit and save it back to the configuration | #TODO: get resolution of main window on exit and save it back to the configuration | ||||||
|  |  | ||||||
		Reference in New Issue