fix
[sface.git] / sface / mainwindow.py
index 2e9664a..620b000 100644 (file)
@@ -1,10 +1,9 @@
-import os
+import os, os.path
 import sys
 import time
 
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
-from PyQt4.QtOpenGL import *
 
 from sface.config import config
 from sface.logwindow import LogWindow
@@ -13,16 +12,24 @@ from sface.screens.configscreen import ConfigScreen
 from sface.screens.mainscreen import MainScreen
 from sface.screens.helpscreen import HelpScreen
 
+# depending on the platform..
+def locate_image_file (filename):
+    for dir in [ '/usr/share' ] :
+        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()
-        scene.addPixmap(QPixmap('/Users/parmentelat/git/sface/macos/graphic-sfa64.png'))
-        self.logoview=QGraphicsView()
-        self.logoview.setViewport(QGLWidget())
-        self.logoview.setScene(scene)
+        pixmap = QPixmap(locate_image_file('graphic-sfa.png'))
+        logolabel=QLabel("",self)
+        logolabel.setPixmap(pixmap)
         self.main = QLabel("", self)
         self.main.setAlignment(Qt.AlignRight)
 
@@ -33,7 +40,7 @@ class Nav(QWidget):
         self.help.setAlignment(Qt.AlignRight)
 
         hlayout = QHBoxLayout()
-        hlayout.addWidget(self.logoview)
+        hlayout.addWidget(logolabel)
         hlayout.addWidget(self.title)
         hlayout.addStretch()
         hlayout.addWidget(QLabel("Go to: ", self))