[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Plugin hook for network changed



Hello Pat,

this can be tricky, we don't support getting spoke object anywhere on
the code, spokes are isolated. Therefore you can't just look on the
variable here.

As I see it, you have two options here:
1) You can register callback on the PayloadManager
pyanaconda.packaging.payloadMgr
- Problem is that you don't know if it was restarted by the Source
spoke or by Network spoke.

2) Register callback on the NetworkManager
- You can do this in the similar way as we do. 

You can write it similar to this example (not tested):

```
from gi.repository import NM

nmclient = NM.Client.new()

for dev in nmclient.get_all_devices():
    device.connect("state-changed", self.on_device_state_changed)

nmclient.connect("device-added", self.on_device_added)

def on_device_added(self, client, device):
    device.connect("state-changed", self.on_device_state_changed)

def on_device_state_changed(self):
   # test state and do what you need to do
```

I hope this will help you,
Jirka

On Wed, 2016-08-17 at 09:45 -0500, Pat Riehecky wrote:
> Looking at 
> https://github.com/rhinstaller/anaconda/blob/master/pyanaconda/ui/gui
> /spokes/network.py#L1529
> 
> Is there a way I can have my anaconda plugin also act based on
> changes 
> to the networking_changed parameter?
> 
> Pat
> 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]