Moved function connect_gui() from own file to GUI class for better OOP and less complicated file structure.
This commit is contained in:
parent
e863815b41
commit
2cb7b80cb8
3 changed files with 15 additions and 19 deletions
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/python3
|
|
||||||
|
|
||||||
def connect_gui(app):
|
|
||||||
app.gui.main_window.openFile.triggered.connect(app.file_actions.open_files)
|
|
||||||
app.gui.main_window.newFile.triggered.connect(lambda: app.file_actions.create_file())
|
|
||||||
app.gui.main_window.saveFile.triggered.connect(app.file_actions.save_current_file)
|
|
||||||
app.gui.main_window.saveFileAs.triggered.connect(app.file_actions.save_current_file_as)
|
|
||||||
|
|
||||||
app.gui.main_window.menuSettings.triggered.connect(app.gui.main_window.settingsDock.show)
|
|
||||||
|
|
||||||
app.gui.main_window.bitsAreSquaresSetting.stateChanged.connect(app.utils.update_style_in_all_bit_editors)
|
|
||||||
app.gui.main_window.highlightOnesSetting.stateChanged.connect(app.utils.update_style_in_all_bit_editors)
|
|
||||||
|
|
||||||
app.gui.main_window.openFileTabs.tabCloseRequested.connect(app.file_actions.close_current_file)
|
|
||||||
app.gui.QTMainWindow.closeEvent = app.utils.on_close
|
|
|
@ -24,7 +24,6 @@ class BreadEditor:
|
||||||
|
|
||||||
self.gui = GUI(self)
|
self.gui = GUI(self)
|
||||||
|
|
||||||
self.gui.connect_gui(self)
|
|
||||||
self.open_files: dict[str, File] = {}
|
self.open_files: dict[str, File] = {}
|
||||||
self.open_files_queue = []
|
self.open_files_queue = []
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
from PyQt6.QtWidgets import QApplication, QMainWindow
|
from PyQt6.QtWidgets import QApplication, QMainWindow
|
||||||
from bread_editor.gui.main_window import Ui_MainWindow
|
from bread_editor.gui.main_window import Ui_MainWindow
|
||||||
from bread_editor.connect_gui import connect_gui
|
|
||||||
|
|
||||||
|
|
||||||
class GUI:
|
class GUI:
|
||||||
|
@ -15,8 +14,7 @@ class GUI:
|
||||||
self.main_window = Ui_MainWindow()
|
self.main_window = Ui_MainWindow()
|
||||||
|
|
||||||
self.setup_gui()
|
self.setup_gui()
|
||||||
|
self.connect_gui()
|
||||||
self.connect_gui = connect_gui
|
|
||||||
|
|
||||||
def setup_gui(self):
|
def setup_gui(self):
|
||||||
self.main_window.setupUi(self.QTMainWindow)
|
self.main_window.setupUi(self.QTMainWindow)
|
||||||
|
@ -30,3 +28,17 @@ class GUI:
|
||||||
self.main_window.highlightOnesSetting.setChecked(self.app.settings.highlight_ones)
|
self.main_window.highlightOnesSetting.setChecked(self.app.settings.highlight_ones)
|
||||||
|
|
||||||
self.app.utils.update_style_in_all_bit_editors()
|
self.app.utils.update_style_in_all_bit_editors()
|
||||||
|
|
||||||
|
def connect_gui(self):
|
||||||
|
self.main_window.openFile.triggered.connect(self.app.file_actions.open_files)
|
||||||
|
self.main_window.newFile.triggered.connect(lambda: self.app.file_actions.create_file())
|
||||||
|
self.main_window.saveFile.triggered.connect(self.app.file_actions.save_current_file)
|
||||||
|
self.main_window.saveFileAs.triggered.connect(self.app.file_actions.save_current_file_as)
|
||||||
|
|
||||||
|
self.main_window.menuSettings.triggered.connect(self.main_window.settingsDock.show)
|
||||||
|
|
||||||
|
self.main_window.bitsAreSquaresSetting.stateChanged.connect(self.app.utils.update_style_in_all_bit_editors)
|
||||||
|
self.main_window.highlightOnesSetting.stateChanged.connect(self.app.utils.update_style_in_all_bit_editors)
|
||||||
|
|
||||||
|
self.main_window.openFileTabs.tabCloseRequested.connect(self.app.file_actions.close_current_file)
|
||||||
|
self.QTMainWindow.closeEvent = self.app.utils.on_close
|
||||||
|
|
Loading…
Add table
Reference in a new issue