Skip to content

Commit

Permalink
optimise and fix dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Furtif committed Mar 4, 2024
1 parent 8fb8f4a commit 98f8a2b
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 419 deletions.
Binary file modified dtt4all_data/icons/bt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dtt4all_data/icons/expert-b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dtt4all_data/icons/wifi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 12 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,10 @@ def __init__(self, parent=None):
self.log.setCheckable(True)
self.log.setChecked(options.log_all)
self.log.triggered.connect(self.changeLogMode)

self.expert = widgets.QAction(gui.QIcon("dtt4all_data/icons/expert.png"), _("Expert mode (enable writing)"), self)
if options.dark_mode:
self.expert = widgets.QAction(gui.QIcon("dtt4all_data/icons/expert-b.png"), _("Expert mode (enable writing)"), self)
else:
self.expert = widgets.QAction(gui.QIcon("dtt4all_data/icons/expert.png"), _("Expert mode (enable writing)"), self)
self.expert.setCheckable(True)
self.expert.setChecked(options.promode)
self.expert.triggered.connect(self.changeUserMode)
Expand Down Expand Up @@ -443,27 +445,30 @@ def __init__(self, parent=None):

self.toolbar.addSeparator()
self.toolbar.addAction(self.log)
self.toolbar.addSeparator()
self.toolbar.addAction(self.expert)
self.toolbar.addSeparator()
self.toolbar.addAction(self.autorefresh)
self.toolbar.addSeparator()
self.toolbar.addAction(self.refresh)
self.toolbar.addSeparator()
self.toolbar.addAction(self.diagaction)
self.toolbar.addSeparator()
self.toolbar.addAction(self.hexinput)
self.toolbar.addSeparator()
self.toolbar.addAction(self.cominput)
self.toolbar.addSeparator()
self.toolbar.addAction(self.fctrigger)
self.toolbar.addSeparator()
self.toolbar.addWidget(self.canlinecombo)
self.toolbar.addSeparator()
self.toolbar.addWidget(self.sdscombo)
self.toolbar.addSeparator()
self.toolbar.addWidget(self.zoominbutton)
self.toolbar.addSeparator()
self.toolbar.addWidget(self.zoomoutbutton)

if options.simulation_mode:
self.toolbar.addSeparator()
self.ui_edit_button = widgets.QPushButton(_("UI Edit"))
self.ui_edit_button.setCheckable(True)
self.toolbar.addSeparator()
Expand Down Expand Up @@ -1154,10 +1159,11 @@ def set_dark_style(onoff):
if (onoff):
stylefile = core.QFile("qstyle.qss")
stylefile.open(core.QFile.ReadOnly)

options.dark_mode = True
StyleSheet = bytes(stylefile.readAll()).decode()
else:
StyleSheet = ""
options.dark_mode = False

app.setStyleSheet(StyleSheet)

Expand Down Expand Up @@ -1558,8 +1564,8 @@ def demoMode(self):
options.simultation_mode = True
app = widgets.QApplication(sys.argv)

fsize = 10
fname = "Tahoma"
fsize = 9
fname = "Segoe UI"

if sys.platform[:3] == "dar":
fsize = 12
Expand Down
1 change: 1 addition & 0 deletions options.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# KWP2000 Slow init
opt_si = False
report_data = True
dark_mode = False
ecus_dir = "ecus/"
graphics_dir = "graphics/"
last_error = ""
Expand Down
Loading

0 comments on commit 98f8a2b

Please sign in to comment.