Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

Fix import #85

Merged
merged 1 commit into from Jan 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions plugin.py
Expand Up @@ -621,7 +621,7 @@ def __import_project(self):
)

project_name = os.path.split(fil)[1][:-4]
dir_ = tempfile.gettempdir()
dir_ = tempfile.mkdtemp()
with zipfile.ZipFile(fil, "r") as z:
z.extractall(dir_)

Expand All @@ -631,22 +631,25 @@ def __import_project(self):
self.__iface.messageBar().pushInfo(
"Albion", "loading {} from {}".format(project_name, dump)
)
if Project.exists(project_name):

dbname = os.path.splitext(os.path.basename(dump))[0]

if Project.exists(dbname):
if (
QMessageBox.Yes
!= QMessageBox(
QMessageBox.Information,
"Delete existing DB",
"Database {} exits, to you want to delete it ?".format(
project_name
dbname
),
QMessageBox.Yes | QMessageBox.No,
).exec_()
):
return
Project.delete(project_name)
Project.delete(dbname)

project = Project.import_(project_name, dump)
project = Project.import_(dbname, dump)

QgsProject.instance().read(QFileInfo(prj))

Expand Down