Merge pull request #44 from SHooZ/light_theme

Default system theme
This commit is contained in:
Ingvar 2017-05-03 19:51:38 +03:00 committed by GitHub
commit bf1bea1e93
8 changed files with 1358 additions and 1331 deletions

View File

@ -12,9 +12,9 @@ include toxygen/smileys/starwars/*.png
include toxygen/smileys/starwars/config.json include toxygen/smileys/starwars/config.json
include toxygen/smileys/ksk/*.png include toxygen/smileys/ksk/*.png
include toxygen/smileys/ksk/config.json include toxygen/smileys/ksk/config.json
include toxygen/styles/style.qss include toxygen/styles/*.qss
include toxygen/translations/*.qm include toxygen/translations/*.qm
include toxygen/libs/libtox.dll include toxygen/libs/libtox.dll
include toxygen/libs/libsodium.a include toxygen/libs/libsodium.a
include toxygen/libs/libtox64.dll include toxygen/libs/libtox64.dll
include toxygen/libs/libsodium64.a include toxygen/libs/libsodium64.a

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -59,10 +59,9 @@ class Toxygen:
if platform.system() == 'Linux': if platform.system() == 'Linux':
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads) QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
# application color scheme with open(curr_directory() + '/styles/dark_style.qss') as fl:
with open(curr_directory() + '/styles/style.qss') as fl: style = fl.read()
dark_style = fl.read() app.setStyleSheet(style)
app.setStyleSheet(dark_style)
encrypt_save = toxes.ToxES() encrypt_save = toxes.ToxES()
@ -185,6 +184,13 @@ class Toxygen:
else: else:
settings.set_active_profile() settings.set_active_profile()
# application color scheme
for theme in settings.built_in_themes().keys():
if settings['theme'] == theme:
with open(curr_directory() + settings.built_in_themes()[theme]) as fl:
style = fl.read()
app.setStyleSheet(style)
lang = Settings.supported_languages()[settings['language']] lang = Settings.supported_languages()[settings['language']]
translator = QtCore.QTranslator() translator = QtCore.QTranslator()
translator.load(curr_directory() + '/translations/' + lang) translator.load(curr_directory() + '/translations/' + lang)

View File

@ -581,11 +581,10 @@ class InterfaceSettings(CenteredWidget):
self.label.setFont(font) self.label.setFont(font)
self.themeSelect = QtGui.QComboBox(self) self.themeSelect = QtGui.QComboBox(self)
self.themeSelect.setGeometry(QtCore.QRect(30, 40, 120, 30)) self.themeSelect.setGeometry(QtCore.QRect(30, 40, 120, 30))
list_of_themes = ['dark'] self.themeSelect.addItems(list(settings.built_in_themes().keys()))
self.themeSelect.addItems(list_of_themes)
theme = settings['theme'] theme = settings['theme']
if theme in list_of_themes: if theme in settings.built_in_themes().keys():
index = list_of_themes.index(theme) index = list(settings.built_in_themes().keys()).index(theme)
else: else:
index = 0 index = 0
self.themeSelect.setCurrentIndex(index) self.themeSelect.setCurrentIndex(index)
@ -726,6 +725,14 @@ class InterfaceSettings(CenteredWidget):
def closeEvent(self, event): def closeEvent(self, event):
settings = Settings.get_instance() settings = Settings.get_instance()
settings['theme'] = str(self.themeSelect.currentText()) settings['theme'] = str(self.themeSelect.currentText())
try:
theme = settings['theme']
app = QtGui.QApplication.instance()
with open(curr_directory() + settings.built_in_themes()[theme]) as fl:
style = fl.read()
app.setStyleSheet(style)
except IsADirectoryError:
app.setStyleSheet('') # for default style
settings['smileys'] = self.smileys.isChecked() settings['smileys'] = self.smileys.isChecked()
restart = False restart = False
if settings['mirror_mode'] != self.mirror_mode.isChecked(): if settings['mirror_mode'] != self.mirror_mode.isChecked():

View File

@ -99,7 +99,7 @@ class Settings(dict, Singleton):
Default profile settings Default profile settings
""" """
return { return {
'theme': 'default', 'theme': 'dark',
'ipv6_enabled': True, 'ipv6_enabled': True,
'udp_enabled': True, 'udp_enabled': True,
'proxy_type': 0, 'proxy_type': 0,
@ -152,6 +152,13 @@ class Settings(dict, Singleton):
'Ukrainian': 'uk_UA' 'Ukrainian': 'uk_UA'
} }
@staticmethod
def built_in_themes():
return {
'dark': '/styles/dark_style.qss',
'default': '/styles/style.qss'
}
def upgrade(self): def upgrade(self):
default = Settings.get_default_settings() default = Settings.get_default_settings()
for key in default: for key in default:

File diff suppressed because it is too large Load Diff

View File

@ -41,6 +41,9 @@
<file>rc/radio_unchecked.png</file> <file>rc/radio_unchecked.png</file>
</qresource> </qresource>
<qresource prefix="qdarkstyle"> <qresource prefix="qdarkstyle">
<file>dark_style.qss</file>
</qresource>
<qresource prefix="defaultstyle">
<file>style.qss</file> <file>style.qss</file>
</qresource> </qresource>
</RCC> </RCC>

File diff suppressed because it is too large Load Diff