Fix export button crash for saved requests by using async callback
This commit is contained in:
parent
8ad720afc8
commit
4a8776a42d
@ -1183,9 +1183,8 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Apply variable substitution if environment is selected
|
# Apply variable substitution if environment is selected
|
||||||
substituted_request = request
|
def show_export(env):
|
||||||
if widget.selected_environment_id:
|
substituted_request = request
|
||||||
env = widget.get_selected_environment()
|
|
||||||
if env:
|
if env:
|
||||||
from .variable_substitution import VariableSubstitution
|
from .variable_substitution import VariableSubstitution
|
||||||
substituted_request, undefined = VariableSubstitution.substitute_request(request, env)
|
substituted_request, undefined = VariableSubstitution.substitute_request(request, env)
|
||||||
@ -1196,10 +1195,15 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
# Show warning toast but continue with export
|
# Show warning toast but continue with export
|
||||||
self._show_toast(f"Warning: {len(undefined)} undefined variable(s)")
|
self._show_toast(f"Warning: {len(undefined)} undefined variable(s)")
|
||||||
|
|
||||||
# Show export dialog with substituted request
|
# Show export dialog with substituted request
|
||||||
from .export_dialog import ExportDialog
|
from .export_dialog import ExportDialog
|
||||||
dialog = ExportDialog(substituted_request)
|
dialog = ExportDialog(substituted_request)
|
||||||
dialog.present(self)
|
dialog.present(self)
|
||||||
|
|
||||||
|
if widget.selected_environment_id:
|
||||||
|
widget.get_selected_environment(show_export)
|
||||||
|
else:
|
||||||
|
show_export(None)
|
||||||
|
|
||||||
def _mark_tab_as_saved(self, saved_request_id, name, request, scripts=None):
|
def _mark_tab_as_saved(self, saved_request_id, name, request, scripts=None):
|
||||||
"""Mark the current tab as saved (clear modified flag)."""
|
"""Mark the current tab as saved (clear modified flag)."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user