After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 779153 - Python cannot create NMGtkWifiDialog
Python cannot create NMGtkWifiDialog
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: nm-applet
unspecified
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-02-23 23:26 UTC by Jeremy Soller
Modified: 2017-03-09 16:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Here is a test script. Edit IFACE and AP_NAME to match your computer. (1.72 KB, text/x-python)
2017-02-23 23:27 UTC, Jeremy Soller
  Details
Here is a patch, copying the SSID information from the provided AP. (1.64 KB, patch)
2017-02-23 23:28 UTC, Jeremy Soller
none Details | Review
Here is a test script, demonstrating a hang with libnma. Edit IFACE and AP_NAME to something you can connect to. (1.68 KB, text/x-python)
2017-03-07 00:08 UTC, Jeremy Soller
  Details
After applying your patch to the GIR, this script works with libnma. Can you release a new network-manager-applet with that change? (1.65 KB, text/x-python)
2017-03-07 15:00 UTC, Jeremy Soller
  Details

Description Jeremy Soller 2017-02-23 23:26:13 UTC
Python, using pygobject, is unable to spawn an NMGtkWifiDialog using the new function, due to the SSID setting not being settable (GArray<guchar> is not supported by pygobject). If the SSID is not set, the dialog will not display correctly, and will not function.

A potential fix is to copy the SSID from the AP information if present.
Comment 1 Jeremy Soller 2017-02-23 23:27:37 UTC
Created attachment 346610 [details]
Here is a test script. Edit IFACE and AP_NAME to match your computer.
Comment 2 Jeremy Soller 2017-02-23 23:28:21 UTC
Created attachment 346611 [details] [review]
Here is a patch, copying the SSID information from the provided AP.
Comment 3 Thomas Haller 2017-02-24 20:00:44 UTC
libnm-gtk is deprecated.

What is the reason not to use libnma (and NMAWifiDialog)?
Comment 4 Jeremy Soller 2017-02-24 20:03:24 UTC
I will try again. It was hanging Python when attempting to run the example above.
Comment 5 Jeremy Soller 2017-02-24 20:05:04 UTC
(In reply to Thomas Haller from comment #3)
> libnm-gtk is deprecated.
> 
> What is the reason not to use libnma (and NMAWifiDialog)?

If I were to move this code into libnma, would that make sense? To copy the AP's SSID if it is provided?
Comment 6 Thomas Haller 2017-03-01 15:46:43 UTC
I agree that there is a problem using libnm-glib/libnm-gtk. I was unable to make use of the opaque gobject.GBoxed type. The libnm based library (libnma) doesn't have this problem.

To me, it seems wrong that nma_wifi_dialog_new() modifies the provided connection. I would instead fix libnm-glib/libnm-util so that the SSID can be set from pygobject.

Nowadays, libnm-util+libnm-glib+libnm-gtk is deprecated and replaced by libnm+libnma. That means, there is less incentive to fix libnm-glib, but it is not out of the question.
Comment 7 Jeremy Soller 2017-03-07 00:08:10 UTC
Created attachment 347348 [details]
Here is a test script, demonstrating a hang with libnma. Edit IFACE and AP_NAME to something you can connect to.
Comment 8 Thomas Haller 2017-03-07 08:53:30 UTC
(In reply to Jeremy Soller from comment #7)
> Created attachment 347348 [details]
> Here is a test script, demonstrating a hang with libnma. Edit IFACE and
> AP_NAME to something you can connect to.

The script fails with:
(nma.py:7254): libnm-ERROR **: libnm-util symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported

A process cannot load libnm-util/libnm-glib/libnm-gtk at the same time as libnm/libnma.

You must replace

gi.require_version('NetworkManager', '1.0')
from gi.repository import NetworkManager
gi.require_version('NMClient', '1.0')
from gi.repository import NMClient

with

gi.require_version('NM', '1.0')
from gi.repository import NM

(and then your script needs some fixing. For example:

-  client = NMClient.Client()
+  client = NM.Client.new(None)





But even then, there is a bug that I just fixed:
https://git.gnome.org/browse/network-manager-applet/commit/?id=7a59d41e5f6666d0da51f1f7aae7518befdb1182
Too bad, the pygobject binds for libnma were broken. Obviously, nobody was using them so far.
Comment 9 Jeremy Soller 2017-03-07 14:39:33 UTC
I applied that patch and will attempt to use libnma again.
Comment 10 Jeremy Soller 2017-03-07 15:00:56 UTC
Created attachment 347399 [details]
After applying your patch to the GIR, this script works with libnma. Can you release a new network-manager-applet with that change?
Comment 11 Thomas Haller 2017-03-07 18:42:26 UTC
(In reply to Jeremy Soller from comment #10)
> Can you
> release a new network-manager-applet with that change?

a new release of network-manager-applet was done just yesterday. It may take one, two months until the next release is due.

Downstream is encouraged to cherry-pick the patch.
Comment 12 Thomas Haller 2017-03-07 22:57:53 UTC
re: comment 10.

User code cannot create a
  connection = NM.RemoteConnection()
should be
  connection = NM.SimpleConnection()
Comment 13 Jeremy Soller 2017-03-07 22:58:42 UTC
Ok, I will change that
Comment 14 Jeremy Soller 2017-03-09 16:47:46 UTC
This can now be fixed by using `libnma`, so I will mark this as resolved