Added settings widget.
This commit is contained in:
parent
2317aeeea5
commit
fdd83c204e
5 changed files with 89 additions and 1 deletions
|
@ -5,3 +5,4 @@ def connect_gui(app):
|
||||||
app.main_window.saveFile.triggered.connect(app.file_actions.save_current_file)
|
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.main_window.openFileTabs.tabCloseRequested.connect(app.file_actions.close_current_file)
|
||||||
app.QTMainWindow.closeEvent = app.utils.on_close
|
app.QTMainWindow.closeEvent = app.utils.on_close
|
||||||
|
app.main_window.menuSettings.triggered.connect(app.utils.open_settings)
|
||||||
|
|
6
file.py
6
file.py
|
@ -87,9 +87,13 @@ class File:
|
||||||
self.content_binary_input.setOverwriteMode(True)
|
self.content_binary_input.setOverwriteMode(True)
|
||||||
self.content_widget_layout.addWidget(self.content_binary_input)
|
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.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.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.bit_highlighter = Higlighter()
|
||||||
self.one_format = QTextCharFormat()
|
self.one_format = QTextCharFormat()
|
||||||
self.one_format.setBackground(QColor(200, 150, 100))
|
self.one_format.setBackground(QColor(200, 150, 100))
|
||||||
|
|
|
@ -17,9 +17,15 @@
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTabWidget" name="openFileTabs">
|
<widget class="QTabWidget" name="openFileTabs">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="elideMode">
|
||||||
|
<enum>Qt::ElideNone</enum>
|
||||||
|
</property>
|
||||||
<property name="tabsClosable">
|
<property name="tabsClosable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -46,9 +52,73 @@
|
||||||
<addaction name="openFile"/>
|
<addaction name="openFile"/>
|
||||||
<addaction name="saveFile"/>
|
<addaction name="saveFile"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuEdit">
|
||||||
|
<property name="title">
|
||||||
|
<string>Edit</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="menuSettings"/>
|
||||||
|
</widget>
|
||||||
<addaction name="fileMenu"/>
|
<addaction name="fileMenu"/>
|
||||||
|
<addaction name="menuEdit"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<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">
|
<action name="openFile">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -74,6 +144,14 @@
|
||||||
<string>Ctrl+S</string>
|
<string>Ctrl+S</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="menuSettings">
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="visible">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
2
main.py
Normal file → Executable file
2
main.py
Normal file → Executable file
|
@ -24,6 +24,8 @@ class BreadEditor:
|
||||||
|
|
||||||
connect_gui(self)
|
connect_gui(self)
|
||||||
|
|
||||||
|
self.main_window.settingsDock.hide()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.utils.popup_init()
|
self.utils.popup_init()
|
||||||
|
|
||||||
|
|
3
utils.py
3
utils.py
|
@ -74,3 +74,6 @@ class Utils:
|
||||||
event.ignore()
|
event.ignore()
|
||||||
|
|
||||||
print("Bye!")
|
print("Bye!")
|
||||||
|
|
||||||
|
def open_settings(self):
|
||||||
|
self.app.main_window.settingsDock.show()
|
||||||
|
|
Loading…
Reference in a new issue