Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppIndicator3.Indicator.set_icon is deprecated (use set_icon_full?) #516

Open
RedBearAK opened this issue May 13, 2021 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@RedBearAK
Copy link
Contributor

RedBearAK commented May 13, 2021

Edit: See possible solution, next post.

Another minor deprecation warning, in kintotray.py:

kris@aspire-ubuntu:~/.config/kinto$ ./kintotray.py 
/home/kris/.config/kinto/./kintotray.py:301: DeprecationWarning: AppIndicator3.Indicator.set_icon is deprecated
  self.indicator.set_icon(os.environ['HOME']+'/.config/kinto/kinto.svg')

Only reference I can immediately find for what to change it to is here:

https://askubuntu.com/questions/490634/application-indicator-icon-not-changing-until-clicked

BTW, it better to use set_icon_full, set_icon is deprecated. (Tested on Ubuntu 14.04)
@RedBearAK RedBearAK added the bug Something isn't working label May 13, 2021
@RedBearAK
Copy link
Contributor Author

Possible solution. This appears to get rid of the deprecation warning and keep the tray icon working. It follows the state of stopped, running, and cycles white-black-white as expected while restarting from the tray icon menu.

def update_terminal(self):
        status = self.non_block_read().strip()
        nowts = int(time.time())
        kinto_icon_desc = "Kinto"
        if (nowts - self.unixts) > 5 and (status=='active' and self.indicator.get_icon() != os.environ['HOME']+'/.config/kinto/kinto-invert.svg'):
            self.indicator.set_icon_full(os.environ['HOME']+'/.config/kinto/kinto-invert.svg', kinto_icon_desc)
        elif (nowts - self.unixts) > 5 and (status == 'inactive' and self.indicator.get_icon() != os.environ['HOME']+'/.config/kinto/kinto.svg'):
            self.indicator.set_icon_full(os.environ['HOME']+'/.config/kinto/kinto.svg', kinto_icon_desc)
        self.last_status = status

Original for reference to changes:

    def update_terminal(self):
        status = self.non_block_read().strip()
        nowts = int(time.time())
        if (nowts - self.unixts) > 5 and (status=='active' and self.indicator.get_icon() != os.environ['HOME']+'/.config/kinto/kinto-invert.svg'):
            self.indicator.set_icon(os.environ['HOME']+'/.config/kinto/kinto-invert.svg')
        elif (nowts - self.unixts) > 5 and (status == 'inactive' and self.indicator.get_icon() != os.environ['HOME']+'/.config/kinto/kinto.svg'):
            self.indicator.set_icon(os.environ['HOME']+'/.config/kinto/kinto.svg')
        self.last_status = status

Reference for set_icon_full, it requires an additional "description" argument after the name of the icon:

set_icon_full (String icon_name, String icon_desc) : none

Parameters:
String icon_name Required (not null)
String icon_desc Required (not null)

Returns:
    none 

Reference found here:
https://www.roojs.org/seed/gir-1.2-gtk-3.0/seed/AppIndicator3.Indicator.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants