diff options
author | Jezra <jezra@jezra.net> | 2013-07-02 07:05:51 -0700 |
---|---|---|
committer | Jezra <jezra@jezra.net> | 2013-07-02 07:05:51 -0700 |
commit | bd290f006130827b0630bf36ab058bb82f4ce29d (patch) | |
tree | 47477e0ca24ad963134d72e4d4e87d568687e9e3 | |
parent | 3d1a7ff6d07380af777194d1b95e2dafa65033cb (diff) |
icon, dumbass
-rwxr-xr-x | Blather.py | 18 | ||||
-rw-r--r-- | GtkUI.py | 3 | ||||
-rw-r--r-- | QtUI.py | 8 |
3 files changed, 24 insertions, 5 deletions
diff --git a/Blather.py b/Blather.py index 223d417..461a456 100755 --- a/Blather.py +++ b/Blather.py @@ -49,6 +49,10 @@ class Blather: self.ui = UI(args,opts.continuous) self.ui.connect("command", self.process_command) + #can we load the icon resource? + icon = self.load_resource("icon.png") + if icon: + self.ui.set_icon(icon) if self.opts.history: self.history = [] @@ -129,7 +133,19 @@ class Blather: self.recognizer.pause() elif command == "quit": self.quit() - + + def load_resource(self,string): + local_data = os.path.join(os.path.dirname(__file__), 'data') + paths = ["/usr/share/blather/","/usr/local/share/blather", local_data] + for path in paths: + resource = os.path.join(path, string) + if os.path.exists( resource ): + return resource + #if we get this far, no resource was found + return False + + + if __name__ == "__main__": parser = OptionParser() parser.add_option("-i", "--interface", type="string", dest="interface", diff --git a/GtkUI.py b/GtkUI.py index d9aae7d..720fb10 100644 --- a/GtkUI.py +++ b/GtkUI.py @@ -80,3 +80,6 @@ class UI(gobject.GObject): self.lsbutton_stopped() self.label.set_text(text) + def set_icon(self, icon): + gtk.window_set_default_icon_from_file(icon) + diff --git a/QtUI.py b/QtUI.py index c4a5a54..071dab4 100644 --- a/QtUI.py +++ b/QtUI.py @@ -6,7 +6,7 @@ import gobject # Qt stuff from PySide.QtCore import Signal, Qt from PySide.QtGui import QApplication, QWidget, QMainWindow, QVBoxLayout -from PySide.QtGui import QLabel, QPushButton, QCheckBox +from PySide.QtGui import QLabel, QPushButton, QCheckBox, QIcon class UI(gobject.GObject): __gsignals__ = { @@ -76,9 +76,6 @@ class UI(gobject.GObject): self.app.exec_() self.emit("command", "quit") - def quit(self): - pass - def finished(self, text): print text #if the continuous isn't pressed @@ -89,3 +86,6 @@ class UI(gobject.GObject): def quit(self): #sys.exit() pass + + def set_icon(self, icon): + self.window.setWindowIcon(QIcon(icon)) |