Closed shawnl closed 9 years ago
Happens also on KDE4 yes (not in xfce, not in awesome, etc...), depend how the systray is implemented I guess. But, it's a GTK fw issue, how the menu recalculate its size when it gets new items dynamically: I tried the same exact code logic in Qt and it just worked fine everywhere.
Fixing this would mean to implement the size calculation logic in the app itself...
Btw, since you are in gnome3, have you tried the connman extension? (though it does not provide any UI for tweaking the network settings)
The fix would
The connman gnome extension wouldn't install on my gnome 3.8 (debian sid)-- I don't think its been updated very recently
So i've been using the up-to-date connman that I packaged and have uploaded to mentors.debian.net.
https://mentors.debian.net/package/connman
for the connmanctl command
Indeed the gnome extension from gnome.org is outdated. Pick up latest from: https://github.com/connectivity/gnome-extension-connman (... which should be uploaded to gnome.org, that would be nice)
That worked! thanks.
same problem here. would be nice to get this fixed.
And same here. I did some more testing with stalonetray, trayer and xfce: https://bbs.archlinux.org/viewtopic.php?pid=1387314#p1387314
Is this problem put on a shelf for the moment, or is there work being done on this? It is a pity that such a superb connection manager has no fully functional gui. Why not move to Qt if there are problems with GTK? Especially since it looks like Qt is the future anyway.
I am tempted to move on with Qt indeed. Just need to get time to do so. GTK is getting messy, it's unfortunate but true: there are many complaints about it, and many apps moving to Qt due to it.
I will anyway try to open again (3rd time...) a bug in gtk side.
Great. Could you post it on pastebin? I think this forum damages the code.
Btw lockheed, you could verify it works with Qt with that script: (I have the same for Gtk, that shows the same bug as in connman-ui also)
#! /usr/bin/env python
from PyQt4 import QtGui, QtCore
item_names = [ "test",
"the",
"dynamic",
"status icon",
"menu",
"popup",
"!"]
class ClickMenu(QtGui.QMenu):
def __init__(self, parent=None):
QtGui.QMenu.__init__(self, "go-top", parent)
self._counter = 0
icon = QtGui.QIcon.fromTheme("application-exit")
action = QtGui.QAction(icon, "&Exit", self)
action.triggered.connect(QtGui.qApp.quit)
self.addAction(action)
QtCore.QTimer.singleShot(500, self._populate)
def _populate(self):
print "populate"
if (self._counter == len(item_names)):
return
icon = QtGui.QIcon.fromTheme("document-new")
self.addAction(QtGui.QAction(icon, item_names[self._counter], self))
QtCore.QTimer.singleShot(500, self._populate)
self._counter += 1
class SystemTrayIcon(QtGui.QSystemTrayIcon):
def __init__(self, parent=None):
QtGui.QSystemTrayIcon.__init__(self, parent)
self.setIcon(QtGui.QIcon.fromTheme("go-home"))
self.activated.connect(self.click_event)
def click_event(self, value):
if value == self.Trigger:
menu = ClickMenu()
menu.exec_(QtGui.QCursor.pos())
if __name__ == "__main__":
app = QtGui.QApplication([])
tray = SystemTrayIcon()
tray.show()
#set the exec loop going
app.exec_()
I get this error:
$ connman-qt File "/home/lockheed/bin/connman-qt", line 26 print "populate" ^ SyntaxError: invalid syntax
sorry, forgot to mention it's python 2 only (and did not handle it in the script itself either). run it like: python2.7 pyqttray.py (or any python2.x you have)
Ok. I get a blank icon: $ python2.7 ~/bin/connman-qt QSystemTrayIcon::setVisible: No Icon set
And if I click on it, it shows "Exit" and then the list slowly populates with what I guess are network names (first one is "test"), but I can't be sure because the tray is on the bottom of the screen and the list populates downwards so it is offscreen
It's a q&d script, I just did it to show that the menu gets re-sized by itself properly. If you see it getting re-sized properly: it means it works. And I bet it will on any tray.
Yes, it resizes properly, growing with the number of networks detected. Do you think you could implement it into connman-ui? I'm happy to test things for you if you need it.
It would mean recoding connman-ui in Qt.
If you want to try the Gtk based one: (right click to show the menu, left one to exit) It will show the bug on some tray, as for connman-ui.
#!/usr/bin/python
from gi.repository.Gtk import StatusIcon, STOCK_HOME, Menu, \
MenuItem, main, main_quit
from gi.repository.GObject import timeout_add, source_remove
item_names = [ "test",
"the",
"dynamic",
"status icon",
"menu",
"popup",
"!"]
class TestTray( object ):
def __init__(self):
self._statusicon = StatusIcon()
self._statusicon.set_from_stock(STOCK_HOME)
self._statusicon.connect("popup-menu", self.right_click_event)
self._statusicon.connect("activate", main_quit)
self._counter = 0;
self._menu = Menu()
def _populate_menu(self, _):
if (self._counter == len(item_names)):
return True
item = MenuItem(item_names[self._counter])
item.show()
self._menu.append(item)
self._counter += 1
return True
def right_click_event(self, s_icon, button, time):
def position(menu, s_icon):
return StatusIcon.position_menu(menu, s_icon)
timeout_add(500, self._populate_menu, None)
self._menu.popup(None, None, position, s_icon, button, time)
if __name__ == "__main__":
statusicon = TestTray()
main()
It starts, but the menu appears behind the tray, so it is cover, and I think it also grows downwards, because I can only see the top edge of it.
Yes it's bogus, and it's in Gtk framework. It's up to it to know where/how to show the menu properly. Qt does it just fine, not Gtk.
Did you consider pre-populating it with, say, a dozen blank/bogus items, then dynamically removing and repopulating it?
Actually, I have seen such patch already done somewhere (but not on github). Pre-alocating 10 empty items and polulating the informations once the results come. But then, if scan results reports - let's say - 2 services: you will have a menu of 8 items, with 2 labelled-services and 8 empty entries. It's a bit ugly. The only real fix is in Gtk+.
Would recommend Qt for a port then. A Supports very rapid development, less clunky than gtk On Dec 1, 2014 2:44 AM, "Tomasz Bursztyka" notifications@github.com wrote:
Actually, I have seen such patch already done somewhere (but not on github). Pre-alocating 10 empty items and polulating the informations once the results come. But then, if scan results reports - let's say - 2 services: you will have a menu of 8 items, with 2 labelled-services and 8 empty entries. It's a bit ugly. The only real fix is in Gtk+.
— Reply to this email directly or view it on GitHub https://github.com/tbursztyka/connman-ui/issues/6#issuecomment-65029888.
I have no new information to add, but wanted to echo "me too". I use Arch Linux, latest updates (no TESTING repo), Openbox, compton and nVidia driver (if any of that matters.) The QT-based cmst GUI works, though.
After the merge of #18, the left popup menu now calculates its own height. Issue should be fixed.
this happens when using connman-ui in gnome-shell/gnome 3.