From fdd83c204e7a93e0dc471ec5f29dbcd07d417f10 Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Thu, 21 Nov 2024 16:40:37 +0100 Subject: [PATCH] Added settings widget. --- connect_gui.py | 1 + file.py | 6 ++- gui/raw_ui/main_window.ui | 78 +++++++++++++++++++++++++++++++++++++++ main.py | 2 + utils.py | 3 ++ 5 files changed, 89 insertions(+), 1 deletion(-) mode change 100644 => 100755 main.py diff --git a/connect_gui.py b/connect_gui.py index 4c21ab9..aebd04f 100644 --- a/connect_gui.py +++ b/connect_gui.py @@ -5,3 +5,4 @@ def connect_gui(app): app.main_window.saveFile.triggered.connect(app.file_actions.save_current_file) app.main_window.openFileTabs.tabCloseRequested.connect(app.file_actions.close_current_file) app.QTMainWindow.closeEvent = app.utils.on_close + app.main_window.menuSettings.triggered.connect(app.utils.open_settings) diff --git a/file.py b/file.py index 0ae12e3..fa4f2f5 100644 --- a/file.py +++ b/file.py @@ -87,9 +87,13 @@ class File: self.content_binary_input.setOverwriteMode(True) self.content_widget_layout.addWidget(self.content_binary_input) self.content_binary_input.setPlainText(self.app.utils.bstring_to_oz(file_content)) - self.content_binary_input.setFont(QFont("Ubuntu Mono", 12)) self.content_binary_input.textChanged.connect(self.on_edit) + self.binary_font = QFont("Ubuntu Mono", 12) + self.binary_font.setKerning(True) + self.binary_font.setLetterSpacing(QFont.SpacingType.PercentageSpacing, 200) + self.content_binary_input.setFont(self.binary_font) + self.bit_highlighter = Higlighter() self.one_format = QTextCharFormat() self.one_format.setBackground(QColor(200, 150, 100)) diff --git a/gui/raw_ui/main_window.ui b/gui/raw_ui/main_window.ui index b2f323f..da95905 100644 --- a/gui/raw_ui/main_window.ui +++ b/gui/raw_ui/main_window.ui @@ -17,9 +17,15 @@ + + true + -1 + + Qt::ElideNone + true @@ -46,9 +52,73 @@ + + + Edit + + + + + + + true + + + + + + + + + false + + + QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable + + + Settings + + + 1 + + + + + + + 0 + + + + + + + false + + + Appearance + + + + + + Bits are squares + + + false + + + + + + + + + + false @@ -74,6 +144,14 @@ Ctrl+S + + + Settings + + + true + + diff --git a/main.py b/main.py old mode 100644 new mode 100755 index 76c7419..75121ed --- a/main.py +++ b/main.py @@ -24,6 +24,8 @@ class BreadEditor: connect_gui(self) + self.main_window.settingsDock.hide() + def run(self): self.utils.popup_init() diff --git a/utils.py b/utils.py index 1642356..a418e9c 100644 --- a/utils.py +++ b/utils.py @@ -74,3 +74,6 @@ class Utils: event.ignore() print("Bye!") + + def open_settings(self): + self.app.main_window.settingsDock.show()