Skip to content

Commit a89ec3b

Browse files
Merge pull request #973 from KratosMultiphysics/prepare-release
Prepare release script
2 parents 2212a37 + 15e9ec1 commit a89ec3b

9 files changed

Lines changed: 140 additions & 205 deletions

File tree

kratos.gid/apps/DEMLauncher/start.tcl

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,55 +14,7 @@ proc ::DemLauncher::Init { app } {
1414

1515
proc ::DemLauncher::AppSelectorWindow { } {
1616
variable available_apps
17-
set initwind $::spdAux::initwind
18-
19-
set root [customlib::GetBaseRoot]
20-
set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v]
21-
if { $nd ne "undefined" } {
22-
# if {[apps::getActiveAppId] eq "Fluid"} {
23-
# spdAux::SwitchDimAndCreateWindow $nd
24-
# }
25-
} {
26-
[$root selectNodes "value\[@n='nDim'\]"] setAttribute v wait
27-
28-
set initwind $::spdAux::application_window_id
29-
spdAux::DestroyWindows
30-
spdAux::RegisterWindow $initwind
31-
set w $initwind
32-
33-
InitWindow $w [_ "DEM applications"] Kratos "" "" 1
34-
set initwind $w
35-
ttk::frame $w.top
36-
ttk::label $w.top.title_text -text [_ "Select a DEM application"]
37-
38-
ttk::frame $w.applications -relief ridge
39-
set i 0
40-
foreach app $available_apps {
41-
set img [::apps::getImgFrom $app]
42-
set app_publicname [[::apps::getAppById $app] getPublicName]
43-
set but [ttk::button $w.applications.img$app -image $img -command [list ::DemLauncher::ChangeAppTo $app] ]
44-
bind $w.applications.img$app <Enter> {::spdAux::PlaceInformationWindowByPath %W applications}
45-
ttk::label $w.applications.text$app -text $app_publicname
46-
grid $w.applications.img$app -column $i -row 0
47-
grid $w.applications.text$app -column $i -row 1
48-
incr i
49-
}
50-
grid $w.top
51-
grid $w.top.title_text
52-
53-
grid $w.applications
54-
55-
# Information panel
56-
set spdAux::info_main_window_text ""
57-
ttk::labelframe $w.info -text " Information " -relief ridge
58-
ttk::label $w.info.text -textvariable spdAux::info_main_window_text
59-
grid $w.info.text
60-
grid $w.info -sticky we
61-
}
17+
18+
spdAux::CreateLauncherWindow DemLauncher $available_apps
6219
}
6320

64-
proc ::DemLauncher::ChangeAppTo {appid} {
65-
spdAux::deactiveApp DemLauncher
66-
spdAux::SetSpatialDimmension undefined
67-
apps::setActiveApp $appid
68-
}

kratos.gid/apps/FluidLauncher/start.tcl

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -15,57 +15,5 @@ proc ::FluidLauncher::Init { app } {
1515
proc ::FluidLauncher::FluidAppSelectorWindow { } {
1616
variable available_apps
1717

18-
set root [customlib::GetBaseRoot]
19-
set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v]
20-
if { $nd ne "undefined" } {
21-
if {[apps::getActiveAppId] eq "Fluid"} {
22-
spdAux::SwitchDimAndCreateWindow $nd
23-
}
24-
} {
25-
[$root selectNodes "value\[@n='nDim'\]"] setAttribute v wait
26-
27-
set initwind $::spdAux::application_window_id
28-
spdAux::DestroyWindows
29-
spdAux::RegisterWindow $initwind
30-
31-
set w $initwind
32-
33-
InitWindow $w [_ "Fluid applications"] Kratos "" "" 1
34-
set initwind $w
35-
ttk::frame $w.top
36-
ttk::label $w.top.title_text -text [_ "Select a fluid application"]
37-
38-
ttk::frame $w.applications -relief ridge
39-
set r 0
40-
set c 0
41-
set max_cols 3
42-
foreach app $available_apps {
43-
set img [::apps::getImgFrom $app]
44-
set app_publicname [[::apps::getAppById $app] getPublicName]
45-
set but [ttk::button $w.applications.img$app -image $img -command [list ::FluidLauncher::ChangeAppTo $app] ]
46-
bind $w.applications.img$app <Enter> {::spdAux::PlaceInformationWindowByPath %W applications}
47-
ttk::label $w.applications.text$app -text $app_publicname
48-
grid $w.applications.img$app -column $r -row $c
49-
grid $w.applications.text$app -column $r -row [expr $c + 1]
50-
incr r
51-
if {$r >= $max_cols} {incr c 2; set r 0}
52-
}
53-
grid $w.top
54-
grid $w.top.title_text
55-
56-
grid $w.applications
57-
58-
# Information panel
59-
set spdAux::info_main_window_text ""
60-
ttk::labelframe $w.info -text " Information " -relief ridge
61-
ttk::label $w.info.text -textvariable spdAux::info_main_window_text
62-
grid $w.info.text
63-
grid $w.info -sticky we
64-
}
65-
}
66-
67-
proc ::FluidLauncher::ChangeAppTo {appid} {
68-
spdAux::deactiveApp FluidLauncher
69-
spdAux::SetSpatialDimmension undefined
70-
apps::setActiveApp $appid
18+
spdAux::CreateLauncherWindow FluidLauncher $available_apps [_ "Fluid applications"] [_ "Select a fluid application"]
7119
}

kratos.gid/apps/PfemLauncher/start.tcl

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,5 @@ proc ::PfemLauncher::Init { app } {
1515
proc ::PfemLauncher::AppSelectorWindow { } {
1616
variable available_apps
1717

18-
set root [customlib::GetBaseRoot]
19-
set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v]
20-
if { $nd eq "undefined" } {
21-
22-
[$root selectNodes "value\[@n='nDim'\]"] setAttribute v wait
23-
24-
set initwind $::spdAux::application_window_id
25-
spdAux::DestroyWindows
26-
spdAux::RegisterWindow $initwind
27-
28-
set w $initwind
29-
InitWindow $w [_ "Pfem applications"] Kratos "" "" 1
30-
set initwind $w
31-
ttk::frame $w.top
32-
ttk::label $w.top.title_text -text [_ "Select a pfem application"]
33-
34-
ttk::frame $w.applications -relief ridge
35-
set i 0
36-
foreach app $available_apps {
37-
set img [::apps::getImgFrom $app]
38-
set app_publicname [[::apps::getAppById $app] getPublicName]
39-
set but [ttk::button $w.applications.img$app -image $img -command [list ::PfemLauncher::ChangeAppTo $app] ]
40-
bind $w.applications.img$app <Enter> {::spdAux::PlaceInformationWindowByPath %W applications}
41-
ttk::label $w.applications.text$app -text $app_publicname
42-
grid $w.applications.img$app -column $i -row 0
43-
grid $w.applications.text$app -column $i -row 1
44-
incr i
45-
}
46-
grid $w.top
47-
grid $w.top.title_text
48-
grid $w.applications
49-
50-
# Information panel
51-
set spdAux::info_main_window_text ""
52-
ttk::labelframe $w.info -text " Information " -relief ridge
53-
ttk::label $w.info.text -textvariable spdAux::info_main_window_text
54-
grid $w.info.text
55-
grid $w.info -sticky we
56-
}
57-
}
58-
59-
proc ::PfemLauncher::ChangeAppTo {appid} {
60-
spdAux::deactiveApp PfemLauncher
61-
spdAux::SetSpatialDimmension undefined
62-
apps::setActiveApp $appid
18+
spdAux::CreateLauncherWindow PfemLauncher $available_apps [_ "Pfem applications"] [_ "Select a Pfem application"]
6319
}

kratos.gid/apps/ThermicLauncher/start.tcl

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,5 @@ proc ::ThermicLauncher::Init { app } {
1515
proc ::ThermicLauncher::AppSelectorWindow { } {
1616
variable available_apps
1717

18-
set root [customlib::GetBaseRoot]
19-
set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v]
20-
if { $nd ne "undefined" } {
21-
# if {[apps::getActiveAppId] eq "Fluid"} {
22-
# spdAux::SwitchDimAndCreateWindow $nd
23-
# }
24-
} {
25-
[$root selectNodes "value\[@n='nDim'\]"] setAttribute v wait
26-
27-
set initwind $::spdAux::application_window_id
28-
spdAux::DestroyWindows
29-
spdAux::RegisterWindow $initwind
30-
set w $initwind
31-
32-
InitWindow $w [_ "Thermic applications"] Kratos "" "" 1
33-
set initwind $w
34-
ttk::frame $w.top
35-
ttk::label $w.top.title_text -text [_ "Select a Thermic application"]
36-
37-
ttk::frame $w.applications -relief ridge
38-
set i 0
39-
foreach app $available_apps {
40-
set img [::apps::getImgFrom $app]
41-
set app_publicname [[::apps::getAppById $app] getPublicName]
42-
set but [ttk::button $w.applications.img$app -image $img -command [list ::ThermicLauncher::ChangeAppTo $app] ]
43-
bind $w.applications.img$app <Enter> {::spdAux::PlaceInformationWindowByPath %W applications}
44-
ttk::label $w.applications.text$app -text $app_publicname
45-
grid $w.applications.img$app -column $i -row 0
46-
grid $w.applications.text$app -column $i -row 1
47-
incr i
48-
}
49-
grid $w.top
50-
grid $w.top.title_text
51-
52-
grid $w.applications
53-
54-
# Information panel
55-
set spdAux::info_main_window_text ""
56-
ttk::labelframe $w.info -text " Information " -relief ridge
57-
ttk::label $w.info.text -textvariable spdAux::info_main_window_text
58-
grid $w.info.text
59-
grid $w.info -sticky we
60-
61-
}
62-
}
63-
64-
proc ::ThermicLauncher::ChangeAppTo {appid} {
65-
spdAux::deactiveApp ThermicLauncher
66-
spdAux::SetSpatialDimmension undefined
67-
apps::setActiveApp $appid
18+
spdAux::CreateLauncherWindow ThermicLauncher $available_apps [_ "Thermic applications"] [_ "Select a Thermic application"]
6819
}

kratos.gid/kratos.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ proc Kratos::Event_InitProblemtype { dir } {
111111
set activeapp_dom [spdAux::SetActiveAppFromDOM]
112112
if { $activeapp_dom == "" } {
113113
#open a window to allow the user select the app
114-
after 500 [list spdAux::CreateWindow]
114+
after 500 [list spdAux::CreateInitialApplicationsWindow]
115115
}
116116

117117
}

kratos.gid/scripts/Applications.tcl

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,24 @@ proc apps::getAppById { id } {
7373
return $appR
7474
}
7575

76+
proc apps::appExists {id} {
77+
variable appList
78+
79+
if {[getAppById $id] eq ""} {
80+
return 0
81+
}
82+
83+
set dir [file join $::Kratos::kratos_private(Path) apps $id]
84+
set app_definition_file [file join $dir app.json]
85+
# if the directory does not exist, do not load the app
86+
if {[file exists $dir]} {
87+
if {[file exists $app_definition_file]} {
88+
return 1
89+
}
90+
}
91+
return 0
92+
}
93+
7694
proc apps::NewApp {appid publicname prefix} {
7795
variable appList
7896
set ap [App new $appid]
@@ -305,11 +323,14 @@ oo::class create App {
305323
proc apps::LoadAppProperties {app} {
306324
set dir [file join $::Kratos::kratos_private(Path) apps [$app getName]]
307325
set app_definition_file [file join $dir app.json]
308-
if {[file exists $app_definition_file]} {
309-
set props [Kratos::ReadJsonDict $app_definition_file]
310-
$app setProperties $props
311-
} else {
312-
W "MISSING app.json file for app [$app getName]"
326+
# if the directory does not exist, do not load the app
327+
if {[file exists $dir]} {
328+
if {[file exists $app_definition_file]} {
329+
set props [Kratos::ReadJsonDict $app_definition_file]
330+
$app setProperties $props
331+
} else {
332+
W "MISSING app.json file for app [$app getName]"
333+
}
313334
}
314335
}
315336

kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace eval ::spdAux {
55
set application_window_id .gid.win_app_selection
66
}
77

8-
proc spdAux::CreateWindow {} {
8+
proc spdAux::CreateInitialApplicationsWindow {} {
99
variable initwind
1010
variable must_open_init_window
1111
variable application_window_id
@@ -117,6 +117,65 @@ proc spdAux::CreateWindow {} {
117117
grid $w.info -columnspan 5 -sticky we
118118
}
119119

120+
proc spdAux::CreateLauncherWindow { current_launcher available_apps {window_text "Applications"} {action_text "Select an application"} } {
121+
set initwind $::spdAux::initwind
122+
123+
set root [customlib::GetBaseRoot]
124+
set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v]
125+
if { $nd ne "undefined" } {
126+
127+
} {
128+
[$root selectNodes "value\[@n='nDim'\]"] setAttribute v wait
129+
130+
set initwind $::spdAux::application_window_id
131+
spdAux::DestroyWindows
132+
spdAux::RegisterWindow $initwind
133+
set w $initwind
134+
135+
InitWindow $w $window_text Kratos "" "" 1
136+
set initwind $w
137+
ttk::frame $w.top
138+
ttk::label $w.top.title_text -text $action_text
139+
ttk::frame $w.applications -relief ridge
140+
set i 0
141+
set column 0
142+
set row 0
143+
foreach app $available_apps {
144+
# check if app exists
145+
if {![::apps::appExists $app]} {continue}
146+
set img [::apps::getImgFrom $app]
147+
set app_publicname [[::apps::getAppById $app] getPublicName]
148+
set but [ttk::button $w.applications.img$app -image $img -command [list ::spdAux::ChangeAppTo $current_launcher $app] ]
149+
bind $w.applications.img$app <Enter> {::spdAux::PlaceInformationWindowByPath %W applications}
150+
ttk::label $w.applications.text$app -text $app_publicname
151+
grid $w.applications.img$app -column $column -row $row
152+
grid $w.applications.text$app -column $column -row [expr $row +1]
153+
incr i
154+
incr column
155+
if {$column >= 5} {set column 0; incr row; incr row}
156+
}
157+
grid $w.top
158+
grid $w.top.title_text
159+
160+
grid $w.applications
161+
162+
# Information panel
163+
set spdAux::info_main_window_text ""
164+
ttk::labelframe $w.info -text " Information " -relief ridge
165+
ttk::label $w.info.text -textvariable spdAux::info_main_window_text
166+
grid $w.info.text
167+
grid $w.info -sticky we
168+
}
169+
170+
}
171+
172+
proc spdAux::ChangeAppTo {current_launcher appid} {
173+
spdAux::deactiveApp $current_launcher
174+
spdAux::SetSpatialDimmension undefined
175+
apps::setActiveApp $appid
176+
}
177+
178+
120179
proc spdAux::PlaceInformationWindowByPath {win_path what} {
121180
variable application_window_id
122181
set app_id [string trimleft $win_path $application_window_id.$what.img]

tools/create-release.bat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ set VERSION=9.5.1
55
@REM set BRANCH=Release-%VERSION%
66
@REM git branch %BRANCH%
77
@REM git checkout %BRANCH%
8+
9+
10+
@REM run python prepare-release-files.py
11+
python prepare-release-files.py
12+
813
cd ..
914
mkdir dist
1015
set FOLDER=dist\kratos-%VERSION%

0 commit comments

Comments
 (0)