Skip to content
Snippets Groups Projects
Commit 9cb3d362 authored by ptangu01's avatar ptangu01
Browse files

compliant with new stack

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/trunk@1381 b32b6428-25c9-4566-ad07-03861ab6144f
parent feb7a523
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import sys
import gi
gi.require_version('Notify', '0.7')
from gi.repository import Notify
import xAAL
......@@ -29,13 +30,12 @@ class DesktopNotification(xAAL.devices.VirtualDevice):
def __init__(self,address):
xAAL.devices.VirtualDevice.__init__(self,"notification.desktop",address)
self.setVendorID("IHSEV")
self.setProductID("Desktop notification")
self.set_vendor_id("IHSEV")
self.set_product_id("Desktop notification")
def notify(self,title,msg):
if Notify.init("xAALDesktopNotification"):
notify = Notify.Notification.new('xAAL message: %s' % title,msg,"dialog-information")
print(notify)
try:
notify.show()
except Exception as e:
......@@ -48,11 +48,11 @@ def main():
global logger
configName = "DesktopNotification"
configFile = xAAL.tools.getConfigFile("DesktopNotification")
cfg = xAAL.tools.loadConfigFile(configFile)
configFile = xAAL.tools.get_cfg_file("DesktopNotification")
cfg = xAAL.tools.load_cfg_file(configFile)
if cfg == None:
cfg = xAAL.tools.newDefaultConfigFile(configFile,configName)
cfg = xAAL.tools.new_cfg(configFile,configName)
cfg.set(configName,'logfile',"/var/log/xaal/%s.log"%configName)
cfg.set(configName,'loglevel',"INFO")
f = open(configFile,'w')
......@@ -62,20 +62,21 @@ def main():
addr = cfg.get(configName,'xaaladdr')
logfile = cfg.get(configName,'logfile')
loglevel = cfg.get(configName,'loglevel')
logger = xAAL.tools.getLogger(__name__,loglevel.upper(),'%s.log'%logfile)
except:
#ToDO remove print
print("Please verify your configuration file")
sys.exit()
logger = xAAL.tools.get_logger(__name__,loglevel.upper(),'%s.log'%logfile)
logger.debug("Config. file loaded : %s" % configFile)
logger.debug("Log filename : %s" % logfile)
dev = DesktopNotification(addr)
logger.debug('loading device %s with xaaladdr %s'%(dev.__class__.__name__,dev.getAddress()))
logger.debug('loading device %s with xaaladdr %s'%(dev.__class__.__name__,dev.get_address()))
eng=xAAL.core.Engine()
eng.registerDevices([dev,])
eng.register_devices([dev,])
logger.info('Start device')
eng.run()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment