def get_popup(request, popup_type='start-routing'): if request.method == 'POST': data = utils.get_popup(popup_type, request) if data['type'] == 'form' and data['form'].is_valid(): result, marker_id = utils.add_marker(request) if result: return HttpResponse(content=str(marker_id), content_type='text/plain') else: return HttpResponse(content='fail', content_type='text/plain') else: return render(request, 'popup.html', {'data': data}) else: data = utils.get_popup(popup_type) return render(request, 'popup.html', {'data': data})
def handle_popup_view_example(qtbot, window): """Test showing the popups. """ from conftest import DIALOG_SLEEP popup_triggers = window.central_widget().widgets() # Test configuration popup popup_triggers[0].clicked = True popup = get_popup(qtbot) qtbot.wait(DIALOG_SLEEP*1000) popup.central_widget().widgets()[-1].clicked = True wait_for_destruction(qtbot, popup) # Test transient popups for t in popup_triggers[1:]: t.clicked = True popup = get_popup(qtbot) qtbot.wait(DIALOG_SLEEP*1000) close_window_or_popup(qtbot, popup)