kopia lustrzana https://github.com/OpenDroneMap/WebODM
Changed default presets
rodzic
2005194d94
commit
9e07e297c6
42
app/boot.py
42
app/boot.py
|
@ -3,7 +3,7 @@ import os
|
|||
import kombu
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.contrib.auth.models import User, Group
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
|
||||
from django.core.files import File
|
||||
from django.db.utils import ProgrammingError
|
||||
from guardian.shortcuts import assign_perm
|
||||
|
@ -60,18 +60,7 @@ def boot():
|
|||
# Add permission to view processing nodes
|
||||
default_group.permissions.add(Permission.objects.get(codename="view_processingnode"))
|
||||
|
||||
# Add default presets
|
||||
Preset.objects.get_or_create(name='DSM + DTM', system=True,
|
||||
options=[{'name': 'dsm', 'value': True}, {'name': 'dtm', 'value': True}, {'name': 'mesh-octree-depth', 'value': 11}])
|
||||
Preset.objects.get_or_create(name='Fast Orthophoto', system=True,
|
||||
options=[{'name': 'fast-orthophoto', 'value': True}])
|
||||
Preset.objects.get_or_create(name='High Quality', system=True,
|
||||
options=[{'name': 'dsm', 'value': True},
|
||||
{'name': 'mesh-octree-depth', 'value': "12"},
|
||||
{'name': 'dem-resolution', 'value': "0.04"},
|
||||
{'name': 'orthophoto-resolution', 'value': "40"},
|
||||
])
|
||||
Preset.objects.get_or_create(name='Default', system=True, options=[{'name': 'dsm', 'value': True}, {'name': 'mesh-octree-depth', 'value': 11}])
|
||||
add_default_presets()
|
||||
|
||||
# Add settings
|
||||
default_theme, created = Theme.objects.get_or_create(name='Default')
|
||||
|
@ -101,4 +90,29 @@ def boot():
|
|||
|
||||
|
||||
except ProgrammingError:
|
||||
logger.warning("Could not touch the database. If running a migration, this is expected.")
|
||||
logger.warning("Could not touch the database. If running a migration, this is expected.")
|
||||
|
||||
|
||||
def add_default_presets():
|
||||
try:
|
||||
Preset.objects.update_or_create(name='DSM + DTM', system=True,
|
||||
defaults={
|
||||
'options': [{'name': 'dsm', 'value': True}, {'name': 'dtm', 'value': True},
|
||||
{'name': 'mesh-octree-depth', 'value': 6}]})
|
||||
Preset.objects.update_or_create(name='Fast Orthophoto', system=True,
|
||||
defaults={'options': [{'name': 'fast-orthophoto', 'value': True}]})
|
||||
Preset.objects.update_or_create(name='High Quality', system=True,
|
||||
defaults={'options': [{'name': 'dsm', 'value': True},
|
||||
{'name': 'mesh-octree-depth', 'value': "12"},
|
||||
{'name': 'dem-resolution', 'value': "0.04"},
|
||||
{'name': 'orthophoto-resolution', 'value': "40"},
|
||||
]})
|
||||
Preset.objects.update_or_create(name='Default', system=True,
|
||||
defaults={'options': [{'name': 'dsm', 'value': True},
|
||||
{'name': 'mesh-octree-depth', 'value': 6}]})
|
||||
except MultipleObjectsReturned:
|
||||
# Mostly to handle a legacy code problem where
|
||||
# multiple system presets with the same name were
|
||||
# created if we changed the options
|
||||
Preset.objects.filter(system=True).delete()
|
||||
add_default_presets()
|
||||
|
|
|
@ -59,6 +59,7 @@ def get_api_url_patterns():
|
|||
|
||||
return url_patterns
|
||||
|
||||
|
||||
plugins = None
|
||||
def get_active_plugins():
|
||||
# Cache plugins search
|
||||
|
@ -107,6 +108,7 @@ def get_active_plugins():
|
|||
|
||||
return plugins
|
||||
|
||||
|
||||
def get_plugin_by_name(name):
|
||||
plugins = get_active_plugins()
|
||||
res = list(filter(lambda p: p.get_name() == name, plugins))
|
||||
|
|
Ładowanie…
Reference in New Issue