Skip to content

Commit 873f674

Browse files
Minimum gid version for apps
1 parent 514d10f commit 873f674

1 file changed

Lines changed: 30 additions & 29 deletions

File tree

kratos.gid/scripts/Applications.tcl

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace eval ::apps {
77
Kratos::AddNamespace [namespace current]
8-
8+
99
variable activeApp
1010
variable appList
1111
}
@@ -26,7 +26,7 @@ proc apps::ClearActiveApp {} {
2626
proc apps::setActiveApp {appid} {
2727
variable activeApp
2828
variable appList
29-
29+
3030
foreach app $appList {
3131
if {[$app getName] eq $appid} {
3232
set activeApp $app
@@ -101,7 +101,7 @@ proc apps::getAppsList {{also_tools 1}} {
101101
return $list
102102
}
103103
proc apps::getAllApplicationsName {{also_tools 1}} {
104-
104+
105105
set appnames [list ]
106106
foreach app [apps::getAppsList $also_tools] {
107107
lappend appnames [$app getPublicName]
@@ -110,7 +110,7 @@ proc apps::getAllApplicationsName {{also_tools 1}} {
110110
}
111111

112112
proc apps::getAllApplicationsID {{also_tools 1}} {
113-
113+
114114
set appnames [list ]
115115
foreach app [apps::getAppsList $also_tools] {
116116
lappend appnames [$app getName]
@@ -123,7 +123,7 @@ proc apps::getImgFrom { appName {img "logo" } } {
123123
}
124124
proc apps::getImgPathFrom { appName {img "logo" } } {
125125
variable appList
126-
126+
127127
set imagespath ""
128128
foreach app $appList {
129129
if {[$app getName] eq $appName} {set imagespath [expr {$img == "logo" ? [$app getIcon] : [$app getImagePath $img] }]; break}
@@ -155,15 +155,15 @@ proc apps::ExecuteOnCurrentXML { func args} {
155155
proc apps::ExecuteOnAppXML { appid func args} {
156156
set response ""
157157
set app [getAppById $appid]
158-
set response [$app executexml $func {*}$args]
158+
set response [$app executexml $func {*}$args]
159159

160160
return $response
161161
}
162162

163163
proc apps::ExecuteOnApp {appid func args} {
164164
set response ""
165165
set app [getAppById $appid]
166-
set response [$app execute $func {*}$args]
166+
set response [$app execute $func {*}$args]
167167

168168
return $response
169169
}
@@ -193,7 +193,7 @@ proc apps::isPublic {appId} {
193193

194194
proc apps::CheckElemState {elem inputid {arg ""} } {
195195
variable activeApp
196-
196+
197197
return [$activeApp executexml CheckElemState $elem $inputid $arg]
198198
}
199199

@@ -213,7 +213,7 @@ oo::class create App {
213213
variable is_tool
214214

215215
variable properties
216-
216+
217217
constructor {n} {
218218
variable name
219219
variable publicname
@@ -226,7 +226,7 @@ oo::class create App {
226226
variable public
227227
variable is_tool
228228
variable properties
229-
229+
230230
set name $n
231231
set publicname $n
232232
set imagepath [file nativename [file join $::Kratos::kratos_private(Path) apps $n images] ]
@@ -249,28 +249,28 @@ oo::class create App {
249249
set properties [dict create ]
250250
apps::LoadAppProperties [self]
251251
}
252-
252+
253253
method activate { } {apps::ActivateApp_do [self]}
254-
254+
255255
method getPrefix { } {variable prefix; return $prefix}
256256
method setPrefix { p } {variable prefix; set prefix $p}
257-
257+
258258
method getPublicName { } {variable publicname; return $publicname}
259259
method setPublicName { pn } {variable publicname; set publicname $pn}
260-
260+
261261
method getName { } {variable name; return $name}
262-
262+
263263
method getIcon { } {return [my getImagePath logo.png]}
264264
method getImagePath { imgName } {variable imagepath; return [file nativename [file join $imagepath $imgName] ]}
265-
265+
266266
method getWriteModelPartEvent { } {variable writeModelPartEvent; return $writeModelPartEvent}
267-
267+
268268
method getWriteParametersEvent { } {variable writeParametersEvent; return $writeParametersEvent}
269-
269+
270270
method getWriteCustomEvent { } {variable writeCustomEvent; return $writeCustomEvent}
271271

272272
method getValidateWriteEvent { } {variable writeValidateEvent; return $writeValidateEvent}
273-
273+
274274
method executexml { func args } {
275275
variable name
276276
set f ::${name}::xml::${func}
@@ -281,24 +281,24 @@ oo::class create App {
281281
set f ::${name}::${func}
282282
if {[info procs $f] ne ""} {$f {*}$args}
283283
}
284-
284+
285285
method setPublic {v} {variable public; set public $v}
286286
method isPublic { } {variable public; return $public}
287-
287+
288288
method setIsTool {v} {variable is_tool; set is_tool $v}
289289
method isTool { } {variable is_tool; return $is_tool}
290-
290+
291291
method getKratosApplicationName { } {return [::${name}::GetAttribute kratos_name]}
292292

293293
method setProperties {props} {variable properties; set properties $props}
294294
method getProperty {n} {variable properties; if {[dict exists $properties $n]} {return [dict get $properties $n]}}
295295
method getProperties {} {variable properties; return $properties}
296296
method getPermission {n} {variable properties; if {[dict exists $properties permissions $n]} {return [dict get $properties permissions $n]} }
297-
method getPermissions {} {variable properties; return [dict get $properties permissions]}
297+
method getPermissions {} {variable properties; return [dict get $properties permissions]}
298298
method getUniqueName {n} {variable properties; if {[dict exists $properties unique_names $n]} {return [dict get $properties unique_names $n]} }
299-
method getUniqueNames {} {variable properties; return [dict get $properties unique_names}
299+
method getUniqueNames {} {variable properties; return [dict get $properties unique_names}
300300
method getWriteProperty {n} {variable properties; if {[dict exists $properties write $n]} {return [dict get $properties write $n]} }
301-
method getWriteProperties {} {variable properties; return [dict get $properties write}
301+
method getWriteProperties {} {variable properties; return [dict get $properties write}
302302
}
303303

304304
proc apps::LoadAppProperties {app} {
@@ -328,17 +328,18 @@ proc apps::ActivateApp_do {app} {
328328
apps::loadAppFile $fileName
329329
}
330330
}
331-
331+
set app_minimum_gid_version [dict get [$app getProperty requeriments] minimum_gid_version]
332+
if {[GiDVersionCmp $app_minimum_gid_version] < 0} {W "Caution. Minimum GiD version is $app_minimum_gid_version"}
332333
if {[write::isBooleanTrue [$app getPermission import_files]]} { Kratos::LoadImportFiles }
333334
if {[write::isBooleanTrue [$app getPermission wizard]]} { Kratos::LoadWizardFiles }
334335
if {[$app getProperty start_script] ne ""} {eval [$app getProperty start_script] $app}
335336
apps::ApplyAppPreferences $app
336-
337-
337+
338+
338339
if {[gid_themes::GetCurrentTheme] eq "GiD_black"} {
339340
set gid_groups_conds::imagesdirList [lsearch -all -inline -not -exact $gid_groups_conds::imagesdirList [list [file join $dir images]]]
340341
gid_groups_conds::add_images_dir [file join $dir images Black]
341-
}
342+
}
342343
gid_groups_conds::add_images_dir [file join $dir images]
343344
}
344345

0 commit comments

Comments
 (0)