eazar001
eazar001

Reputation: 1601

QSytemTrayIcon does not show up in Ubuntu 12.04

I have created a program that runs in the background using PyQt4. A system tray icon is created in a separate thread that allows me to interact with the main program, after its creation and placement in the tray. I have never had a problem with this before in Ubuntu 10.04. However, I recently upgraded to Ubuntu 12.04, and for some reason there is not even a trace of the QSystemTrayIcon I desire. Can anyone clue me in as to what exactly is going on here? I have looked for posts about my question on AskUbuntu and SO, but can't seem to find anything in the database that matches my problem. I have included only portions of my code which I think are relevant, but will provide more information if necessary.

EDIT: I have already modified the tray panel white-list in Ubuntu, and set it to ['all'], so I was able to identify that as not being a problem.

Relevant piece of code:

class notify(threading.Thread, QtGui.QSystemTrayIcon):
    def __init__(self, process, iconMain, iconNew, parent=None):
        threading.Thread.__init__(self)
        QtGui.QSystemTrayIcon.__init__(self, iconMain, parent)

        self.menu = QtGui.QMenu(parent)
        self.menuNew = QtGui.QMenu(parent)

        viewAdsAction = self.menu.addAction("View Ads")
        textModeAction = self.menu.addAction("Text-Mode")
        exitAction = self.menu.addAction("Exit")
        textModeActionNew = self.menuNew.addAction("PC-Mode")
        exitActionNew = self.menuNew.addAction("Exit")

        self.iconMain = iconMain
        self.iconNew = iconNew
        self.setContextMenu(self.menu)
        self.process = process
        self.textMode = False  

Execution in main():

def main():
    os.chdir(os.getenv("HOME") + "/.Phones")
    beginMain = mainProgram()
    beginMain.start()
    app = QtGui.QApplication(sys.argv)

    w = QtGui.QWidget()

    notifications = notify(beginMain, QtGui.QIcon("icon-58x58.xpm"), QtGui.QIcon("notify.xpm"), w)
    notifications.show()
    notifications.start()

    sys.exit(app.exec_())

Upvotes: 1

Views: 476

Answers (1)

eazar001
eazar001

Reputation: 1601

I resolved my issue, the resolution was garbage. Apparently Qt and Unity do not get along with certain resolutions, I was running a 58x58 scaled icon. I scaled it down to 48x48, and now the system tray icon is visible, and working correctly with my program.

Upvotes: 1

Related Questions