TaoLib

Check-in [fefc17544c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Pulling several changes from the clay branch that had snuck into the workings of IRM
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:fefc17544c6d5baf4f52593f28418b95f2c877d5
User & Date: hypnotoad 2018-11-13 19:32:31
Context
2018-11-15
20:46
Removing mac workaround for comboboxes check-in: acc8ee1ca3 user: hypnotoad tags: trunk
2018-11-13
19:32
Pulling several changes from the clay branch that had snuck into the workings of IRM check-in: fefc17544c user: hypnotoad tags: trunk
2018-09-27
19:28
Fix to the taotk-form loader check-in: f9ebb12547 user: hypnotoad tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/tao-onion/onion.tcl.

1



















2
3
4
5
6
7
8
.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29




30
31
32
33
34
35
36
37
38
39
40
41
...
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
...
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
package require tao 9.7



















###
# topic: 0f30d28a31ce88dfb36ca1c12b454087
# description:
#    This class is a template for objects that will be managed
#    by an onion class
###
tao::define tao::layer {
................................................................................
  aliases tao.layer
  option prefix {}
  option layer_name {}
  property layer_index_order 0

  constructor {sharedobjects args} {
    foreach {organ object} $sharedobjects {
      my graft $organ $object
    }
    my graft layer [self]
    set dictargs [::oo::meta::args_to_options {*}$args]
    set dat [my Config_merge $dictargs]
    my Config_triggers $dat
  }

  ###
  # topic: ce2844831edfd3d32b7e1044690e978a
  # description: Action to perform when layer is mapped visible
  ###
  method initialize {} {
  }





  ###
  # topic: 88c79c0e9188a477f535b66b01631961
  ###
  method node_is_managed unit {
    return 0
  }

  ###
  # topic: 8cc75f590cfad54a22ff0c454c90561c
  ###
  method type_is_managed unit {
................................................................................
        set class  [dict get $info class]
        set layer_obj [my SubObject layer $lname]
        dict set layers $lname $layer_obj
        if {[info command $layer_obj] == {} } {
          $class create $layer_obj $shared [dict merge $info [list prefix $prefix layer_name $lname]]
          set created 1
          foreach {organ object} $shared {
            $layer_obj graft $organ $object
          }
        } else {
          foreach {organ object} $shared {
            $layer_obj graft $organ $object
          }
          $layer_obj morph $class
        }
        ::ladd result $layer_obj
        $layer_obj event subscribe [self] *
        $layer_obj initialize
      }
................................................................................
    my lock remove configure
  }

  ###
  # topic: d800511c8a288ee9b935135e56c91a65
  ###
  method layer {item args} {
    set scan [scan $item "%1s%d" class objid]
    switch $scan {
      2 {
        # Search by class/objid
        if { $class eq "y"} {
          foreach {layer obj} [my layers] {
            if { [$obj type_is_managed $item] } {
              if {[llength $args]} {
                return [$obj {*}$args]
              }
              return $obj
            }
          }
        } else {
          # Search my node if we have a prefix/number
          foreach {layer obj} [my layers] {
            if { [$obj node_is_managed $item] } {
              if {[llength $args]} {
                return [$obj {*}$args]
              }
              return $obj
            }
          }
        }
................................................................................

  ###
  # topic: 96201b2abf6901f5750499e903be1351
  ###
  method Shared_Organs {} {
    dict set shared master [self]
    foreach organ [my meta cget shared_organs] {
      set obj [my organ $organ]
      if { $obj ne {} } {
        dict set shared $organ $obj
      }
    }
    return $shared
  }


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|













>
>
>
>




|







 







|



|







 







|
|
|













|







 







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
...
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
...
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
package require tao 9.7

proc ::tao::unit_parse {item typevar idvar} {
  upvar 1 $idvar id $typevar type
  if {[string is integer -strict $item]} {
    set id $item
    return 2
  }
  foreach unitpattern {
   "%1s%d"
   "%2s%d"
   "%3s%d"
  } {
    if {[scan $item $unitpattern type id] == 2} {
      return 1
    }
  }
  return 0
}

###
# topic: 0f30d28a31ce88dfb36ca1c12b454087
# description:
#    This class is a template for objects that will be managed
#    by an onion class
###
tao::define tao::layer {
................................................................................
  aliases tao.layer
  option prefix {}
  option layer_name {}
  property layer_index_order 0

  constructor {sharedobjects args} {
    foreach {organ object} $sharedobjects {
      my clay delegate $organ $object
    }
    my graft layer [self]
    set dictargs [::oo::meta::args_to_options {*}$args]
    set dat [my Config_merge $dictargs]
    my Config_triggers $dat
  }

  ###
  # topic: ce2844831edfd3d32b7e1044690e978a
  # description: Action to perform when layer is mapped visible
  ###
  method initialize {} {
  }

  method node_is_managed unit {
    return 0
  }

  ###
  # topic: 88c79c0e9188a477f535b66b01631961
  ###
  method object_is_managed {class objid} {
    return 0
  }

  ###
  # topic: 8cc75f590cfad54a22ff0c454c90561c
  ###
  method type_is_managed unit {
................................................................................
        set class  [dict get $info class]
        set layer_obj [my SubObject layer $lname]
        dict set layers $lname $layer_obj
        if {[info command $layer_obj] == {} } {
          $class create $layer_obj $shared [dict merge $info [list prefix $prefix layer_name $lname]]
          set created 1
          foreach {organ object} $shared {
            $layer_obj clay delegate $organ $object
          }
        } else {
          foreach {organ object} $shared {
            $layer_obj clay delegate $organ $object
          }
          $layer_obj morph $class
        }
        ::ladd result $layer_obj
        $layer_obj event subscribe [self] *
        $layer_obj initialize
      }
................................................................................
    my lock remove configure
  }

  ###
  # topic: d800511c8a288ee9b935135e56c91a65
  ###
  method layer {item args} {
    set scan [::tao::unit_parse $item class objid]
    switch $scan {
      1 {
        # Search by class/objid
        if { $class eq "y"} {
          foreach {layer obj} [my layers] {
            if { [$obj type_is_managed $item] } {
              if {[llength $args]} {
                return [$obj {*}$args]
              }
              return $obj
            }
          }
        } else {
          # Search my node if we have a prefix/number
          foreach {layer obj} [my layers] {
            if { [$obj object_is_managed $class $objid] } {
              if {[llength $args]} {
                return [$obj {*}$args]
              }
              return $obj
            }
          }
        }
................................................................................

  ###
  # topic: 96201b2abf6901f5750499e903be1351
  ###
  method Shared_Organs {} {
    dict set shared master [self]
    foreach organ [my meta cget shared_organs] {
      set obj [my clay delegate $organ]
      if { $obj ne {} } {
        dict set shared $organ $obj
      }
    }
    return $shared
  }

Changes to modules/tool-ui/build/select.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
...
156
157
158
159
160
161
162






163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182

::tool::ui::datatype register select {
  meta set is claim: {[dict getnull $info values-format] eq "list"}
  option values {}
  option cache-values {type: boolean default: 1}
  
  option state {
    widget select
    values {normal readonly disabled}
    default readonly
  }

  method datatype_inferences {options} {
................................................................................
      }
    }
    if { $w > 30} {
      set w 30
    }
    return $w
  }
  
  method Description {} {
    set text [my cget description]
    set thisline {}
    set values [my CalculateValues]
    set format [my cget values-format]
    append text \n "Possible Values:"
    foreach value [my CalculateValues] {
................................................................................
::tool::ui::datatype register select_keyvalue {
  superclass select

  option accept_number {
    datatype boolean
    default 1
  }
  
  method CalculateValues {} {
    set values [my GetConfigValueList]
    set result {}
    foreach {key value} $values {
      lappend result $key
    }
    return $result
................................................................................
    set text [my cget description]
    append text \n "Possible Values:"
    foreach {key value} [my GetConfigValueList] {
      append text \n " * $key - $value"
    }
    return $text
  }
  
  method Value_Export rawvalue {
    set values [my GetConfigValueList]
    foreach {var val} $values {
      if {$rawvalue eq $val} {
        return $val
      }
      if {$rawvalue eq $var} {
................................................................................
  aliases enum
  superclass select
  meta branchset is {
    number:  1
    integer: 1
    real:    0
  }







  option enum {
    default {}
  }

  method CalculateValues {} {
    set values {}
    foreach {id code comment} [my GetConfigValueList] {
      lappend values "$id - $code $comment"
    }
    return $values
  }
  
  method Description {} {
    set text [my cget description]
    append text \n "Possible Values:"
    foreach {id code comment} [my GetConfigValueList] {
      append text \n " * $id - ($code) $comment"
    }
    return $text





|







 







|







 







|







 







|







 







>
>
>
>
>
>












|







1
2
3
4
5
6
7
8
9
10
11
12
13
..
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188

::tool::ui::datatype register select {
  meta set is claim: {[dict getnull $info values-format] eq "list"}
  option values {}
  option cache-values {type: boolean default: 1}

  option state {
    widget select
    values {normal readonly disabled}
    default readonly
  }

  method datatype_inferences {options} {
................................................................................
      }
    }
    if { $w > 30} {
      set w 30
    }
    return $w
  }

  method Description {} {
    set text [my cget description]
    set thisline {}
    set values [my CalculateValues]
    set format [my cget values-format]
    append text \n "Possible Values:"
    foreach value [my CalculateValues] {
................................................................................
::tool::ui::datatype register select_keyvalue {
  superclass select

  option accept_number {
    datatype boolean
    default 1
  }

  method CalculateValues {} {
    set values [my GetConfigValueList]
    set result {}
    foreach {key value} $values {
      lappend result $key
    }
    return $result
................................................................................
    set text [my cget description]
    append text \n "Possible Values:"
    foreach {key value} [my GetConfigValueList] {
      append text \n " * $key - $value"
    }
    return $text
  }

  method Value_Export rawvalue {
    set values [my GetConfigValueList]
    foreach {var val} $values {
      if {$rawvalue eq $val} {
        return $val
      }
      if {$rawvalue eq $var} {
................................................................................
  aliases enum
  superclass select
  meta branchset is {
    number:  1
    integer: 1
    real:    0
  }

  option state {
    widget select
    values {normal readonly disabled}
    default readonly
  }

  option enum {
    default {}
  }

  method CalculateValues {} {
    set values {}
    foreach {id code comment} [my GetConfigValueList] {
      lappend values "$id - $code $comment"
    }
    return $values
  }

  method Description {} {
    set text [my cget description]
    append text \n "Possible Values:"
    foreach {id code comment} [my GetConfigValueList] {
      append text \n " * $id - ($code) $comment"
    }
    return $text