snap: fix packaging for gtk app

This commit is contained in:
shadeyg56 2023-08-16 02:06:24 -05:00
parent 704a968f83
commit df6192298e
3 changed files with 14 additions and 32 deletions

View File

@ -11,7 +11,12 @@ sys.path.append("../")
from auto_cpufreq.core import is_running
from auto_cpufreq.gui.objects import RadioButtonView, SystemStatsLabel, CPUFreqStatsLabel, CurrentGovernorBox, DropDownMenu, DaemonNotRunningView
CSS_FILE = "/usr/local/share/auto-cpufreq/scripts/style.css"
if os.getenv("PKG_MARKER") == "SNAP":
ICON_FILE = "/snap/auto-cpufreq/current/icon.png"
CSS_FILE = "/snap/auto-cpufreq/current/style.css"
else:
ICON_FILE = "/usr/local/share/auto-cpufreq/images/icon.png"
CSS_FILE = "/usr/local/share/auto-cpufreq/scripts/style.css"
HBOX_PADDING = 20
@ -22,7 +27,7 @@ class ToolWindow(Gtk.Window):
self.set_border_width(10)
self.set_resizable(False)
self.load_css()
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(filename="/usr/local/share/auto-cpufreq/images/icon.png", width=500, height=500, preserve_aspect_ratio=True)
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(filename=ICON_FILE, width=500, height=500, preserve_aspect_ratio=True)
self.set_icon(pixbuf)
self.build()

View File

@ -3,7 +3,7 @@ Type=Application
Encoding=UTF-8
Name=auto-cpufreq
Comment=Automatic CPU speed & power optimizer for Linux
Exec=auto-cpufreq-gtk
Exec=auto-cpufreq.auto-cpufreq-gtk
StartupWMClass=app.py
Terminal=false
Icon=${SNAP}/meta/gui/auto-cpufreq.png

View File

@ -24,8 +24,6 @@ parts:
build-packages:
- gcc
- python3-dev
- libgirepository1.0-dev
- libcairo2-dev
stage-packages:
- coreutils
- dmidecode
@ -34,25 +32,6 @@ parts:
snapcraftctl pull
snapcraftctl set-version `grep ^VERSION $SNAPCRAFT_PART_SRC/setup.py | sed 's/.*"\(.*\)"/\1/'`
auto-cpufreq-gtk:
plugin: python
python-packages:
- setuptools
- wheel
- requests
build-packages:
- gcc
- python3-dev
- libgirepository1.0-dev
- libcairo2-dev
stage-packages:
- coreutils
- dmidecode
source: .
# override-pull: |
# snapcraftctl pull
# snapcraftctl set-version `grep ^VERSION $SNAPCRAFT_PART_SRC/setup.py | sed 's/.*"\(.*\)"/\1/'`
deploy-scripts:
plugin: dump
source: scripts
@ -60,11 +39,9 @@ parts:
cpufreqctl.sh: usr/bin/cpufreqctl.auto-cpufreq
snapdaemon.sh: usr/bin/snapdaemon
# deploy-auto-cpufreq-gtk:
# plugin: dump
# source: bin
# organize:
# auto-cpufreq-gtk: usr/bin/auto-cpufreq-gtk
copy-image:
plugin: dump
source: images
plugs:
etc-auto-cpufreq-conf:
@ -85,9 +62,10 @@ apps:
- system-observe
- hardware-observe
- etc-auto-cpufreq-conf
auto-cpufreq-gtk:
command: bin/auto-cpufreq-gtk
#desktop: usr/share/applications/auto-cpufreq.desktop
extensions: [gnome]
environment:
PYTHONPATH: $SNAP/usr/lib/python3/site-packages:$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
LC_ALL: C.UTF-8
@ -101,14 +79,13 @@ apps:
- cpu-control
- system-observe
- hardware-observe
- etc-auto-cpufreq-conf
service:
command: usr/bin/snapdaemon
plugs:
- cpu-control
- system-observe
- hardware-observe
- etc-auto-cpufreq-conf
environment:
LC_ALL: C.UTF-8
LANG: C.UTF-8