Skip to content

Commit

Permalink
fix images path
Browse files Browse the repository at this point in the history
  • Loading branch information
nwg-piotr committed May 28, 2024
1 parent b767fa1 commit 2318ad5
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions azote/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

from azote.colorthief import ColorThief

dir_name = os.path.dirname(__file__)

gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GdkPixbuf, Gdk, GLib
from gi.repository.GdkPixbuf import InterpType
Expand Down Expand Up @@ -212,7 +214,7 @@ def __init__(self, thumbnail):

self.menu_btn = Gtk.EventBox()
img = Gtk.Image()
img.set_from_file('images/icon_image_menu.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_image_menu.svg'))
self.menu_btn.add(img)
self.menu_btn.connect('button-press-event', self.on_menu_button_press)
self.pack_start(self.menu_btn, False, False, 0)
Expand Down Expand Up @@ -243,7 +245,7 @@ def __init__(self, name, width, height, path=None, thumb=None, xrandr_idx=None):
if thumb and os.path.isfile(thumb):
pixbuf = GdkPixbuf.Pixbuf.new_from_file(thumb)
else:
pixbuf = GdkPixbuf.Pixbuf.new_from_file('images/empty.png')
pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.path.join(dir_name, 'images/empty.png'))
pixbuf = pixbuf.scale_simple(common.settings.thumb_size[0], common.settings.thumb_size[1], InterpType.BILINEAR)

self.img = Gtk.Image.new_from_pixbuf(pixbuf)
Expand Down Expand Up @@ -308,7 +310,7 @@ def __init__(self, name, width, height, path=None, thumb=None, xrandr_idx=None):
self.flip_button = Gtk.Button()
self.flip_button.set_always_show_image(True)
img = Gtk.Image()
img.set_from_file('images/icon_flip.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_flip.svg'))
self.flip_button.set_image(img)
self.flip_button.set_tooltip_text(common.lang['flip_image'])
self.flip_button.set_sensitive(False)
Expand Down Expand Up @@ -360,7 +362,7 @@ def on_mode_combo_changed(self, combo):
def on_color_chosen(self, user_data, button):
self.color = rgba_to_hex(button.get_rgba())
# clear selected image to indicate it won't be used
self.img.set_from_file("images/empty.png")
self.img.set_from_file(os.path.join(dir_name, "images/empty.png"))
common.apply_button.set_sensitive(True)

def on_flip_button(self, button):
Expand All @@ -383,13 +385,13 @@ def __init__(self):

def refresh(self):
if common.settings.sorting == 'old':
self.img.set_from_file('images/icon_old.svg')
self.img.set_from_file(os.path.join(dir_name, 'images/icon_old.svg'))
elif common.settings.sorting == 'az':
self.img.set_from_file('images/icon_az.svg')
self.img.set_from_file(os.path.join(dir_name, 'images/icon_az.svg'))
elif common.settings.sorting == 'za':
self.img.set_from_file('images/icon_za.svg')
self.img.set_from_file(os.path.join(dir_name, 'images/icon_za.svg'))
else:
self.img.set_from_file('images/icon_new.svg')
self.img.set_from_file(os.path.join(dir_name, 'images/icon_new.svg'))
self.set_image(self.img)

def on_sorting_button(self, widget):
Expand Down Expand Up @@ -587,7 +589,7 @@ def on_about_button(button):
print("Couldn't check version: {}".format(e))
pass

logo = GdkPixbuf.Pixbuf.new_from_file_at_size('images/azote.svg', 96, 96)
logo = GdkPixbuf.Pixbuf.new_from_file_at_size(os.path.join(dir_name, 'images/azote.svg'), 96, 96)

dialog.set_keep_above(True)
dialog.set_logo(logo)
Expand Down Expand Up @@ -916,7 +918,7 @@ def __init__(self, height):
refresh_button = Gtk.Button()
refresh_button.set_always_show_image(True)
img = Gtk.Image()
img.set_from_file('images/icon_refresh.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_refresh.svg'))
refresh_button.set_image(img)
refresh_button.set_tooltip_text(common.lang['refresh_folder_preview'])
bottom_box.add(refresh_button)
Expand All @@ -941,7 +943,7 @@ def __init__(self, height):
common.split_button = Gtk.Button()
common.split_button.set_always_show_image(True)
img = Gtk.Image()
img.set_from_file('images/icon_split.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_split.svg'))
common.split_button.set_image(img)
bottom_box.add(common.split_button)
common.split_button.set_sensitive(False)
Expand All @@ -952,7 +954,7 @@ def __init__(self, height):
common.apply_to_all_button = Gtk.Button()
common.apply_to_all_button.set_always_show_image(True)
img = Gtk.Image()
img.set_from_file('images/icon_all.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_all.svg'))
common.apply_to_all_button.set_image(img)
common.apply_to_all_button.connect('clicked', on_apply_to_all_button)
common.apply_to_all_button.set_sensitive(False)
Expand All @@ -967,7 +969,7 @@ def __init__(self, height):
common.apply_button = Gtk.Button()
common.apply_button.set_always_show_image(True)
img = Gtk.Image()
img.set_from_file('images/icon_apply.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_apply.svg'))
common.apply_button.set_image(img)
common.apply_button.connect('clicked', on_apply_button)
common.apply_button.set_sensitive(False)
Expand All @@ -989,7 +991,7 @@ def __init__(self, height):
about_button = Gtk.Button()
about_button.set_always_show_image(True)
img = Gtk.Image()
img.set_from_file('images/icon_about.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_about.svg'))
about_button.set_image(img)
about_button.set_tooltip_text(common.lang['about_azote'])
about_button.connect('clicked', on_about_button)
Expand All @@ -999,7 +1001,7 @@ def __init__(self, height):
settings_button = Gtk.Button()
settings_button.set_always_show_image(True)
img = Gtk.Image()
img.set_from_file('images/icon_menu.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_menu.svg'))
settings_button.set_image(img)
settings_button.set_tooltip_text(common.lang['preferences'])
settings_button.connect('clicked', on_settings_button)
Expand All @@ -1009,7 +1011,7 @@ def __init__(self, height):
picker_button = Gtk.Button()
picker_button.set_always_show_image(True)
img = Gtk.Image()
img.set_from_file('images/icon_picker.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_picker.svg'))
picker_button.set_image(img)
picker_button.set_sensitive(common.picker)
if common.sway or common.env['wayland']:
Expand All @@ -1024,7 +1026,7 @@ def __init__(self, height):
dotfiles_button = Gtk.Button()
dotfiles_button.set_always_show_image(True)
img = Gtk.Image()
img.set_from_file('images/icon_config.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_config.svg'))
dotfiles_button.set_image(img)
active = common.xresources or common.alacritty_config and common.env['yaml']
if active:
Expand Down Expand Up @@ -1515,7 +1517,7 @@ def __init__(self, color):
button = Gtk.Button()
button.set_always_show_image(True)
img = Gtk.Image()
img.set_from_file('images/icon_picker.svg')
img.set_from_file(os.path.join(dir_name, 'images/icon_picker.svg'))
button.set_image(img)
button.connect_after('clicked', self.pick_new_color)
hbox.pack_start(button, True, False, 0)
Expand Down

0 comments on commit 2318ad5

Please sign in to comment.