Loading screen doesn't show

Which tool versions are you using?

SDK: v13.0.0
Platform: v2022.x.x
Python: v3.9.0
Isolation mode: venv

Current Behavior

Our Viktor app use to show the loading screen when the download button was pressed, running a script. Now no loading screen appears, but the app still runs as expected.
…

Expected Behavior

For the loading screen to pop up when clicking the download button
…

Context

We thought it could be to do with the try statements, or maybe how we’ve formatted the error statments, but changing that hasn’t fixed the issue. The loading screen is important to let the user the script is working, as the script can take several minutes to run.
…

Code:

from viktor import ViktorController, UserException
from .parametrization import Parametrization
from .BGS_helper import *

from viktor.views import MapPoint
from viktor.views import MapResult
from viktor.views import MapView
from viktor.views import MapPolygon 
from viktor.result import DownloadResult
from viktor.core import File
from shapely.geometry import Polygon
from datetime import datetime

import urllib3
import json


class Controller(ViktorController):
    label = 'Scraper Entity'
    parametrization = Parametrization

    # Duration guess allows to write a new address avoid the app running every typing.
    @MapView('Map view', duration_guess=4)
    def get_map_view(self, params, **kwargs):
        '''
        This function returns a map location based off an input marker
        Parameters
        ----------
        coordinats : Points from the search_location function, 
        defined by the user
        Returns
        -------
        Updates the map view to the desired location 
        '''
        features = []
        coordinats = BGS.search_location(params.address)
        marker = MapPoint(coordinats[0], coordinats[1], icon=None)
        features.append(marker)
        if params.polygon:
            features.append(MapPolygon.from_geo_polygon(params.polygon))
        return MapResult(features)

    def download_file(self, params, **kwargs):
        '''
        This function runs the BGS_Polygon_scraper script and returns a 
        csv and PDFs of borehole information from the user defined polygon 
        area.
        Parameters
        ----------
        params.polygon : A user drawn polgon on the map view
        Returns
        -------
        A zip file containing a csv and PDFS of borehole information 
        '''
        if params.polygon:
            eastings = []
            northings = []

            # Convert lat, lon points to eastings, northings
            for point in params.polygon.points:
                http = urllib3.PoolManager(1)
                try:
                    url = "http://webapps.bgs.ac.uk/data/webservices/CoordConvert_LL_BNG.cfc?method=LatLongToBNG&lat=%s&lon=%s" % (str(point.lat), str(point.lon))
                    resp = http.request('GET', url)
                    result = json.loads(resp.data.decode())
                    eastings.append(result["EASTING"])
                    northings.append(result["NORTHING"])
                except urllib3.exceptions.HTTPError as e:
                    raise UserException(e.reason)
                
            # Test to see if shae is valid
            if bool(eastings) and bool(northings):
                # Convert points to shapely polygon
                polygon_geom = Polygon(zip(eastings, northings))
                # Run methods
                XYZ = BGS.boreholes_from_polygon(polygon_geom)
                pdf_result = BGS.download_images(XYZ.image_paths)
                # Save csv of boreholes dataframe
                csv_result = BGS.polygon_to_csv(polygon_geom)
                data_time = datetime.now()
                time_stamp = data_time.strftime("%d-%b-%Y")
                file_name = f"{time_stamp}_Boreholes_{params.address}"
                zip_dict = {}
                zip_dict["boreholes_in_polyline.csv"] = File.from_data(csv_result)
                for pdf in range(len(pdf_result[0])):
                    zip_dict[pdf_result[1][pdf] + ".pdf"] = File.from_data(pdf_result[0][pdf])
                return DownloadResult(zipped_files=zip_dict, file_name=file_name + ".zip")

Thanks,
Charlie

Hi Charlie,

By setting the parameter longpoll=True on the DownloadButton you trigger the progress modal.