So now, it can actually read files.

This commit is contained in:
The Wobbler 2024-11-18 18:00:35 +01:00
parent a7e3cf77ef
commit d86c9acc58

18
main.py
View file

@ -22,10 +22,22 @@ class BreadEditor:
connect_gui(self)
def open_file(self, file_path):
self.open_files[file_path] = file_path.split("/")[-1] # set name that shows in the tab list
file = open(file_path, "r")
file_content = file.read()
file.close()
self.open_files[file_path] = {
"name": file_path.split("/")[-1], # set name that shows in the tab list
"content": file_content
}
content_widget = QtWidgets.QWidget(self.main_window.openFileTabs)
content_label = QtWidgets.QLabel(content_widget)
content_label.setText(file_content)
self.main_window.openFileTabs.addTab(
QtWidgets.QWidget(self.main_window.openFileTabs),
self.open_files[file_path]
content_widget,
self.open_files[file_path]["name"]
)
def run(self):