Closed dev-rke closed 3 years ago
I am using Ubuntu 20.04.1 so quite the same, as you, but I do not get this error message. So it seems some package is missing, but which...
I thought radiotray is already using gtk3, because gi.require_version("Gtk", "3.0")
is everywhere defined and I added it where require_version was missing
The link from you discuss the transition to python gi, but radiotray is already using the gi module. So it seems the article is about another problem.
Can you please check, if you have following modules installed: python3-gst-1.0, python3-gi, python3-lxml, python3-dbus, python3-xdg
Edit
The upper should be installed as dependency from radiotray. Do you have python3-gi-cairo
installed? That is the only gi related module I have installed due to other programs.
Hi @Borim7 ,
Thanks for your help!
I just installed radiotray from the ppa on a second system. This system was originally installed with Ubuntu 14.04 and updated along all LTS versions. It has no issues, radiotray works as expected! :-)
Also all dependencies you named exist and are successfully installed, also python3-gi-cairo
.
I assume python3-gi-cairo
is installed due to meld
on my second machine, but typically this should be installed on my first system, too.
I will check my first system (the one with the issues) regarding dependencies propably tomorrow or on friday, unfortunately i just had to bring it to the service as i have issues with the battery.
The application is running very smooth, it is a pleasure to see the familiar icon in the toolbar! Even the issues i had in the past using the legacy radiotray with a specific stream url (some stuttering after a while) are gone! :-)
Thank you very much for your effort!
I am glad that my work help others ^^ The cleanup of the ppa stuff is done. I think I finalize version 0.8.0 after this issue is solved
Hi @Borim7 ,
i got my laptop back, just verified the packages: all of them (including gi-cairo) exist, but unfortunately it still does not work, error is still the same.
My first approach was to fix the error thrown via status_icon_new_from_file in SysTrayGui.py to fix the exception from Gtk:
-self.icon = Gtk.status_icon_new_from_file(APP_ICON_OFF)
+self.icon = Gtk.StatusIcon()
+self.icon.set_from_file(APP_ICON_OFF)
That worked, application is starting without errors, but no icon is shown in tray. I remembered i had issues around 2016 / 2017 with radiotray, that my tray icon did not show up, so i digged deeper.
First the code tries to indicate, if the appindicator module is available. If it is available and in config.xml the setting gui_engine
is chooser
(which is default on first start), then you are asked if you would like to use an Gtk icon or an appindicator icon.
If appindicator is not installed successfully, they don't ask the user and use the regular Gtk icons by default. appindicator3 was already installed in my environment. Then i googled for python and appindicator and there was actually a package called python-appindicator, which is unfortunately not available anymore.
But via apt-search i stumbled upon the package gir1.2-appindicator3-0.1
installed it and voilá, radiotray works! :-)
Regarding the code change: it won't work on Ubuntu in my opinion, but it might work on other systems like FreeBSD or something else.
So my recommendation is to add gir1.2-appindicator3-0.1
as dependency and do the code change as it seems to be more compatible.
Thanks for tracking this bug down. I will apply both suggestions, although it looks like this topic will keep me busy. The GTK team announced that they want to drop the status icon support completely:
Glad my effort helps to improve the application. :-)
Regarding the status icon: i think you should not worry at the moment, this might come up in the future.
And removing the old status icon should be not that much effort in future.
I just wanted to mention, i also tested several other existing appindicator
libs that are available when you do apt search appindicator
, but this was the only dependency that worked well - so it was kinda brute force dependency resolve. :D
So i am not 100% sure, that gir1.2-appindicator3-0.1
is the correct library, but it is the only one i found that solved my issue.
I also have gir1.2-appindicator3-0.1
installed on my machines, so it looks like a good bet for the AppIndicator module.
In general the dependencies of python gi is not well documented (https://pygobject.readthedocs.io/en/latest/guide/api/index.html) and I have to do most of the time try and error :-/
Another idea that came up when i thought about it a bit deeper about it: on systems that don't provide an appindicator the dependency might probably fail. So we should try to not depend hard on this dependency.
One approach might be to use the Recommends
relationship feature of a debian package, as it will be installed automatically if it exists, but won't fail, if it does not exist.
Or would you vote for "just get it working on Ubuntu based systems"? :D What do you think?
For now it is defined as Depends
gir1.2-appindicator3-0.1 and I will keep it for now. The package comes from the debian repository thus in most cases it should be available. So it is more working on debian based systems ; )
Also your observation
That worked, application is starting without errors, but no icon is shown in tray.
is another reason to keep depends ; )
I can rethink about this topic after the first issue is raised about it X-D
Yeah, it will work on Ubuntu systems without any issues now.
As far as i know Debian does not provide a system tray by default, an appindicator must be installed manually.
See
https://ep.gnt.md/index.php/how-to-install-and-enable-gnome-system-tray-icons-in-debian-10/
as example.
Probably we might add gnome-shell-extension-appindicator
as a soft dependency (=Recommends) to make it work on Debian ootb, too? :-)
At least Debian Buster provides gir1.2-appindicator3-0.1
as a package, in theory Depends
won't raise issues.
Also your observation "That worked, application is starting without errors, but no icon is shown in tray." is another reason to keep depends ; )
Nope. My idea was to support also operating systems without a system tray, like Debian does by default. I thought about the situation for systems, where the dependency is not available. When you do a hard dependency, the application cannot be installed via package, even when the regular StatusIcon approach would work. Can you tell this for several Ubuntu flavors like Xubuntu / Lubuntu or derived distros like Linux Mint or Elementary OS?
If you don't mind at the moment, it's ok for me. ;-)
Hi @Borim7 ,
Installation worked as expected from the new PPA (thanks again for this! :-)) Running on a pretty fresh install of Ubuntu 20.04.1 on bash shell:
I did some research and found out, that radiotray relied on pygtk and implicitly on python2-gtk. Both packages won't be available on Ubuntu 20.04, see also this issue: https://comp.lang.python.narkive.com/U81cDMiB/need-to-import-gtk-on-ubuntu-20-04-what-do-i-need As far as i understand i am unable to solve this by installing another dependency.
I tried to use
from gi import pygtkcompat pygtkcompat.enable() pygtkcompat.enable_gtk(version='3.0')
which did not work, so i might need to dig deeper and improve my python knowledge.Do you have any idea on this? As far as i understood during my research, we need to port the whole systray stuff to a newer gtk lib, e.g. gtk3+, right?
By the way: Which distribution do you use?