Bug 205911

Summary: deskutils/syncthing-gtk: Does not work under KDE4
Product: Ports & Packages Reporter: Henry Hu <henry.hu.sh>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: bsd, miwi, vlad-fbsd
Priority: --- Keywords: needs-qa
Version: LatestFlags: bsd: maintainer-feedback+
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206019
Attachments:
Description Flags
proposed patch...
none
second patch none

Description Henry Hu 2016-01-05 02:34:07 UTC
Under KDE4, syncthing-gtk's Gtk status icon backend does not work:
if IS_KDE:
	# While the GTK backend works fine on KDE 4, the StatusIconKDE4 backend will achieve better
	# results and should be available on any standard KDE 4 installation
	# (since several KDE applications depend on it)
	raise NotImplementedError
	
However, its KDE4 status icon backend depends on py-pykde4:
	import PyQt4.Qt     as qt
	import PyQt4.QtGui  as qtgui
	import PyKDE4.kdeui as kdeui
which is not installed by the port.

As a result, when started under KDE4, it falls back to StatusIconDummy which does not work.
Comment 1 Ivan 2016-01-06 21:11:18 UTC
Hello.
I don't have access to KDE4 (actually, I don't have access to FreeBSD box as well). Can you make some checks for me?

Comment out 

	if IS_KDE:
# While the GTK backend works fine on KDE 4, the StatusIconKDE4 backend will achieve better
# results and should be available on any standard KDE 4 installation
# (since several KDE applications depend on it)
raise NotImplementedError

and check that GTK3 icon works. I looked to py-pykde4 and it's full of deps, I'd like to avoid this dependency if possible as you need GTK framework anyway to run this port.
Comment 2 VK freebsd_triage 2016-01-08 01:49:37 UTC
Ivan,

thanks, I've gone ahead and marked the bug with maintainer-feedback+. Don't forget to mark it like that when you provide feedback to issue reports like that. :)
Comment 3 Henry Hu 2016-01-08 03:16:02 UTC
(In reply to Ivan from comment #1)
Yes, that works.
However, there seems to be a problem related to icons. The icon cache is not updated when the port is installed, so I need to run "gtk-update-icon-cache /usr/local/share/hicolor" manually to have an icon instead of an X.
That's a separate issue. I'll submit it independently.

I think that you may provide an option for that py-pykde4 dependency, which may work better for KDE users (like kde-style menu...).
Comment 4 Henry Hu 2016-01-08 03:35:18 UTC
FYI, I submitted PR 206019 for that issue. If that's not resolved, the current situation leads to an "X" icon in the system tray after installation.
Comment 5 Ivan 2016-01-08 18:33:09 UTC
Created attachment 165273 [details]
proposed patch...

Please check if qt4-gui is enough for tray icon
Comment 6 Henry Hu 2016-01-09 18:42:49 UTC
(In reply to Ivan from comment #5)
That's not enough... The code imports PyKDE4.kdeui and uses it several times.

A clean solution might be having an option for this which defaults to off, and creating a slave port like syncthing-kde which enables this option.
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-09 18:45:11 UTC
Comment on attachment 165273 [details]
proposed patch...

Maintainer, please approve or decline this attachment, with a comment as to how you'd like to move forward
Comment 8 Ivan 2016-01-09 19:16:56 UTC
(In reply to Henry Hu from comment #6)
http://www.freshports.org/devel/kdebindings4-python-pykde4/
pykde4 is a untime dep for qt4-gui.

(In reply to Kubilay Kocak from comment #7)
But that's my attachment :-)
Comment 9 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-09 19:21:59 UTC
Apologies Ivan,  I meant obsolete the existing patch (given comment #6) or provide further instructions :)
Comment 10 Ivan 2016-01-09 19:22:53 UTC
Ah, I misunderstood the dependency system. OK, we can include py27-kdebindings-pykde4 as well.

Do you think that slave port for such minor situation looks OK ?
Comment 11 Ivan 2016-01-09 19:25:11 UTC
(In reply to Kubilay Kocak from comment #9)
Actually, I don't know what should be better. We can
- Patch the code and run GTK3 icon under KDE (it works)
- Provide option to enable QT4 support

or make a slave port with QT4 enabled.
Comment 12 Ivan 2016-01-09 19:53:35 UTC
Created attachment 165326 [details]
second patch

Included py-pykde4. I hope this one is enough, however it's +200 ports to add :(
Comment 13 Henry Hu 2016-01-09 20:08:44 UTC
(In reply to Ivan from comment #12)
This works, although it should be
${PYTHON_PKGNAMEPREFIX}pykde4>=0:${PORTSDIR}/devel/py-pykde4
instead of
${PYTHON_PKGNAMEPREFIX}py-pykde4>=0:${PORTSDIR}/devel/py-pykde4

To avoid the extra dependencies by default, how do you like this idea:
* Provide an option for pykde4 but defaults to false
* When the option is not selected, patch the port to use GTK's status icon
* When the option is selected, just use pykde4 for the status icon

For KDE users, by default you have a working version, but if you do some extra work you get a slightly better experience.
Comment 14 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-10 07:46:10 UTC
(In reply to Ivan from comment #12)

Personally I think a -kde4 slave port is the best way to go, given the circumstances.
Comment 15 Ivan 2016-01-15 17:48:34 UTC
I installed kde4 with package system and added the syncthing-gtk. I see no problem with tray icon - it works, the right click works as well.

===>>> py27-cairo-1.10.0_2
===>>> py27-cffi-1.2.1
===>>> py27-characteristic-14.1.0
===>>> py27-cryptography-1.0.2_3
===>>> py27-dateutil-2.3
===>>> py27-dbus-1.2.0_1
===>>> py27-enum34-1.0.4
===>>> py27-gobject3-3.16.2
===>>> py27-idna-2.0
===>>> py27-ipaddress-1.0.14
===>>> py27-numpy-1.10.2,1
===>>> py27-openssl-0.15.1
===>>> py27-pyasn1-0.1.9
===>>> py27-pyasn1-modules-0.0.8_1
===>>> py27-pycparser-2.10
===>>> py27-pykde4-4.14.3_1
===>>> py27-qt4-core-4.11.4,1
===>>> py27-qt4-dbussupport-4.11.4_1
===>>> py27-qt4-declarative-4.11.4
===>>> py27-qt4-designer-4.11.4,1
===>>> py27-qt4-gui-4.11.4,1
===>>> py27-qt4-network-4.11.4,1
===>>> py27-qt4-opengl-4.11.4,1
===>>> py27-qt4-phonon-4.11.4
===>>> py27-qt4-script-4.11.4,1
===>>> py27-qt4-sql-4.11.4,1
===>>> py27-qt4-svg-4.11.4,1
===>>> py27-qt4-webkit-4.11.4
===>>> py27-qt4-xml-4.11.4,1
===>>> py27-service_identity-14.0.0_2
===>>> py27-setuptools27-19.2
===>>> py27-sip-4.17,1
===>>> py27-six-1.9.0
===>>> py27-twistedCore-15.2.1
===>>> py27-zope.interface-4.1.3
Comment 16 Henry Hu 2016-02-14 19:38:52 UTC
(In reply to Ivan from comment #15)
Well, you have py27-pykde4 installed. It is not required for you to use a kde desktop, but it may be installed if you install the full kde desktop.