X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBOpenPage.py;fp=wizard%2FBOpenPage.py;h=b35a9655800cd86668fa209cbd6f56ee77f05f4e;hb=107cf69bcaae23a972ff33a805c60a37bd0a1238;hp=0000000000000000000000000000000000000000;hpb=cac293934b2d9b7e712e1034e7fafd37c083424a;p=bertos.git diff --git a/wizard/BOpenPage.py b/wizard/BOpenPage.py new file mode 100644 index 00000000..b35a9655 --- /dev/null +++ b/wizard/BOpenPage.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# encoding: utf-8 +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# $Id:$ +# +# Author: Lorenzo Berni +# + +import os +import pickle + +from PyQt4.QtGui import * +from PyQt4.QtCore import * + +from BWizardPage import * +import bertos_utils + +from const import * + +class BOpenPage(BWizardPage): + """ + Initial page of the wizard. Permit to select the project name and the directory + where the project will be created. + """ + + def __init__(self): + BWizardPage.__init__(self, UI_LOCATION + "/project_select.ui") + self.setTitle(self.tr("Open an existing BeRTOS project")) + + ## Overloaded BWizardPage methods ## + + def reloadData(self): + project = unicode(QFileDialog.getOpenFileName(self, self.tr("Open project file"), os.path.expanduser("~"), self.tr("Project file (project.bertos)"))) + if project == "": + QApplication.instance().quit() + else: + QApplication.instance().project = pickle.loads(open(project, "r").read()) + self.pageContent.nameLabel.setText(os.path.basename(project.replace(os.sep + "project.bertos", ""))) + self.pageContent.dirLabel.setText(project) + + #### +