Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement system theme (dark mode) and fix background image on windows. #792

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ KindleComicConverter*.egg-info/
/kindlegen*
/kcc.bat
.DS_Store
KCC_7.0.0.spec
2 changes: 1 addition & 1 deletion gui/KCC.ui
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@
<item row="2" column="0" colspan="2">
<widget class="QListWidget" name="jobList">
<property name="styleSheet">
<string notr="true">QListWidget#jobList {background:#ffffff;background-image:url(:/Other/icons/list_background.png);background-position:center center;background-repeat:no-repeat;color:rgb(0,0,0);}</string>
<string notr="true">QListWidget#jobList {background-image:url(:/Other/icons/list_background.png);background-position:center center;background-repeat:no-repeat;color:rgb(0,0,0);}</string>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
Expand Down
Binary file modified icons/list_background.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 icons/list_background.xcf
Binary file not shown.
Binary file added icons/list_background_old.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 icons/list_background_old.xcf
Binary file not shown.
30 changes: 27 additions & 3 deletions kindlecomicconverter/KCC_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,17 @@ def selectDir(self):
if sys.platform.startswith('win'):
dname = dname.replace('/', '\\')
self.lastPath = os.path.abspath(os.path.join(dname, os.pardir))
GUI.jobList.addItem(dname)
#formatting like addMessage to ensure theme compatibility
item = QtWidgets.QListWidgetItem(dname)
item.setForeground(QtGui.QColor('transparent'))
label = QtWidgets.QLabel(dname)
color_scheme = QtWidgets.QApplication.styleHints().colorScheme()
if color_scheme == QtWidgets.QApplication.styleHints().colorScheme().Dark:
label.setStyleSheet('background-image:url('');background-color:rgba(0,0,0,0);color:rgb(255,255,255);')
else:
label.setStyleSheet('background-image:url('');background-color:rgba(0,0,0,0);color:rgb(0,0,0);')
GUI.jobList.addItem(item)
GUI.jobList.setItemWidget(item, label)
GUI.jobList.scrollToBottom()

def selectFile(self):
Expand All @@ -477,7 +487,17 @@ def selectFile(self):
if sys.platform.startswith('win'):
fname = fname.replace('/', '\\')
self.lastPath = os.path.abspath(os.path.join(fname, os.pardir))
GUI.jobList.addItem(fname)
#formatting like addMessage to ensure theme compatibility
item = QtWidgets.QListWidgetItem(fname)
item.setForeground(QtGui.QColor('transparent'))
label = QtWidgets.QLabel(fname)
color_scheme = QtWidgets.QApplication.styleHints().colorScheme()
if color_scheme == QtWidgets.QApplication.styleHints().colorScheme().Dark:
label.setStyleSheet('background-image:url('');background-color:rgba(0,0,0,0);color:rgb(255,255,255);')
else:
label.setStyleSheet('background-image:url('');background-color:rgba(0,0,0,0);color:rgb(0,0,0);')
GUI.jobList.addItem(item)
GUI.jobList.setItemWidget(item, label)
GUI.jobList.scrollToBottom()

def selectFileMetaEditor(self):
Expand Down Expand Up @@ -689,7 +709,11 @@ def addMessage(self, message, icon, replace=False):
# We still fill original text field with transparent content to trigger creation of horizontal scrollbar
item.setForeground(QtGui.QColor('transparent'))
label = QtWidgets.QLabel(message)
label.setStyleSheet('background-image:url('');background-color:rgba(0,0,0,0);color:rgb(0,0,0);')
color_scheme = QtWidgets.QApplication.styleHints().colorScheme()
if color_scheme == QtWidgets.QApplication.styleHints().colorScheme().Dark:
label.setStyleSheet('background-image:url('');background-color:rgba(0,0,0,0);color:rgb(255,255,255);')
else:
label.setStyleSheet('background-image:url('');background-color:rgba(0,0,0,0);color:rgb(0,0,0);')
label.setOpenExternalLinks(True)
GUI.jobList.addItem(item)
GUI.jobList.setItemWidget(item, label)
Expand Down
24,601 changes: 12,933 additions & 11,668 deletions kindlecomicconverter/KCC_rc.py

Large diffs are not rendered by default.

Loading