Browse Source

Remove the system tray UI

Closes #17
Clara Hobbs 7 years ago
parent
commit
88758fa167
3 changed files with 1 additions and 102 deletions
  1. 0
    98
      kayleevc/gui.py
  2. 0
    2
      kayleevc/kaylee.py
  3. 1
    2
      kayleevc/util.py

+ 0
- 98
kayleevc/gui.py View File

@@ -11,104 +11,6 @@ gi.require_version('Gtk', '3.0')
11 11
 from gi.repository import Gtk, Gdk
12 12
 
13 13
 
14
-class GTKTrayInterface(GObject.GObject):
15
-    __gsignals__ = {
16
-        'command' : (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE,
17
-                     (GObject.TYPE_STRING,))
18
-    }
19
-    idle_text = "Kaylee - Idle"
20
-    listening_text = "Kaylee - Listening"
21
-
22
-    def __init__(self, args, continuous):
23
-        GObject.GObject.__init__(self)
24
-        self.continuous = continuous
25
-
26
-        self.statusicon = Gtk.StatusIcon()
27
-        self.statusicon.set_title("Kaylee")
28
-        self.statusicon.set_name("Kaylee")
29
-        self.statusicon.set_tooltip_text(self.idle_text)
30
-        self.statusicon.set_has_tooltip(True)
31
-        self.statusicon.connect("activate", self.continuous_toggle)
32
-        self.statusicon.connect("popup-menu", self.popup_menu)
33
-
34
-        self.menu = Gtk.Menu()
35
-        self.menu_listen = Gtk.MenuItem('Listen')
36
-        self.menu_continuous = Gtk.CheckMenuItem('Continuous')
37
-        self.menu_quit = Gtk.MenuItem('Quit')
38
-        self.menu.append(self.menu_listen)
39
-        self.menu.append(self.menu_continuous)
40
-        self.menu.append(self.menu_quit)
41
-        self.menu_listen.connect("activate", self.toggle_listen)
42
-        self.menu_continuous.connect("toggled", self.toggle_continuous)
43
-        self.menu_quit.connect("activate", self.quit)
44
-        self.menu.show_all()
45
-
46
-    def continuous_toggle(self, item):
47
-        checked = self.menu_continuous.get_active()
48
-        self.menu_continuous.set_active(not checked)
49
-
50
-    def toggle_continuous(self, item):
51
-        checked = self.menu_continuous.get_active()
52
-        self.menu_listen.set_sensitive(not checked)
53
-        if checked:
54
-            self.menu_listen.set_label("Listen")
55
-            self.emit('command', "continuous_listen")
56
-            self.statusicon.set_tooltip_text(self.listening_text)
57
-            self.set_icon_active()
58
-        else:
59
-            self.set_icon_inactive()
60
-            self.statusicon.set_tooltip_text(self.idle_text)
61
-            self.emit('command', "stop")
62
-
63
-    def toggle_listen(self, item):
64
-        val = self.menu_listen.get_label()
65
-        if val == "Listen":
66
-            self.set_icon_active()
67
-            self.emit("command", "listen")
68
-            self.menu_listen.set_label("Stop")
69
-            self.statusicon.set_tooltip_text(self.listening_text)
70
-        else:
71
-            self.set_icon_inactive()
72
-            self.menu_listen.set_label("Listen")
73
-            self.emit("command", "stop")
74
-            self.statusicon.set_tooltip_text(self.idle_text)
75
-
76
-    def popup_menu(self, item, button, time):
77
-        self.menu.popup(None, None, Gtk.StatusIcon.position_menu, item, button, time)
78
-
79
-    def run(self):
80
-        # Set the icon
81
-        self.set_icon_inactive()
82
-        if self.continuous:
83
-            self.menu_continuous.set_active(True)
84
-            self.set_icon_active()
85
-        else:
86
-            self.menu_continuous.set_active(False)
87
-        self.statusicon.set_visible(True)
88
-
89
-    def quit(self, item):
90
-        self.statusicon.set_visible(False)
91
-        self.emit("command", "quit")
92
-
93
-    def finished(self, text):
94
-        if not self.menu_continuous.get_active():
95
-            self.menu_listen.set_label("Listen")
96
-            self.set_icon_inactive()
97
-            self.statusicon.set_tooltip_text(self.idle_text)
98
-
99
-    def set_icon_active_asset(self, i):
100
-        self.icon_active = i
101
-
102
-    def set_icon_inactive_asset(self, i):
103
-        self.icon_inactive = i
104
-
105
-    def set_icon_active(self):
106
-        self.statusicon.set_from_file(self.icon_active)
107
-
108
-    def set_icon_inactive(self):
109
-        self.statusicon.set_from_file(self.icon_inactive)
110
-
111
-
112 14
 class GTKInterface(GObject.GObject):
113 15
     __gsignals__ = {
114 16
         'command': (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE,

+ 0
- 2
kayleevc/kaylee.py View File

@@ -50,8 +50,6 @@ class Kaylee:
50 50
         if self.options['interface']:
51 51
             if self.options['interface'] == "g":
52 52
                 from kayleevc.gui import GTKInterface as UI
53
-            elif self.options['interface'] == "gt":
54
-                from kayleevc.gui import GTKTrayInterface as UI
55 53
             else:
56 54
                 print("no GUI defined")
57 55
                 sys.exit()

+ 1
- 2
kayleevc/util.py View File

@@ -51,8 +51,7 @@ class Config:
51 51
         self._parser = ArgumentParser()
52 52
         self._parser.add_argument("-i", "--interface", type=str,
53 53
                 dest="interface", action='store',
54
-                help="Interface to use (if any). 'g' for GTK or 'gt' for GTK" +
55
-                " system tray icon")
54
+                help="Interface to use (if any). 'g' for GTK.")
56 55
 
57 56
         self._parser.add_argument("-c", "--continuous",
58 57
                 action="store_true", dest="continuous", default=False,

Loading…
Cancel
Save