- Posts: 2419
- Thank you received: 0
Programmer info: Change system theme color into dark with 3 lines of python code
8 years 2 months ago #115332
by Grotius
Programmer info: Change system theme color into dark with 3 lines of python code was created by Grotius
Example normal system theme colors :
Example after 3 lines of code :
There is no need for this :
themedir = "/usr/share/themes"
userthemedir = os.path.join(os.path.expanduser("~"), ".themes")
In Gscreen this code is for changing system theme, Gmoccapy uses almost the same code :
Attachment not found
Code:
import gtk
self.settings = gtk.settings_get_default()
self.settings.set_property("gtk-theme-name", "Adwaita-dark")
Example after 3 lines of code :
Attachment not found
There is no need for this :
themedir = "/usr/share/themes"
userthemedir = os.path.join(os.path.expanduser("~"), ".themes")
In Gscreen this code is for changing system theme, Gmoccapy uses almost the same code :
Code:
# get the system wide theme
settings = gtk.settings_get_default()
settings.props.gtk_button_images = True
self.data.system_theme = settings.get_property("gtk-theme-name")
# check for a local theme gtkrc file
localtheme = os.path.join(CONFIGPATH,'%s_theme'%self.skinname)
if os.path.exists(localtheme):
print 'local theme path found'
self.data.local_theme = 'Link to %s_theme'% self.skinname
# make ~/.themes - quietly ignore the error if it exists
try:
os.makedirs(userthemedir)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
# create systemlink because one can't store themes in an arbitrary folder.
if not os.path.exists(userthemedir+'/%s'%self.data.local_theme):
os.symlink(localtheme,userthemedir+'/%s'%self.data.local_theme)
settings = gtk.settings_get_default()
settings.set_string_property("gtk-theme-name", self.data.local_theme, "")
else:
self.data.local_theme = None
Please Log in to join the conversation.
8 years 2 months ago #115368
by cmorley
Replied by cmorley on topic Programmer info: Change system theme color into dark with 3 lines of python code
This is because Gscreen and Gmoccapy allow you to have your special theme in the config folder rather then the system folder.
Some CNC themes are not suitable for the system.
Chris M
Some CNC themes are not suitable for the system.
Chris M
Please Log in to join the conversation.
Time to create page: 0.152 seconds
