示例#1
0
文件: gis_set.py 项目: snakeice/grass
    def DownloadLocation(self, event):
        """Download location online"""
        from startup.locdownload import LocationDownloadDialog

        loc_download = LocationDownloadDialog(parent=self,
                                              database=self.gisdbase)
        loc_download.ShowModal()
        location = loc_download.GetLocation()
        if location:
            # get the new location to the list
            self.UpdateLocations(self.gisdbase)
            # seems to be used in similar context
            self.UpdateMapsets(os.path.join(self.gisdbase, location))
            self.lblocations.SetSelection(self.listOfLocations.index(location))
            # wizard does this as well, not sure if needed
            self.SetLocation(self.gisdbase, location, 'PERMANENT')
            # seems to be used in similar context
            self.OnSelectLocation(None)
        loc_download.Destroy()
示例#2
0
def download_location_interactively(guiparent, grassdb):
    """
    Download new location using Location Wizard.

    Returns tuple (database, location, mapset) where mapset is "PERMANENT"
    by default or in future it could be the mapset the user may want to
    switch to.
    """
    from startup.locdownload import LocationDownloadDialog

    result = (None, None, None)
    loc_download = LocationDownloadDialog(parent=guiparent, database=grassdb)
    loc_download.Centre()
    loc_download.ShowModal()

    if loc_download.GetLocation() is not None:
        # Returns database and location created by user
        # and a mapset user may want to switch to
        result = (grassdb, loc_download.GetLocation(), "PERMANENT")
    loc_download.Destroy()
    return result