From: duplo Date: Fri, 28 Aug 2009 16:14:35 +0000 (+0000) Subject: Add the editing mode in the main bertos file X-Git-Tag: 2.2.0~149 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=4dacc56bc3ec46d0517a67fe6c6608efc5b77962;p=bertos.git Add the editing mode in the main bertos file git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2819 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/bertos.py b/wizard/bertos.py index 4bd6af67..a5610a75 100755 --- a/wizard/bertos.py +++ b/wizard/bertos.py @@ -55,6 +55,8 @@ from BOutputPage import BOutputPage from BCreationPage import BCreationPage from BFinalPage import BFinalPage +from BEditingDialog import BEditingDialog + import bertos_utils def newProject(): @@ -74,11 +76,10 @@ def newProject(): subprocess.call(command_line + " \"" + relevant_file + "\"") sys.exit() -def editProject(): - page_list = [BOpenPage, BVersionPage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage] - wizard = BWizard.BWizard(page_list) - wizard.show() - wizard.exec_() +def editProject(project_file): + QApplication.instance().project = bertos_utils.loadBertosProject(project_file) + dialog = BEditingDialog() + dialog.exec_() def showStartPage(): QApplication.instance().dialog = BStartPage.BStartPage() @@ -95,17 +96,11 @@ def main(): 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: - newProject() - 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 - print " ".join(sys.argv) - print "Invalid usage!" - pass + if len(sys.argv) == 3 and sys.argv[1] == "--edit": + editProject(sys.argv[2]) else: newProject() + if __name__ == '__main__': main()