1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-05-07 17:29:50 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
880205dbc8
Fix python 3.10 in default action 2022-01-24 19:30:42 -06:00
6456e64328
Update python versions for CI/CD
- Update python versions for Default action
- Set python versions for sonarcloud
2022-01-24 19:27:29 -06:00
f6a0c0cc6d
Add initial dark style for use in Windows
- Other platforms can achieve this with the OS theme so not enabled for them at this time.
- Adds preference in display options to use dark style, default is false.
2022-01-24 19:14:30 -06:00
5 changed files with 57 additions and 8 deletions

View File

@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
@ -28,10 +28,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
@ -45,16 +45,20 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
exclude:
- os: macos-latest
python-version: 3.6
- os: macos-latest
python-version: 3.7
- os: macos-latest
python-version: 3.8
- os: windows-latest
python-version: 3.6
- os: windows-latest
python-version: 3.7
- os: windows-latest
python-version: 3.8
steps:
- uses: actions/checkout@v2

1
.sonarcloud.properties Normal file
View File

@ -0,0 +1 @@
sonar.python.version=3.6, 3.7, 3.8, 3.9, 3.10

View File

@ -8,11 +8,11 @@ import sys
import os.path as op
from PyQt5.QtCore import QTimer, QObject, QUrl, pyqtSignal, Qt
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtWidgets import QApplication, QFileDialog, QDialog, QMessageBox
from PyQt5.QtGui import QColor, QDesktopServices, QPalette
from PyQt5.QtWidgets import QApplication, QFileDialog, QDialog, QMessageBox, QStyleFactory, QToolTip
from hscommon.trans import trget
from hscommon import desktop
from hscommon import desktop, plat
from qtlib.about_box import AboutBox
from qtlib.recent import Recent
@ -197,6 +197,8 @@ class DupeGuru(QObject):
if self.details_dialog:
self.details_dialog.update_options()
self._set_style("dark" if self.prefs.use_dark_style else "light")
# --- Private
def _get_details_dialog_class(self):
if self.model.app_mode == AppMode.PICTURE:
@ -214,6 +216,39 @@ class DupeGuru(QObject):
else:
return PreferencesDialogStandard
def _set_style(self, style="light"):
# Only support this feature on windows for now
if not plat.ISWINDOWS:
return
if style == "dark":
QApplication.setStyle(QStyleFactory.create("Fusion"))
palette = QApplication.style().standardPalette()
palette.setColor(QPalette.ColorRole.Window, QColor(53, 53, 53))
palette.setColor(QPalette.ColorRole.WindowText, Qt.white)
palette.setColor(QPalette.ColorRole.Base, QColor(25, 25, 25))
palette.setColor(QPalette.ColorRole.AlternateBase, QColor(53, 53, 53))
palette.setColor(QPalette.ColorRole.ToolTipBase, QColor(53, 53, 53))
palette.setColor(QPalette.ColorRole.ToolTipText, Qt.white)
palette.setColor(QPalette.ColorRole.Text, Qt.white)
palette.setColor(QPalette.ColorRole.Button, QColor(53, 53, 53))
palette.setColor(QPalette.ColorRole.ButtonText, Qt.white)
palette.setColor(QPalette.ColorRole.BrightText, Qt.red)
palette.setColor(QPalette.ColorRole.Link, QColor(42, 130, 218))
palette.setColor(QPalette.ColorRole.Highlight, QColor(42, 130, 218))
palette.setColor(QPalette.ColorRole.HighlightedText, Qt.black)
palette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.Text, QColor(164, 166, 168))
palette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.WindowText, QColor(164, 166, 168))
palette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.ButtonText, QColor(164, 166, 168))
palette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.HighlightedText, QColor(164, 166, 168))
palette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.Base, QColor(68, 68, 68))
palette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.Window, QColor(68, 68, 68))
palette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.Highlight, QColor(68, 68, 68))
else:
QApplication.setStyle(QStyleFactory.create("windowsvista" if plat.ISWINDOWS else "Fusion"))
palette = QApplication.style().standardPalette()
QToolTip.setPalette(palette)
QApplication.setPalette(palette)
# --- Public
def add_selected_to_ignore_list(self):
self.model.add_selected_to_ignore_list()

View File

@ -30,6 +30,7 @@ class Preferences(PreferencesBase):
if not self.language and trans.installed_lang:
self.language = trans.installed_lang
self.portable = get("Portable", False)
self.use_dark_style = get("UseDarkStyle", False)
self.use_native_dialogs = get("UseNativeDialogs", True)
self.tableFontSize = get("TableFontSize", self.tableFontSize)
@ -95,6 +96,7 @@ class Preferences(PreferencesBase):
self.destination_type = 1
self.custom_command = ""
self.language = trans.installed_lang if trans.installed_lang else ""
self.use_dark_style = False
self.use_native_dialogs = True
self.tableFontSize = QApplication.font().pointSize()
@ -146,6 +148,7 @@ class Preferences(PreferencesBase):
set_("CustomCommand", self.custom_command)
set_("Language", self.language)
set_("Portable", self.portable)
set_("UseDarkStyle", self.use_dark_style)
set_("UseNativeDialogs", self.use_native_dialogs)
set_("TableFontSize", self.tableFontSize)

View File

@ -29,6 +29,7 @@ from PyQt5.QtWidgets import (
QFormLayout,
)
from PyQt5.QtGui import QPixmap, QIcon
from hscommon import plat
from hscommon.trans import trget
from hscommon.plat import ISLINUX
@ -168,6 +169,9 @@ On MacOS, the tab bar will fill up the window's width instead."
)
)
layout.addWidget(self.use_native_dialogs)
if plat.ISWINDOWS:
self._setupAddCheckbox("use_dark_style", tr("Use dark style"))
layout.addWidget(self.use_dark_style)
self.ui_groupbox.setLayout(layout)
self.displayVLayout.addWidget(self.ui_groupbox)
@ -297,6 +301,7 @@ use the modifier key to drag the floating window around"
setchecked(self.reference_bold_font, prefs.reference_bold_font)
setchecked(self.tabs_default_pos, prefs.tabs_default_pos)
setchecked(self.use_native_dialogs, prefs.use_native_dialogs)
setchecked(self.use_dark_style, prefs.use_dark_style)
setchecked(
self.details_dialog_titlebar_enabled,
prefs.details_dialog_titlebar_enabled,
@ -341,6 +346,7 @@ use the modifier key to drag the floating window around"
prefs.tableFontSize = self.fontSizeSpinBox.value()
prefs.tabs_default_pos = ischecked(self.tabs_default_pos)
prefs.use_native_dialogs = ischecked(self.use_native_dialogs)
prefs.use_dark_style = ischecked(self.use_dark_style)
lang = self.supportedLanguages[self.languageComboBox.currentIndex()]
oldlang = self.app.prefs.language
if oldlang not in self.supportedLanguages: