I work with PyQt5 and PyDM in a few ubuntu and debian distributions and i need a way of setting tooltips for the application icon on the ubuntu bar as show in the image:
I need to do this via python code. The way im calling the application seems to be the reason why the tooltip text in the image is set to "testing" but i its still not in python code.
I have a .ui file named example.ui. I call it in a pydm/python script named example.py:
#!/usr/local/bin/pydm
from pydm import Display
from os import path
class Main(Display):
def __init__(self, parent=None, args=None, macros=None):
super(Main, self).__init__(parent=parent, args=args, macros=None)
self.pushButton.clicked.connect(self.blah)
def blah(self):
print("BLAH")
def ui_filename(self):
return "example.ui"
def ui_filepath(self):
# Return the full path to the UI file
return path.join("./", "example.ui")
finallly, i have a .sh script called init.sh:
#!/bin/bash
pydm -m "MY_MACRO=Example" example.py testing
If i change "testing" in the init.sh file, the tooltip also changes accordingly but, as i said, i want to do this via the .py file.
If it helps, i know Qt MainWindow is accessible via
QApplication.instance().main_window
For example, you can do:
QApplication.instance().main_window.setMaximumSize(some_number,some_number)
But i found nothing in QApplication documentation about application tooltips.
