Setting tag sface-0.1-11
[sface.git] / sface / mainwindow.py
index 6a0175e..c5e0183 100644 (file)
@@ -1,5 +1,4 @@
-
-import os
+import os, os.path
 import sys
 import time
 
@@ -13,11 +12,25 @@ from sface.screens.configscreen import ConfigScreen
 from sface.screens.mainscreen import MainScreen
 from sface.screens.helpscreen import HelpScreen
 
+# depending on the platform..
+# could probably use Qt's resource system but looks overkill for just one file...
+def locate_image_file (filename):
+    for dir in [ '/usr/share', '/Applications/sface.app/Contents/Resources/sface' ] :
+        for suffix in ['png','jpg']:
+            attempt=os.path.join(dir,'images',"%s.%s"%(filename,suffix))
+            if os.path.isfile(attempt) : return attempt
+    return os.path.join('/could/not/locate/image/file',filename)
+        
+
 class Nav(QWidget):
     def __init__(self, parent=None):
         QWidget.__init__(self, parent)
         
         self.title = QLabel("", self)
+        scene=QGraphicsScene()
+        pixmap = QPixmap(locate_image_file('graphic-sfa64'))
+        logolabel=QLabel("",self)
+        logolabel.setPixmap(pixmap)
         self.main = QLabel("", self)
         self.main.setAlignment(Qt.AlignRight)
 
@@ -28,9 +41,12 @@ class Nav(QWidget):
         self.help.setAlignment(Qt.AlignRight)
 
         hlayout = QHBoxLayout()
+        hlayout.addWidget(logolabel)
         hlayout.addWidget(self.title)
         hlayout.addStretch()
-        hlayout.addWidget(QLabel("Go to: ", self))
+        gotolabel=QLabel("Go to: ", self)
+        gotolabel.setAlignment(Qt.AlignRight)
+        hlayout.addWidget(gotolabel)
         hlayout.addWidget(self.main)
         hlayout.addWidget(self.config)
         hlayout.addWidget(self.help)