Don't permit to edit a project.
[bertos.git] / wizard / bertos.py
index a6529abef39c70b16d644342f0ce253c1ae6a33d..695a862782bfa826359dfd0bea73c1f9e7d69d7a 100755 (executable)
@@ -1,10 +1,10 @@
-#!/usr/bin/env python
+#!/usr/bin/env python
 # encoding: utf-8
 #
 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
 # All rights reserved.
 #
-# $Id:$
+# $Id$
 #
 # Author: Lorenzo Berni <duplo@develer.com>
 #
@@ -52,10 +52,12 @@ def showStartPage():
     QApplication.instance().dialog.show()
 
 def main():
+    os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))
     app = QApplication(sys.argv)
     app.settings = QSettings("Develer", "Bertos Configurator")
     app.project = BProject.BProject()
-    if newer("bertos.qrc", "bertos.rcc"):
+    # Development utility lines, to be removed for production
+    if not (hasattr(sys, "frozen") and sys.frozen) and newer("bertos.qrc", "bertos.rcc"):
         os.system("rcc -binary bertos.qrc -o bertos.rcc")
     QResource.registerResource("bertos.rcc")
     if "--create" in sys.argv and "--edit" not in sys.argv:
@@ -63,12 +65,12 @@ def main():
     elif "--edit" in sys.argv and "--create" not in sys.argv:
         editProject()
     elif "--create" in sys.argv and "--edit" in sys.argv:
-        ## TODO: need an explaining message
+        # TODO need an explaining message
         print " ".join(sys.argv)
         print "Invalid usage!"
         pass
     else:
-        showStartPage()
+        newProject()
         sys.exit(app.exec_())
 
 if __name__ == '__main__':