gui: Improve session management when opening files.
This commit is contained in:
parent
049efb642f
commit
52fdc300b8
1 changed files with 30 additions and 14 deletions
|
@ -147,28 +147,48 @@ proc openFile { filename } {
|
||||||
global undolog activetool
|
global undolog activetool
|
||||||
global canvas_list curcanvas systype
|
global canvas_list curcanvas systype
|
||||||
global changed
|
global changed
|
||||||
|
global oper_mode
|
||||||
|
|
||||||
|
if { [lindex [file extension $filename] 0] == ".py" } {
|
||||||
|
execPythonFile $filename
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
set prev_oper_mode $oper_mode
|
||||||
if { [popupStopSessionPrompt] == "cancel" } {
|
if { [popupStopSessionPrompt] == "cancel" } {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
set currentFile $filename
|
set currentFile $filename
|
||||||
|
|
||||||
if { [lindex [file extension $currentFile] 0] == ".py" } {
|
setGuiTitle ""
|
||||||
set flags 0x10 ;# status request flag
|
cleanupGUIState
|
||||||
sendRegMessage -1 $flags [list "exec" $currentFile]
|
resetGlobalVars openfile
|
||||||
addFileToMrulist $currentFile
|
if { $canvas_list == "" } {
|
||||||
return
|
set curcanvas [newCanvas ""]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 { [file extension $currentFile] == ".xml" } {
|
if { [file extension $currentFile] == ".xml" } {
|
||||||
setGuiTitle ""
|
|
||||||
cleanupGUIState
|
|
||||||
resetGlobalVars openfile
|
|
||||||
xmlFileLoadSave "open" $currentFile
|
xmlFileLoadSave "open" $currentFile
|
||||||
addFileToMrulist $currentFile
|
addFileToMrulist $currentFile
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
set fileName [file tail $currentFile]
|
|
||||||
# flush daemon configuration
|
# flush daemon configuration
|
||||||
if { [llength [findWlanNodes ""]] > 0 } {
|
if { [llength [findWlanNodes ""]] > 0 } {
|
||||||
if { [lindex $systype 0] == "FreeBSD" } {
|
if { [lindex $systype 0] == "FreeBSD" } {
|
||||||
|
@ -186,12 +206,8 @@ proc openFile { filename } {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
close $fileId
|
close $fileId
|
||||||
setGuiTitle ""
|
|
||||||
loadCfg $cfg
|
loadCfg $cfg
|
||||||
set curcanvas [lindex $canvas_list 0]
|
|
||||||
switchCanvas none
|
|
||||||
# already called from switchCanvas: redrawAll
|
|
||||||
resetGlobalVars openfile
|
|
||||||
set undolog(0) $cfg
|
set undolog(0) $cfg
|
||||||
set activetool select
|
set activetool select
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue