So now, it can actually read files.
This commit is contained in:
parent
a7e3cf77ef
commit
d86c9acc58
1 changed files with 15 additions and 3 deletions
18
main.py
18
main.py
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue