Added settings widget.

This commit is contained in:
The Wobbler 2024-11-21 16:40:37 +01:00
parent 2317aeeea5
commit fdd83c204e
5 changed files with 89 additions and 1 deletions

View file

@ -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)

View file

@ -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))

View file

@ -17,9 +17,15 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="openFileTabs">
<property name="enabled">
<bool>true</bool>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="tabsClosable">
<bool>true</bool>
</property>
@ -46,9 +52,73 @@
<addaction name="openFile"/>
<addaction name="saveFile"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
<string>Edit</string>
</property>
<addaction name="menuSettings"/>
</widget>
<addaction name="fileMenu"/>
<addaction name="menuEdit"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QDockWidget" name="settingsDock">
<property name="enabled">
<bool>true</bool>
</property>
<property name="accessibleName">
<string/>
</property>
<property name="accessibleDescription">
<string/>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<property name="windowTitle">
<string> Settings</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="settingsDockContents">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="settingsTabs">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="appearanceSettingsTab">
<property name="accessibleName">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<attribute name="title">
<string>Appearance</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="bitsAreSquaresSetting">
<property name="text">
<string>Bits are squares</string>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<action name="openFile">
<property name="checkable">
<bool>false</bool>
@ -74,6 +144,14 @@
<string>Ctrl+S</string>
</property>
</action>
<action name="menuSettings">
<property name="text">
<string>Settings</string>
</property>
<property name="visible">
<bool>true</bool>
</property>
</action>
</widget>
<resources/>
<connections/>

2
main.py Normal file → Executable file
View file

@ -24,6 +24,8 @@ class BreadEditor:
connect_gui(self)
self.main_window.settingsDock.hide()
def run(self):
self.utils.popup_init()

View file

@ -74,3 +74,6 @@ class Utils:
event.ignore()
print("Bye!")
def open_settings(self):
self.app.main_window.settingsDock.show()