diff --git a/connect_gui.py b/connect_gui.py index 65990c5..6d0bbab 100644 --- a/connect_gui.py +++ b/connect_gui.py @@ -3,3 +3,4 @@ def connect_gui(app): app.main_window.openFile.triggered.connect(app.file_actions.open_files) app.main_window.saveFile.triggered.connect(app.file_actions.save_current_file) + app.main_window.openFileTabs.tabCloseRequested.connect(app.file_actions.close_current_file) diff --git a/file.py b/file.py index e456900..40882e6 100644 --- a/file.py +++ b/file.py @@ -33,6 +33,12 @@ class FileActions: self.save_file(current_file_path) + def close_current_file(self): + tab_index = self.app.main_window.openFileTabs.currentIndex() + self.app.main_window.openFileTabs.removeTab(tab_index) + current_file_path = self.app.main_window.openFileTabs.currentWidget().objectName() + del self.app.open_files[current_file_path] + class File: def __init__(self, app, path, name): diff --git a/gui/raw_ui/main_window.ui b/gui/raw_ui/main_window.ui index 821a9fd..b2f323f 100644 --- a/gui/raw_ui/main_window.ui +++ b/gui/raw_ui/main_window.ui @@ -20,6 +20,12 @@ -1 + + true + + + false +