-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into en_lang_as_default
- Loading branch information
Showing
64 changed files
with
6,076 additions
and
28,193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
from django.core.management.base import BaseCommand | ||
from core.models import Group, G3WSpatialRefSys | ||
from qdjango.utils.data import QgisProject | ||
from qdjango.models import Project | ||
from django.core.files import File | ||
from django.conf import settings | ||
import os, subprocess, shutil | ||
|
||
class Command(BaseCommand): | ||
|
||
help = 'Add a project to DB' | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument( | ||
'--file', | ||
# default=os.path.realpath(f"{ settings.BASE_DIR }/../qdjango/tests/data/g3wsuite_project_test_qgis328.qgs"), | ||
default="building-management-demo.qgs", | ||
help='Absolute path to .qgis project file.' | ||
) | ||
parser.add_argument( | ||
'--data', | ||
# default=os.path.realpath(f"{ settings.BASE_DIR }/../qdjango/tests/data/geodata/"), | ||
default="-1", | ||
help='Absolute path to data folder related to .qgis project.' | ||
) | ||
|
||
def handle(self, *args, **options): | ||
|
||
# Fallback to remote "g3w-suite-demo-projects" repository (eg. --file="public-building-management-demo.qgs") | ||
if (not os.path.exists(options['file'])): | ||
if (not os.path.isdir('/tmp/g3w-suite-demo-projects')): | ||
subprocess.call("git clone https://github.com/g3w-suite/g3w-suite-demo-projects.git --single-branch --depth 1 --branch master /tmp/g3w-suite-demo-projects", shell=True) | ||
else: | ||
subprocess.call("git config --global --add safe.directory /tmp/g3w-suite-demo-projects", shell=True) | ||
subprocess.call("git -C /tmp/g3w-suite-demo-projects pull https://github.com/g3w-suite/g3w-suite-demo-projects.git", shell=True) | ||
shutil.copytree('/tmp/g3w-suite-demo-projects/project_data/', settings.DATASOURCE_PATH, dirs_exist_ok=True) | ||
options['file'] = f"/tmp/g3w-suite-demo-projects/projects/{ options['file'] }" | ||
options['data'] = '-1' | ||
|
||
# Ensure "projects_data" is there | ||
if (options['data'] and "-1" != options['data']): | ||
options['data']=options['data'].rstrip('/') + '/' | ||
out_dir=os.path.join(settings.DATASOURCE_PATH + os.path.basename(os.path.dirname(options['data']))) | ||
print(f"Copying { options['data']}") | ||
shutil.copytree(options['data'], out_dir, dirs_exist_ok=True) | ||
print(f" ---> {out_dir}") | ||
|
||
# Create or Update project | ||
project = QgisProject(File(open(options['file'], 'r'))) | ||
|
||
try: | ||
instance = Project.objects.get(title=project.title) | ||
group = instance.group | ||
except Project.DoesNotExist: | ||
instance = None | ||
group,_ = Group.objects.get_or_create( | ||
name=project.srid, | ||
defaults={ | ||
'title': project.srid, | ||
'srid': G3WSpatialRefSys.objects.get(auth_srid=project.srid) | ||
} | ||
) | ||
|
||
group.is_active = True | ||
group.save() | ||
|
||
project.group = group | ||
|
||
project.save(instance=instance) | ||
|
||
print(f" ---> { (instance or project.instance).qgis_file.path }") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.core.management import call_command | ||
from django.conf import settings | ||
import os, glob, subprocess, shutil | ||
|
||
class Command(BaseCommand): | ||
|
||
help = 'Import all demo projects from: https://github.com/g3w-suite/g3w-suite-demo-projects' | ||
|
||
def handle(self, *args, **options): | ||
|
||
# Clone qgis project from remote repository into a temporary folder (eg. --file="public-building-management-demo.qgs") | ||
if (not os.path.isdir('/tmp/g3w-suite-demo-projects')): | ||
subprocess.call("git clone https://github.com/g3w-suite/g3w-suite-demo-projects.git --single-branch --depth 1 --branch master /tmp/g3w-suite-demo-projects", shell=True) | ||
else: | ||
subprocess.call("git config --global --add safe.directory /tmp/g3w-suite-demo-projects", shell=True) | ||
subprocess.call("git -C /tmp/g3w-suite-demo-projects pull https://github.com/g3w-suite/g3w-suite-demo-projects.git", shell=True) | ||
|
||
shutil.copytree('/tmp/g3w-suite-demo-projects/project_data/', settings.DATASOURCE_PATH, dirs_exist_ok=True) | ||
|
||
# Load all qgis projects into DB | ||
for file in glob.glob('/tmp/g3w-suite-demo-projects/projects/*.qgs'): | ||
call_command('load_project', file=file, data="-1") | ||
|
||
# shutil.copytree(os.path.realpath(f"{ settings.BASE_DIR }/../qdjango/tests/data/geodata"), f"{settings.DATASOURCE_PATH}/geodata", dirs_exist_ok=True) | ||
# shutil.copytree(os.path.realpath(f"{ settings.BASE_DIR }/../qdjango/tests/data/editing"), f"{settings.DATASOURCE_PATH}/editing", dirs_exist_ok=True) | ||
|
||
# for file in glob.glob(os.path.realpath(f"{ settings.BASE_DIR }/../qdjango/tests/data/*.qgs")): | ||
# call_command('load_project', file=file, data="-1") |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file removed
BIN
-160 Bytes
g3w-admin/client/static/client/css/DataTables-1.10.16/images/sort_asc.png
Binary file not shown.
Binary file removed
BIN
-148 Bytes
g3w-admin/client/static/client/css/DataTables-1.10.16/images/sort_asc_disabled.png
Binary file not shown.
Binary file removed
BIN
-201 Bytes
g3w-admin/client/static/client/css/DataTables-1.10.16/images/sort_both.png
Binary file not shown.
Binary file removed
BIN
-158 Bytes
g3w-admin/client/static/client/css/DataTables-1.10.16/images/sort_desc.png
Binary file not shown.
Binary file removed
BIN
-146 Bytes
...admin/client/static/client/css/DataTables-1.10.16/images/sort_desc_disabled.png
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
g3w-admin/client/static/client/images/mActionIdentifyByRadius.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
27,778 changes: 0 additions & 27,778 deletions
27,778
g3w-admin/client/static/client/js/vendor.min.js
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.