Ejemplo n.º 1
0
    def save_project(self):
        name = self.name.text()
        if name == '':
            print('Please enter a valid Project name')
            return

        rootname = self.directory.text()
        dirname = os.path.join(rootname, name)

        # If directory already exist, a number is added at the end within ().

        count = 1
        while os.path.exists(dirname):
            dirname = os.path.join(rootname, '%s (%d)' % (name, count))
            count += 1

        print('\n---------------')
        print('Creating files and folder achitecture for the new project in:')
        print(dirname)
        print

        # ---- Create Files and Folders ----

        os.makedirs(dirname)

        # ---- folder architecture ----

        folders = [
            os.path.join(dirname, 'Meteo', 'Raw'),
            os.path.join(dirname, 'Meteo', 'Input'),
            os.path.join(dirname, 'Meteo', 'Output'),
            os.path.join(dirname, 'Water Levels')
        ]

        for f in folders:
            if not os.path.exists(f):
                os.makedirs(f)

        # ---- project.what ----

        fname = os.path.join(dirname, '%s.gwt' % name)

        projet = ProjetReader(fname)
        projet.name = self.name.text()
        projet.author = self.author.text()
        projet.created = self.date.text()
        projet.modified = self.date.text()
        projet.version = self.createdby.text()
        projet.lat = self.lat_spinbox.value()
        projet.lon = self.lon_spinbox.value()

        del projet

        print('Creating file %s.gwt' % name)
        print('---------------')

        self.close()
        self.sig_new_project.emit(fname)
Ejemplo n.º 2
0
    def save_project(self):
        name = self.name.text()
        if name == '':
            print('Please enter a valid Project name')
            return

        rootname = self.directory.text()
        dirname = os.path.join(rootname, name)

        # If directory already exist, a number is added at the end within ().

        count = 1
        while os.path.exists(dirname):
            dirname = os.path.join(rootname, '%s (%d)' % (name, count))
            count += 1

        print('\n---------------')
        print('Creating files and folder achitecture for the new project in:')
        print(dirname)
        print

        # ---- Create Files and Folders ----

        os.makedirs(dirname)

        # ---- folder architecture ----

        folders = [os.path.join(dirname, 'Meteo', 'Raw'),
                   os.path.join(dirname, 'Meteo', 'Input'),
                   os.path.join(dirname, 'Meteo', 'Output'),
                   os.path.join(dirname, 'Water Levels')]

        for f in folders:
            if not os.path.exists(f):
                os.makedirs(f)

        # ---- project.what ----

        fname = os.path.join(dirname, '%s.gwt' % name)

        projet = ProjetReader(fname)
        projet.name = self.name.text()
        projet.author = self.author.text()
        projet.created = self.date.text()
        projet.modified = self.date.text()
        projet.version = self.createdby.text()
        projet.lat = self.lat_spinbox.value()
        projet.lon = self.lon_spinbox.value()

        del projet

        print('Creating file %s.gwt' % name)
        print('---------------')

        self.close()
        self.sig_new_project.emit(fname)
Ejemplo n.º 3
0
def projectfile(projectpath):
    """A path to a valid existing project file."""
    project = ProjetReader(projectpath)
    assert osp.exists(projectpath)

    project.name = NAME
    project.author = NAME
    project.lat = LAT
    project.lon = LON

    project.close()

    return projectpath
Ejemplo n.º 4
0
def projectfile(projectpath):
    """A path to a valid existing project file."""
    project = ProjetReader(projectpath)
    assert osp.exists(projectpath)

    project.name = NAME
    project.author = NAME
    project.lat = LAT
    project.lon = LON

    project.close()

    return projectpath