Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
adec642
STYLE: Begin work on toggleable dark mode.
genedan May 10, 2026
c468847
STYLE: Move AnalysisTab stylings to style subpackage.
genedan May 10, 2026
2f726c7
STYLE: Toggle lower diagonal dark mode.
genedan May 10, 2026
86950ad
STYLE: Toggle lower diagonal dark mode.
genedan May 10, 2026
e80e537
STYLE: Toggle lower diagonal dark mode.
genedan May 10, 2026
21b2cbf
STYLE: Toggle lower diagonal dark mode.
genedan May 10, 2026
fb0d209
STYLE: Toggle lower diagonal dark mode.
genedan May 10, 2026
57435e1
STYLE: Toggle lower table corner button dark mode.
genedan May 10, 2026
6de2399
STYLE: Begin work on moving light/dark stylings out of the ProjectItem.
genedan May 10, 2026
d391702
FIX: Set default qss_column_tab to light if operating with an unknown…
genedan May 10, 2026
c9028b8
FIX: Set default qss_column_tab to light if operating with an unknown…
genedan May 10, 2026
a6ee734
FIX: Fix diag color test to extract theme of running system.
genedan May 10, 2026
96dd5cb
FEAT: Toggle light/dark for main window background color.
genedan May 11, 2026
b32b59f
FEAT: Work on toggling the scrollbar.
genedan May 11, 2026
06f5d23
CHORE: Remove commented blocks.
genedan May 14, 2026
fbde05c
FEAT: Add dark mode to settings dialog.
genedan May 14, 2026
2650d6e
FEAT: Add dark mode to settings dialog.
genedan May 14, 2026
5d44f3e
DOCS: Add annotations to AnalysisTab qss.
genedan May 14, 2026
0c10c66
FEAT: Add function to reset palette after OS theme changes.
genedan May 14, 2026
0af74cf
DOCS: Update .gitignore.
genedan May 14, 2026
8f8ca85
FEAT: Add light/dark mode to about dialog.
genedan May 16, 2026
0f0ff52
FEAT: Move stylings to style folder.
genedan May 16, 2026
2d52c0b
FEAT: Create dark mode icons.
genedan May 16, 2026
de495bb
FEAT: Enable dark mode icons in menus.
genedan May 16, 2026
344c3cd
FEAT: Add dark mode icons.
genedan May 16, 2026
ef23f9d
DOCS: Add octicons license.
genedan May 16, 2026
bbd2b67
FEAT: Move stylings to style folder.
genedan May 16, 2026
9569cdd
FEAT: Create dedicated MenuAction class.
genedan May 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ scratch*.py
*.log
coverage.xml
docs/_build/
debian/files
debian/files
*.egg-info
25 changes: 25 additions & 0 deletions faslr/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
)

from faslr.style.main import (
MAIN_WINDOW_BACKGROUND_COLOR_DARK,
MAIN_WINDOW_BACKGROUND_COLOR_LIGHT,
MAIN_WINDOW_HEIGHT,
MAIN_WINDOW_WIDTH,
MAIN_WINDOW_TITLE
Expand All @@ -41,6 +43,11 @@
QThreadPool
)

from PyQt6.QtGui import (
QGuiApplication,
QPalette
)

from PyQt6.QtWidgets import (
QApplication,
QMainWindow,
Expand Down Expand Up @@ -80,6 +87,8 @@ def __init__(
MAIN_WINDOW_HEIGHT
)

self.set_background_color(scheme=QGuiApplication.styleHints().colorScheme())

self.setWindowTitle(MAIN_WINDOW_TITLE)

self.layout = QVBoxLayout()
Expand Down Expand Up @@ -110,6 +119,8 @@ def __init__(

self.auto_triangle = load_sample('us_industry_auto')
self.xyz_triangle = load_sample('uspp_incr_case')

QGuiApplication.styleHints().colorSchemeChanged.connect(self.set_background_color)
self.auto_tab = AnalysisTab(
triangle=self.auto_triangle
)
Expand All @@ -118,6 +129,7 @@ def __init__(
)

self.analysis_pane = QTabWidget()

self.analysis_pane.setTabsClosable(True)
self.analysis_pane.setMovable(True)
self.analysis_pane.addTab(self.auto_tab, "Auto")
Expand Down Expand Up @@ -153,6 +165,19 @@ def __init__(
main_window=self
)



def set_background_color(self, scheme: Qt.ColorScheme) -> None:
QApplication.setPalette(QApplication.style().standardPalette())

palette = self.palette()
if scheme == Qt.ColorScheme.Dark:
color = MAIN_WINDOW_BACKGROUND_COLOR_DARK
else:
color = MAIN_WINDOW_BACKGROUND_COLOR_LIGHT
palette.setColor(self.backgroundRole(), color)
self.setPalette(palette)

def remove_tab(
self,
index: int
Expand Down
86 changes: 57 additions & 29 deletions faslr/about.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from faslr.common.icon import InfoIcon

from faslr.constants import (
BUILD_VERSION,
CURRENT_BRANCH,
Expand All @@ -11,8 +13,8 @@
Qt
)

from PyQt6.QtSvgWidgets import (
QSvgWidget
from PyQt6.QtGui import (
QGuiApplication, QPalette, QColor
)

from PyQt6.QtWidgets import (
Expand Down Expand Up @@ -40,30 +42,44 @@ def __init__(

faslr_version = "FASLR v" + BUILD_VERSION

faslr_version_link = '<a href="https://github.com/casact/faslr" ' \
'style="text-decoration:none; color:#000000">' + \
faslr_version + '</a>'
faslr_version_link = "https://github.com/casact/faslr"

branch_link = '<a href="https://github.com/casact/faslr/tree/' + \
CURRENT_BRANCH + '" ' \
'style="text-decoration:none; color:#000000">' + \
CURRENT_BRANCH + '</a>'
branch_link = "https://github.com/casact/faslr/tree/" + CURRENT_BRANCH

commit_link = '<a href="https://github.com/casact/faslr/commit/' + \
CURRENT_COMMIT_LONG + '" ' \
'style="text-decoration:none; color:#000000">' + \
CURRENT_COMMIT + '</a>'
commit_link = "https://github.com/casact/faslr/commit/" + CURRENT_COMMIT_LONG

version_label = LinkLabel(faslr_version_link)
version_label = LinkLabel(
url=faslr_version_link,
label_text=faslr_version
)

branch_label = LinkLabel(branch_link)
commit_label = LinkLabel(commit_link)
branch_label = LinkLabel(
url=branch_link,
label_text=CURRENT_BRANCH
)

commit_label = LinkLabel(
url=commit_link,
label_text=CURRENT_COMMIT
)

gh_svg = InfoIcon(ICONS_PATH + "github.svg")
gh_svg = InfoIcon(
svg_path=ICONS_PATH + "github.svg",
width=24,
height=24
)

branch_svg = InfoIcon(OCTICONS_PATH + "git-branch-24.svg")
branch_svg = InfoIcon(
svg_path=OCTICONS_PATH + "git-branch-24.svg",
width=24,
height=24
)

commit_svg = InfoIcon(OCTICONS_PATH + "commit-24.svg")
commit_svg = InfoIcon(
OCTICONS_PATH + "commit-24.svg",
width=24,
height=24
)

layout = QVBoxLayout()

Expand Down Expand Up @@ -99,22 +115,18 @@ def ok(self) -> None:
self.close()


class InfoIcon(QSvgWidget):
def __init__(
self,
svg_path: str
):
super().__init__(svg_path)

self.setFixedSize(24, 24)


class LinkLabel(QLabel):
def __init__(
self,
url: str
url: str,
label_text: str
):
super().__init__(url)
super().__init__()

self.url = url
self.label_text = label_text

self.setTextFormat(Qt.TextFormat.RichText)

Expand All @@ -123,3 +135,19 @@ def __init__(
)

self.setOpenExternalLinks(True)
self.apply_theme(
scheme=QGuiApplication.styleHints().colorScheme() # noqa
)

QGuiApplication.styleHints().colorSchemeChanged.connect(self.apply_theme) # noqa


def apply_theme(self, scheme: Qt.ColorScheme):

if scheme == Qt.ColorScheme.Dark:
color = "#FFFFFF"
else:
color = "#000000"

self.setText(f'<a href="{self.url}" style="text-decoration:none; color:{color};">{self.label_text}</a>')

95 changes: 35 additions & 60 deletions faslr/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,21 @@
VALUE_TYPES_COMBO_BOX_WIDTH
)

from faslr.style.analysis import (
qss_analysis_tab_palette,
qss_column_tab
)

from faslr.utilities.accessors import get_column

from PyQt6.QtCore import (
Qt
)

from PyQt6.QtGui import QColor
from PyQt6.QtGui import (
QColor,
QGuiApplication
)

from PyQt6.QtWidgets import (
QComboBox,
Expand Down Expand Up @@ -59,6 +67,7 @@ def __init__(

self.triangle = triangle
self.lob = lob
self.theme = QGuiApplication.styleHints().colorScheme()

self.layout = QVBoxLayout()

Expand Down Expand Up @@ -89,11 +98,11 @@ def __init__(

# Used to solve some issues with borders not appearing when there's only 1 tab.
if column_count == 1:
bottom_border_width = 1
margin_top = "22"
self.bottom_border_width = "1"
self.margin_top = "22"
else:
bottom_border_width = 0
margin_top = "0"
self.bottom_border_width = "0"
self.margin_top = "0"

# For each chainladder column, we create a horizontal tab to the left.
for i in self.column_list:
Expand Down Expand Up @@ -151,15 +160,6 @@ def __init__(
triangle_model = TriangleModel(triangle_column, 'value')
self.triangle_views[i].setModel(triangle_model)

# self.analysis_containers[i].setStyleSheet(
# """
# DiagnosticWidget {
# border: 2px solid darkgrey;
# background: rgb(230, 230, 230);
# }
# """
# )

self.column_tab.addTab(self.analysis_containers[i], i)

self.layout.addWidget(
Expand All @@ -170,55 +170,11 @@ def __init__(

self.setLayout(self.layout)

self.column_tab.setStyleSheet(
"""
QTabBar::tab:first {{
margin-top: 22px;
border-bottom: {}px solid darkgrey;
}}


QTabBar::tab {{
margin-top: {}px;
background: rgb(230, 230, 230);
border: 1px solid darkgrey;
border-bottom: 1px solid darkgrey;
padding: 5px;
padding-left: 10px;
height: 125px;
margin-right: 0px;
border-right: 0px;
}}

QTabBar::tab:selected {{
background: rgb(245, 245, 245);

}}

QTabWidget::pane {{
border: 1px solid darkgrey;
}}
""".format(
bottom_border_width,
margin_top
)
)

self.setAutoFillBackground(True)
palette = self.palette()

palette.setColor(
self.backgroundRole(),
QColor.fromRgb(
240,
240,
240
)
)

self.setPalette(palette)
self.apply_theme(scheme=self.theme)

self.value_box.currentTextChanged.connect(self.update_value_type) # noqa
QGuiApplication.styleHints().colorSchemeChanged.connect(self.apply_theme)

def resizeEvent(self, event):

Expand Down Expand Up @@ -262,6 +218,25 @@ def update_value_type(self):
else:
self.analysis_containers[tab_name].setCurrentIndex(1)

def apply_theme(self, scheme: Qt.ColorScheme):

self.column_tab.setStyleSheet(
qss_column_tab(
scheme=scheme,
bottom_border_width=self.bottom_border_width,
margin_top=self.margin_top
)
)

palette = self.palette()

qss_analysis_tab_palette(
scheme=scheme,
palette=palette,
role=self.backgroundRole()
)

self.setPalette(palette)

class MackValuationModel(FAbstractTableModel):
def __init__(
Expand Down
Loading
Loading