~ubuntu-branches/ubuntu/raring/hplip/raring

« back to all changes in this revision

Viewing changes to ui/systemtray.py

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-12-14 20:08:44 UTC
  • mfrom: (2.1.118 lucid)
  • Revision ID: james.westby@ubuntu.com-20091214200844-z8qhqwgppbu3t7ze
Tags: 3.9.10-4
KBSD patch from KiBi (Closes: #560796)

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
    sys.exit(1)
58
58
 
59
59
 
 
60
# pynotify (optional)
 
61
have_pynotify = True
 
62
try:
 
63
    import pynotify
 
64
except ImportError:
 
65
    have_pynotify = False
60
66
 
61
67
 
62
68
TrayIcon_Warning = 0
345
351
 
346
352
 
347
353
    def showMessage(self, title, msg, icon, msecs):
348
 
        g = self.mapToGlobal(QPoint(0, 0))
349
 
        showBalloon(icon, msg, title, self,
350
 
            QPoint(g.x() + self.width()/2, g.y() + self.height()/2), msecs)
 
354
        if have_pynotify and pynotify.init("hplip"):
 
355
            n = pynotify.Notification(title, msg, icon)
 
356
            n.set_timeout(msecs)
 
357
            s.show()
 
358
        else:
 
359
            g = self.mapToGlobal(QPoint(0, 0))
 
360
            showBalloon(icon, msg, title, self,
 
361
                QPoint(g.x() + self.width()/2, g.y() + self.height()/2), msecs)
351
362
 
352
363
 
353
364