Subversion Repositories basico

Rev

Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 t00mlabs 1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
# File: notify.py
4
# Author: Tomás Vírseda
5
# License: GPL v3
6
# Description: notifications service
7
 
8
import sys
9
import gi
10
gi.require_version('Notify', '0.7')
11
from gi.repository import Notify
12
 
13
from .service import Service
14
 
15
 
16
class Notification(Service):
17
    def initialize(self):
18
        Notify.init('Basico')
19
 
20
    def show(self, module, message, icon_name):
21
        if sys.platform == 'win32':
22
            # Windows does not support Notify
23
            return
74 t00mlabs 24
        else:
25
            icon = "dialog-%s" % icon_name # information | question | warning | error
26
            notification = Notify.Notification.new (module, message, icon)
27
            notification.show()