Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions pick/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,17 @@ def start_everything_first_time(self, on_window_map=None):
image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
else:
# not in the theme, so we're probably running locally;
# use the local one
image = Gtk.Image.new_from_file(os.path.join(
# try to use the local one
licon = os.path.join(
os.path.split(__file__)[0], "..",
"data", "icons", "scalable", "apps",
"pick-colour-picker-symbolic.svg"))
"data", "icons", "scalable", "apps", "pick-colour-picker-symbolic.svg")
if os.path.exists(licon):
image = Gtk.Image.new_from_file(licon)
else:
# last resort - assume the application data has been installed to User Programs
image = Gtk.Image.new_from_file(os.path.join(
sys.prefix, "share", "icons", "hicolor",
"scalable", "apps", "pick-colour-picker-symbolic.svg"))
btngrab.add(image)
head.pack_start(btngrab)
btngrab.connect("clicked", self.grab)
Expand Down Expand Up @@ -328,15 +334,23 @@ def start_everything_first_time(self, on_window_map=None):
if os.path.exists(licon):
# print("Using local icon", licon)
image = Gtk.Image.new_from_file(licon)
else:
# probably we're in a snap
elif os.environ.get('SNAP'):
# we're in a snap
sicon = os.path.join(
os.path.split(__file__)[0],
os.environ.get('SNAP'), "usr", "share", "icons", "hicolor",
"48x48", "apps", "pick-colour-picker.png")
if os.path.exists(sicon):
# print("Using local snap icon", sicon)
image = Gtk.Image.new_from_file(sicon)
if not image:
# last resort - assume the application data has been installed to User Programs
uicon = os.path.join(
sys.prefix, "share", "icons", "hicolor",
"48x48", "apps", "pick-colour-picker.png")
if os.path.exists(uicon):
# print("Using User Programs shared icon", uicon)
image = Gtk.Image.new_from_file(uicon)
# and set this as the default icon if it exists
if image:
self.w.set_default_icon(image.get_pixbuf())
Expand Down