File: urgentwindow.py

package info (click to toggle)
cinnamon 6.4.13-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 13,304 kB
  • sloc: javascript: 54,298; ansic: 51,499; python: 21,971; xml: 2,803; sh: 96; makefile: 27; perl: 13
file content (25 lines) | stat: -rwxr-xr-x 675 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib

class MessageDialogWindow(Gtk.Window):
    counter = 0

    def __init__(self):
        super(MessageDialogWindow, self).__init__(title="Urgent MessageDialog")

    def show_urgent(self):
        self.set_urgency_hint(self.counter%2 == 0)
        self.counter = self.counter + 1
        if self.counter < 10:
            GLib.timeout_add(1000 * (self.counter % 7), self.show_urgent)
        else:
            self.set_urgency_hint(True)


win = MessageDialogWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
GLib.timeout_add(3000, win.show_urgent)
Gtk.main()