From a02c9a3f6e81ad860e38c1932c2ac44a67aca669 Mon Sep 17 00:00:00 2001 From: tgoff0 Date: Mon, 9 Mar 2015 15:21:08 +0000 Subject: [PATCH] gui: Always disconnect/connect when loading a file; this creates a new session. --- gui/filemgmt.tcl | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/gui/filemgmt.tcl b/gui/filemgmt.tcl index 377df378..d6ba580e 100644 --- a/gui/filemgmt.tcl +++ b/gui/filemgmt.tcl @@ -149,14 +149,21 @@ proc openFile { filename } { global changed global oper_mode + set prev_oper_mode $oper_mode + if { [popupStopSessionPrompt] == "cancel" } { + return + } + if { [lindex [file extension $filename] 0] == ".py" } { execPythonFile $filename return } - set prev_oper_mode $oper_mode - if { [popupStopSessionPrompt] == "cancel" } { - return + # disconnect and get a new session number + set name [lindex [getEmulPlugin "*"] 0] + if { $name != "" } { + pluginConnect $name disconnect 1 + pluginConnect $name connect 1 } set currentFile $filename @@ -169,18 +176,11 @@ proc openFile { filename } { } if { $prev_oper_mode == "exec" } { - if { $oper_mode == "exec" } { - global g_current_session - setOperMode edit - set g_current_session 0 - } - - # disconnect and get a new session number - set name [lindex [getEmulPlugin "*"] 0] - if { $name != "" } { - pluginConnect $name disconnect 1 - pluginConnect $name connect 1 - } + if { $oper_mode == "exec" } { + global g_current_session + setOperMode edit + set g_current_session 0 + } } if { [file extension $currentFile] == ".xml" } {