diff --git a/connect_gui.py b/connect_gui.py
index ba32773..df6ce0a 100644
--- a/connect_gui.py
+++ b/connect_gui.py
@@ -8,3 +8,4 @@ def connect_gui(app):
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.newFile.triggered.connect(app.file_actions.create_file)
diff --git a/file.py b/file.py
index ea1a2a9..f77458f 100644
--- a/file.py
+++ b/file.py
@@ -28,6 +28,22 @@ class FileActions:
self.app.open_files[file_path] = File(self.app, file_path, file_path.split("/")[-1])
+ def create_file(self):
+ file_path, extension = QFileDialog.getSaveFileName(
+ caption="New File",
+ directory=self.app.utils.home_path,
+ filter="Binary (*.bin);;Any (*)",
+ )
+
+ if "Binary" in extension:
+ file_path = file_path.split(".")[0] + ".bin" # make sure it has the right extension
+
+ file = open(file_path, "bw") # create new empty file
+ file.write(b"")
+ file.close()
+
+ self.app.open_files[file_path] = File(self.app, file_path, file_path.split("/")[-1]) # open file
+
def save_current_file(self):
current_tab = self.app.gui.main_window.openFileTabs.currentWidget()
current_file_path = current_tab.objectName()
diff --git a/gui/raw_ui/main_window.ui b/gui/raw_ui/main_window.ui
index b846141..2c45102 100644
--- a/gui/raw_ui/main_window.ui
+++ b/gui/raw_ui/main_window.ui
@@ -55,6 +55,7 @@
File
+
@@ -207,6 +208,19 @@
New
+
+
+ Open
+
+
+
+
+ New
+
+
+ Ctrl+N
+
+