Skip to content

Commit

Permalink
Use function get_app_homedir to get themes' location.
Browse files Browse the repository at this point in the history
  • Loading branch information
denisfa committed Nov 14, 2018
1 parent dc364ae commit f8d8b3b
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions dockbarx/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import array
from common import ODict
from common import Globals
from common import get_app_homedir
from log import logger
from PIL import Image

Expand Down Expand Up @@ -146,12 +147,12 @@ def on_theme_changed(self, arg=None):

def find_themes(self):
# Reads the themes from /usr/share/dockbarx/themes and
# ~/.dockbarx/themes and returns a dict
# of the theme names and paths so that a theme can be loaded
# ${XDG_DATA_HOME:-$HOME/.local/share}/dockbarx/themes
# and returns a dict of the theme names and paths so
# that a theme can be loaded.
themes = {}
theme_paths = []
homeFolder = os.path.expanduser("~")
theme_folder = homeFolder + "/.dockbarx/themes"
theme_folder = os.path.join(get_app_homedir(), "themes")
dirs = ["/usr/share/dockbarx/themes", theme_folder]
for dir in dirs:
if os.path.exists(dir) and os.path.isdir(dir):
Expand All @@ -171,11 +172,11 @@ def find_themes(self):
md = gtk.MessageDialog(None,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE,
_("No working themes found in /usr/share/dockbarx/themes or ~/.dockbarx/themes"))
_("No working themes found in /usr/share/dockbarx/themes or ${XDG_DATA_HOME:-$HOME/.local/share}/dockbarx/themes"))
md.run()
md.destroy()
raise NoThemesError("No working themes found in " + \
"/usr/share/dockbarx/themes or ~/.dockbarx/themes")
"/usr/share/dockbarx/themes or ${XDG_DATA_HOME:-$HOME/.local/share}/dockbarx/themes")
return themes

def reload(self):
Expand Down Expand Up @@ -407,12 +408,12 @@ def get(self, key, default=None):

def find_styles(self):
# Reads the styles from /usr/share/dockbarx/themes/popup_styles and
# ~/.dockbarx/themes/popup_styles and returns a dict
# of the style file names and paths so that a style can be loaded
# ${XDG_DATA_HOME:-$HOME/.local/share}/dockbarx/themes/popup_styles
# and returns a dict of the style file names and paths so that a
# style can be loaded
styles = {}
style_paths = []
homeFolder = os.path.expanduser("~")
style_folder = homeFolder + "/.dockbarx/themes/popup_styles"
style_folder = os.path.join(get_app_homedir(), "themes", "popup_styles")
dirs = ["/usr/share/dockbarx/themes/popup_styles", style_folder]
for dir in dirs:
if os.path.exists(dir) and os.path.isdir(dir):
Expand Down Expand Up @@ -522,8 +523,7 @@ def get_styles(self, theme_name=None):
# For DockbarX preference. This function makes a dict of the names and
# file names of the styles for all styles that can be opened correctly.
styles = {}
home_folder = os.path.expanduser("~")
style_folder = home_folder + "/.dockbarx/themes/popup_styles"
style_folder = os.path.join(get_app_homedir(), "themes", "popup_styles")
dirs = ["/usr/share/dockbarx/themes/popup_styles", style_folder]
for dir in dirs:
if os.path.exists(dir) and os.path.isdir(dir):
Expand Down Expand Up @@ -613,12 +613,12 @@ def get_bg(self, bar, size=None):

def find_themes(self):
# Reads the themes from /usr/share/dockbarx/themes/dock_themes and
# ~/.dockbarx/themes/dock_themes and returns a dict
# of the theme file names and paths so that a theme can be loaded
# ${XDG_DATA_HOME:-$HOME/.local/share}/dockbarx/themes/dock_themes
# and returns a dict of the theme file names and paths so that a
# theme can be loaded
themes = {}
theme_paths = []
homeFolder = os.path.expanduser("~")
theme_folder = homeFolder + "/.dockbarx/themes/dock"
theme_folder = os.path.join(get_app_homedir(), "themes", "dock")
dirs = ["/usr/share/dockbarx/themes/dock", theme_folder]
for dir in dirs:
if os.path.exists(dir) and os.path.isdir(dir):
Expand Down Expand Up @@ -734,8 +734,7 @@ def get_themes(self):
# For DockbarX preference. This function makes a dict of the names and
# file names of the themes for all themes that can be opened correctly.
themes = {}
home_folder = os.path.expanduser("~")
theme_folder = home_folder + "/.dockbarx/themes/dock"
theme_folder = os.path.join(get_app_homedir(), "themes", "dock")
dirs = ["/usr/share/dockbarx/themes/dock", theme_folder]
for dir in dirs:
if os.path.exists(dir) and os.path.isdir(dir):
Expand Down

0 comments on commit f8d8b3b

Please sign in to comment.