Hello community, here is the log from the commit of package python-killswitch for openSUSE:Factory checked in at 2014-01-03 19:48:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-killswitch (Old) and /work/SRC/openSUSE:Factory/.python-killswitch.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-killswitch" Changes: -------- --- /work/SRC/openSUSE:Factory/python-killswitch/python-killswitch.changes 2012-08-23 16:05:57.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-killswitch.new/python-killswitch.changes 2014-01-03 19:48:25.000000000 +0100 @@ -1,0 +2,5 @@ +Mon Oct 15 20:55:31 CEST 2012 - [email protected] + +- update to version 0.4: Update to new URfkill API (bnc#734894) + +------------------------------------------------------------------- Old: ---- python-killswitch-0.3.tar.gz New: ---- python-killswitch-0.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-killswitch.spec ++++++ --- /var/tmp/diff_new_pack.HZY0NG/_old 2014-01-03 19:48:26.000000000 +0100 +++ /var/tmp/diff_new_pack.HZY0NG/_new 2014-01-03 19:48:26.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-killswitch # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,12 +16,11 @@ # - Name: python-killswitch -Version: 0.3 -Release: 1 -License: SUSE-WTFPL-2.0 +Version: 0.4 +Release: 0 Summary: Python module providing functions for killswitches +License: SUSE-WTFPL-2.0 Group: Development/Libraries/Python Source: python-killswitch-%{version}.tar.gz Url: http://blog.homac.de ++++++ python-killswitch-0.3.tar.gz -> python-killswitch-0.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-killswitch-0.3/PKG-INFO new/python-killswitch-0.4/PKG-INFO --- old/python-killswitch-0.3/PKG-INFO 2011-03-11 13:42:38.000000000 +0100 +++ new/python-killswitch-0.4/PKG-INFO 2012-10-15 20:54:57.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: python-killswitch -Version: 0.3 +Version: 0.4 Summary: Python module providing functions for killswitches Home-page: http://blog.homac.de Author: Holger Macht diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-killswitch-0.3/killswitch.py new/python-killswitch-0.4/killswitch.py --- old/python-killswitch-0.3/killswitch.py 2011-03-11 13:14:35.000000000 +0100 +++ new/python-killswitch-0.4/killswitch.py 2012-10-15 20:23:27.000000000 +0200 @@ -2,7 +2,7 @@ # # python-killswitch -- Convenient Functions for Managing Killswitches # -# Copyright (C) 2009,2010,2011 Holger Macht <[email protected]> +# Copyright (C) 2009,2010,2011,2012 Holger Macht <[email protected]> # # This file is released under the WTFPL (http://sam.zoy.org/wtfpl/) # @@ -32,6 +32,7 @@ import dbus _URFKILL_SERVICE="org.freedesktop.URfkill" +_URFKILL_DEVICE_SERVICE="org.freedesktop.URfkill.Device" _URFKILL_PATH="/org/freedesktop/URfkill" _HAL_SERVICE="org.freedesktop.Hal" @@ -82,17 +83,18 @@ class Killswitch(): "class representing one single killswitch object" - def __init__(self, bus, udi=None, name=None, type=None, is_urfkill=0): + def __init__(self, bus, udi=None, name=None, type=None, index=None, is_urfkill=0): """Initialize a new Killswitch object. Usually you should not need to create objects of this class because the KillswitchManager does it. bus: a properly initiated object to a D-Bus system bus udi: unique device itendifier name: a proper name for the killswitch - type: a killswitch type, such as wlan, bluetooth, gps, wwan, etc.""" + type: a killswitch type, such as wlan, bluetooth, gps, wwan, etc. + index: the index number""" if is_urfkill: - self.k = _KillswitchUrfkill(bus, udi, name, type) + self.k = _KillswitchUrfkill(bus, udi, name, type, index) else: self.k = _KillswitchHal(bus, udi, name, type) @@ -108,6 +110,10 @@ "return the type of the killswitch object (bluetooth, wlan, etc...)" return self.k.type() + def index(self): + "return the index" + return self.k.index() + def get_state(self): """returns the current state of the killswitch object. 0: Killswitch is on, device is disabled via software @@ -123,11 +129,12 @@ return self.k.set_state(state) class _KillswitchAbstract(): - def __init__(self, bus, udi=None, name=None, type=None): + def __init__(self, bus, udi=None, name=None, type=None, index=None): self._bus = bus self.__name = name self.__type = type self.__udi = udi + self.__index = index def name(self): return self.__name @@ -138,6 +145,9 @@ def type(self): return self.__type + def index(self): + return self.__index + class _KillswitchHal(_KillswitchAbstract): def __init__(self, bus, udi=None, name=None, type=None): _KillswitchAbstract.__init__(self, bus, udi, name, type) @@ -153,20 +163,23 @@ return self.manager_interface.SetPower(state) class _KillswitchUrfkill(_KillswitchAbstract): - def __init__(self, bus, udi=None, name=None, type=None): - _KillswitchAbstract.__init__(self, bus, udi, name, type) + def __init__(self, bus, udi=None, name=None, type=None, index=None): + _KillswitchAbstract.__init__(self, bus, udi, name, type, index) - manager = self._bus.get_object(_URFKILL_SERVICE, _URFKILL_PATH) - self.manager_interface = dbus.Interface(manager, dbus_interface=_URFKILL_SERVICE) + manager = self._bus.get_object(_URFKILL_SERVICE, udi) + self.manager_interface = dbus.Interface(manager, dbus_interface="org.freedesktop.DBus.Properties") def get_state(self): - return not self.manager_interface.GetKillswitch(self.udi())[2] + return not self.manager_interface.Get(_URFKILL_DEVICE_SERVICE, "soft") def set_state(self, state): + manager = self._bus.get_object(_URFKILL_SERVICE, _URFKILL_PATH) + iface = dbus.Interface(manager, dbus_interface=_URFKILL_SERVICE) + if state == 1: - return self.manager_interface.UnblockIdx(self.udi()) + return iface.BlockIdx(self.index(), False) elif state == 0: - return self.manager_interface.BlockIdx(self.udi()) + return iface.BlockIdx(self.index(), True) else: _message("Unknown state") @@ -245,45 +258,55 @@ _KillswitchManagerAbstract.__init__(self) for ks in self.__get_killswitches(): - ks = Killswitch(self._bus, ks[0], ks[5], self.__get_name_for_type(ks[1]), 1); - name = ks.name() - _message("found ks with name %s and type %s" % (name, ks.type())) - self._switches.append(ks) + manager = self._bus.get_object(_URFKILL_SERVICE, ks) + iface = dbus.Interface(manager, dbus_interface="org.freedesktop.DBus.Properties") + + name = iface.Get(_URFKILL_DEVICE_SERVICE, "name") + devtype = iface.Get(_URFKILL_DEVICE_SERVICE, "type") + index = iface.Get(_URFKILL_DEVICE_SERVICE, "index") + k = Killswitch(self._bus, ks, name, self.__get_name_for_type(devtype), index, 1); + _message("found ks with name %s and type %s" % (name, devtype)) + self._switches.append(k) self._bus.add_signal_receiver(self.__killswitch_modified_cb, - "RfkillChanged", + "DeviceChanged", _URFKILL_SERVICE, _URFKILL_SERVICE, _URFKILL_PATH) self._bus.add_signal_receiver(self.__killswitch_added_cb, - "RfkillAdded", + "DeviceAdded", _URFKILL_SERVICE, _URFKILL_SERVICE, _URFKILL_PATH) self._bus.add_signal_receiver(self.__killswitch_removed_cb, - "RfkillRemoved", + "DeviceRemoved", _URFKILL_SERVICE, _URFKILL_SERVICE, _URFKILL_PATH) def __get_killswitches(self): manager = self._bus.get_object(_URFKILL_SERVICE, _URFKILL_PATH) iface = dbus.Interface(manager, dbus_interface=_URFKILL_SERVICE) - return iface.GetAll() + return iface.EnumerateDevices() - def __killswitch_modified_cb(self, index, type, state, soft, hard, name): + def __killswitch_modified_cb(self, device): for item in self._switches: - if index == item.udi(): + if device == item.udi(): state = item.get_state() _message("new state of %s is %s" % (item.udi(), state)) self._state_changed_cb(item, state) - def __killswitch_added_cb(self, index, type, state, soft, hard, name): + def __killswitch_added_cb(self, device): for item in self._switches: - if index == item.udi(): + if device == item.udi(): _message("killswitch already in list") return - ks = Killswitch(self._bus, index, name, self.__get_name_for_type(type), 1); - name = ks.name() - type = ks.type() + manager = self._bus.get_object(_URFKILL_SERVICE, device) + iface = dbus.Interface(manager, dbus_interface="org.freedesktop.DBus.Properties") + + name = iface.Get(_URFKILL_DEVICE_SERVICE, "name") + devtype = iface.Get(_URFKILL_DEVICE_SERVICE, "type") + index = iface.Get(_URFKILL_DEVICE_SERVICE, "index") + + ks = Killswitch(self._bus, device, name, self.__get_name_for_type(devtype), index, 1); - _message("adding %s with name %s and type %s" % (index, name, self.__get_name_for_type(type))) + _message("adding %s with name %s and type %s" % (index, name, self.__get_name_for_type(devtype))) self._switches.append(ks) self._killswitch_added_cb(ks) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-killswitch-0.3/setup.py new/python-killswitch-0.4/setup.py --- old/python-killswitch-0.3/setup.py 2011-03-10 13:36:47.000000000 +0100 +++ new/python-killswitch-0.4/setup.py 2012-10-15 20:27:55.000000000 +0200 @@ -2,7 +2,7 @@ from distutils.core import setup -PYTHON_KILLSWITCH_VERSION='0.3' +PYTHON_KILLSWITCH_VERSION='0.4' dist = setup(name='python-killswitch', version=PYTHON_KILLSWITCH_VERSION, -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
