Author: juhliarik Date: Wed Jul 2 11:04:17 2008 New Revision: 48763 URL: http://svn.opensuse.org/viewcvs/yast?rev=48763&view=rev Log: added YCP module written in python Added: branches/tmp/lslezak/workshop/scr_dbus/DBus.py (with props) Added: branches/tmp/lslezak/workshop/scr_dbus/DBus.py URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/scr_dbus/DBus.py?rev=48763&view=auto ============================================================================== --- branches/tmp/lslezak/workshop/scr_dbus/DBus.py (added) +++ branches/tmp/lslezak/workshop/scr_dbus/DBus.py Wed Jul 2 11:04:17 2008 @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +## +## ycp module written in python for using DBus to access to SCR +## this file should be in yast2 module dir (/usr/share/YaST2/modules) +## + + +import dbus +## import function for converting dbus types to classical python types +## it is necessary for python-bindings in yast +import DBusValueToPythonValue + +bus = dbus.SystemBus() + +yast_SCR = bus.get_object('org.opensuse.YaST', '/') + + +def Read(path): + return DBusValueToPythonValue.convertDbusTypeToPythonType(yast_SCR.Read(path, dbus_interface='org.opensuse.YaST')) + +def Write(path, value): + if value != None: + return DBusValueToPythonValue.convertDbusTypeToPythonType(yast_SCR.Write(path, value, dbus_interface='org.opensuse.YaST')) + else: + return DBusValueToPythonValue.convertDbusTypeToPythonType(yast_SCR.Write(path, 'PyNone', dbus_interface='org.opensuse.YaST')) + +def Dir(path): + return DBusValueToPythonValue.convertDbusTypeToPythonType(yast_SCR.Dir(path, dbus_interface='org.opensuse.YaST')) + +def Execute(path): + return DBusValueToPythonValue.convertDbusTypeToPythonType(yast_SCR.Execute(path, dbus_interface='org.opensuse.YaST')) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org