-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Settings menu added which theme combobox added
- Loading branch information
1 parent
5b77d30
commit 6c4e811
Showing
8 changed files
with
240 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>SettingsWindow</class> | ||
<widget class="QMainWindow" name="SettingsWindow"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>418</width> | ||
<height>348</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>MainWindow</string> | ||
</property> | ||
<widget class="QWidget" name="centralwidget"> | ||
<widget class="QWidget" name="verticalWidget" native="true"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>10</x> | ||
<y>10</y> | ||
<width>1921</width> | ||
<height>951</height> | ||
</rect> | ||
</property> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> | ||
<horstretch>1</horstretch> | ||
<verstretch>1</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout_2"> | ||
<item> | ||
<widget class="QTabWidget" name="settingsTabWidget"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> | ||
<horstretch>1</horstretch> | ||
<verstretch>1</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="currentIndex"> | ||
<number>0</number> | ||
</property> | ||
<widget class="QWidget" name="appearanceTab"> | ||
<attribute name="title"> | ||
<string>Appearance</string> | ||
</attribute> | ||
<widget class="QWidget" name="formLayoutWidget"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>10</x> | ||
<y>10</y> | ||
<width>341</width> | ||
<height>241</height> | ||
</rect> | ||
</property> | ||
<layout class="QFormLayout" name="formLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="themeLabel"> | ||
<property name="text"> | ||
<string>Theme:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1"> | ||
<widget class="QComboBox" name="themeName"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="1"> | ||
<spacer name="verticalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Vertical</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>20</width> | ||
<height>40</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
</layout> | ||
</widget> | ||
</widget> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
</widget> | ||
<widget class="QStatusBar" name="statusbar"/> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Copyright (C) 2024 ISIS Rutherford Appleton Laboratory UKRI | ||
# SPDX - License - Identifier: GPL-3.0-or-later | ||
from __future__ import annotations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (C) 2024 ISIS Rutherford Appleton Laboratory UKRI | ||
# SPDX - License - Identifier: GPL-3.0-or-later | ||
from __future__ import annotations | ||
|
||
from logging import getLogger | ||
from typing import TYPE_CHECKING | ||
|
||
from PyQt5.QtCore import QSettings | ||
|
||
from mantidimaging.gui.mvp_base import BasePresenter | ||
|
||
LOG = getLogger(__name__) | ||
|
||
if TYPE_CHECKING: | ||
from mantidimaging.gui.windows.settings.view import SettingsWindowView # pragma: no cover | ||
from mantidimaging.gui.windows.main import MainWindowView | ||
|
||
settings = QSettings('mantidproject', 'Mantid Imaging') | ||
|
||
|
||
class SettingsWindowPresenter(BasePresenter): | ||
view: 'SettingsWindowView' | ||
|
||
def __init__(self, view: 'SettingsWindowView', main_window: 'MainWindowView'): | ||
super().__init__(view) | ||
self.view = view | ||
self.main_window = main_window | ||
self.current_theme = settings.value('theme_selection') | ||
|
||
def set_theme(self): | ||
self.current_theme = self.view.current_theme | ||
settings.setValue('theme_selection', self.current_theme) | ||
self.main_window.set_theme(self.current_theme) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright (C) 2024 ISIS Rutherford Appleton Laboratory UKRI | ||
# SPDX - License - Identifier: GPL-3.0-or-later | ||
from __future__ import annotations | ||
from logging import getLogger | ||
from typing import TYPE_CHECKING | ||
|
||
from PyQt5.QtCore import QSettings | ||
from PyQt5.QtWidgets import QTabWidget, QWidget, QComboBox, QLabel | ||
|
||
from mantidimaging.gui.mvp_base import BaseMainWindowView | ||
|
||
from qt_material import list_themes | ||
|
||
from mantidimaging.gui.windows.settings.presenter import SettingsWindowPresenter | ||
|
||
if TYPE_CHECKING: | ||
from mantidimaging.gui.windows.main import MainWindowView # noqa:F401 # pragma: no cover | ||
|
||
LOG = getLogger(__name__) | ||
|
||
settings = QSettings('mantidproject', 'Mantid Imaging') | ||
|
||
|
||
class SettingsWindowView(BaseMainWindowView): | ||
settingsTabWidget: QTabWidget | ||
appearanceTab: QWidget | ||
themeName: QComboBox | ||
themeLabel: QLabel | ||
|
||
def __init__(self, main_window: 'MainWindowView'): | ||
super().__init__(None, 'gui/ui/settings_window.ui') | ||
self.setWindowTitle('Settings') | ||
self.main_window = main_window | ||
self.presenter = SettingsWindowPresenter(self, main_window) | ||
|
||
self.themeName.addItem('Fusion') | ||
self.themeName.addItems(list_themes()) | ||
self.themeName.setCurrentText(self.presenter.current_theme) | ||
|
||
self.themeName.currentTextChanged.connect(self.presenter.set_theme) | ||
|
||
@property | ||
def current_theme(self) -> str: | ||
return self.themeName.currentText() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters