Add ability to change theme

This commit is contained in:
SHooZ 2017-05-02 02:59:24 +03:00
parent 06e8c79b3f
commit 138135b9e9
6 changed files with 32 additions and 13 deletions

View file

@ -59,11 +59,6 @@ class Toxygen:
if platform.system() == 'Linux':
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
# application color scheme
with open(curr_directory() + '/styles/style.qss') as fl:
dark_style = fl.read()
app.setStyleSheet(dark_style)
encrypt_save = toxes.ToxES()
if self.path is not None:
@ -185,6 +180,16 @@ class Toxygen:
else:
settings.set_active_profile()
# application color scheme
for theme in settings.built_in_themes().keys():
if settings['theme'] == theme:
try:
with open(curr_directory() + settings.built_in_themes()[theme]) as fl:
style = fl.read()
app.setStyleSheet(style)
except IsADirectoryError:
app.setStyleSheet('') # for default style
lang = Settings.supported_languages()[settings['language']]
translator = QtCore.QTranslator()
translator.load(curr_directory() + '/translations/' + lang)