#!/usr/bin/env python import os import sys from optparse import OptionParser sys.path.insert(0, ".") exe = os.path.abspath(sys.argv[0]) def using_env(e): print "Using %s = %s" % (e, os.environ[e]) def print_env(config): if not config.verbose: return if sys.platform == "darwin": using_env("DYLD_FRAMEWORK_PATH") using_env("DYLD_LIBRARY_PATH") using_env("PATH") print "Using sys.path =", sys.path if sys.platform == "darwin": # for testing on mac os x 10.5 - baris sys.path.append("/opt/local/lib/python2.5/site-packages/") DIR = os.path.dirname(exe) CONTENTS = os.path.dirname(DIR) RESOURCES = os.path.join(CONTENTS, "Resources") FRAMEWORKS = os.path.join(CONTENTS, "Frameworks") DYLD_FRAMEWORK_PATH = FRAMEWORKS DYLD_LIBRARY_PATH = RESOURCES PATH = os.getenv("PATH") SFI_PATH = os.path.join(RESOURCES, "sfa/client") PATH=":".join([RESOURCES, SFI_PATH, PATH]) os.environ["PATH"] = PATH os.environ["DYLD_LIBRARY_PATH"] = DYLD_LIBRARY_PATH os.environ["DYLD_FRAMEWORK_PATH"] = DYLD_FRAMEWORK_PATH if os.path.exists(RESOURCES): sys.path.insert(0, RESOURCES) if os.path.exists(FRAMEWORKS): sys.path.insert(0, FRAMEWORKS) elif sys.platform == "linux2": sys.path.extend(["/usr/share", "/usr/share/sface"]) from PyQt4.QtGui import * from sface.mainwindow import MainWindow from sface.config import config def main(args): app = QApplication(args) app.setStyleSheet(''' /* transparency QDialog, MainWindow { background-color:rgba(255,255,255,120); } */ QTreeView, QLineEdit { border: 2px solid gray; border-radius: 4px; padding: 1px; margin: 2px; } QPushButton { background-color: white; border: 2px solid gray; border-radius: 4px; padding: 6px; } QPushButton:pressed { background-color: #5599FF; } QLabel { font-size: 14px; } ''') win = MainWindow() win.redirectOutputToLog() win.setWindowTitle("Sface: SFA Interface") win.show() win.raise_() win.activateWindow() app.setActiveWindow(win) sys.exit(app.exec_()) if __name__ == "__main__": parser=OptionParser() config.add_options_to_OptionParser(parser) (options,args)=parser.parse_args() config.update_from_OptionParser(options) config.display("After command-line") print_env(config) main(sys.argv)