From db7e4eee8f15274191da80c3bb9b8aab3ad8ff42 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 28 Jan 2016 15:52:11 -0800 Subject: [PATCH] Make Ctrl-O and 'Running Scripts->load file' follow the same code path --- .../resources/qml/dialogs/RunningScripts.qml | 60 ++++++++----------- 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/interface/resources/qml/dialogs/RunningScripts.qml b/interface/resources/qml/dialogs/RunningScripts.qml index 5aec9ef3cf..8b148c6bef 100644 --- a/interface/resources/qml/dialogs/RunningScripts.qml +++ b/interface/resources/qml/dialogs/RunningScripts.qml @@ -72,23 +72,6 @@ Window { scripts.stopAllScripts(); } - Component { - id: fileDialogBuilder - FileDialog { } - } - - function loadFromFile() { - var fileDialog = fileDialogBuilder.createObject(desktop, { filterModel: fileFilters }); - fileDialog.canceled.connect(function(){ - console.debug("Cancelled file open") - }) - - fileDialog.selectedFile.connect(function(file){ - console.debug("Selected " + file) - scripts.loadOneScript(file); - }) - } - Rectangle { color: "white" anchors.fill: parent @@ -201,31 +184,38 @@ Window { anchors.bottomMargin: 8 anchors.right: parent.right - // For some reason trigginer an API that enters - // an internal event loop directly from the button clicked - // trigger below causes the appliction to behave oddly. - // Most likely because the button onClicked handling is never - // completed until the function returns. - // FIXME find a better way of handling the input dialogs that - // doesn't trigger this. - Timer { - id: asyncAction - interval: 50 - repeat: false - running: false - onTriggered: ApplicationInterface.loadScriptURLDialog(); - } Button { text: "from URL"; - onClicked: { - focus = false; - asyncAction.running = true; + onClicked: fromUrlTimer.running = true; + + // For some reason trigginer an API that enters + // an internal event loop directly from the button clicked + // trigger below causes the appliction to behave oddly. + // Most likely because the button onClicked handling is never + // completed until the function returns. + // FIXME find a better way of handling the input dialogs that + // doesn't trigger this. + Timer { + id: fromUrlTimer + interval: 5 + repeat: false + running: false + onTriggered: ApplicationInterface.loadScriptURLDialog(); } } + Button { text: "from Disk" - onClicked: loadFromFile(); + onClicked: fromDiskTimer.running = true; + + Timer { + id: fromDiskTimer + interval: 5 + repeat: false + running: false + onTriggered: ApplicationInterface.loadDialog(); + } } }