Skip to content

Commit 5a68690

Browse files
authored
fix: Proxy logic in trame (#165)
* fix if is a list crash (cherry picked from commit 5c739b3) * fix connection to file repr * fix update in inspector
1 parent e752019 commit 5a68690

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

geos-trame/src/geos/trame/app/deck/tree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def update( self, path: str, key: str, value: Any ) -> None:
7777
new_path = [ int( x ) if x.isdigit() else x for x in path.split( "/" ) ]
7878
new_path.append( key )
7979
assert self.input_file is not None and self.input_file.pb_dict is not None
80-
funcy.set_in( self.input_file.pb_dict, new_path, value )
80+
self.input_file.pb_dict = funcy.set_in( self.input_file.pb_dict, new_path, value )
8181

8282
def _search( self, path: str ) -> list | None:
8383
new_path = path.split( "/" )
@@ -286,7 +286,7 @@ def _set_base_model_properties( model: dict, proxy_path: str, properties: dict )
286286

287287
if proxy_name.isnumeric() and int( proxy_name ) < len( model_copy ):
288288
models.append( ( proxy_name, model_copy ) )
289-
model_copy = model_copy[ proxy_name ]
289+
model_copy = model_copy[ int( proxy_name ) if is_list else proxy_name ]
290290
continue
291291

292292
if proxy_name in model_copy:

geos-trame/src/geos/trame/app/ui/inspector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from trame.widgets import vuetify3 as vuetify, html
99
from trame_simput import get_simput_manager
1010

11+
from xsdata.utils import text
12+
1113
from geos.trame.app.data_types.field_status import FieldStatus
1214
from geos.trame.app.data_types.renderable import Renderable
1315
from geos.trame.app.data_types.tree_node import TreeNode
@@ -61,9 +63,9 @@ def _on_change( topic: str, ids: list | None = None ) -> None:
6163
if ids is not None and topic == "changed":
6264
for obj_id in ids:
6365
proxy = self.simput_manager.proxymanager.get( obj_id )
64-
self.tree.decode( obj_id )
66+
#self.tree.decode( obj_id ) # if const function and return not used why ?? to decode context ??
6567
for prop in proxy.edited_property_names:
66-
self.tree.update( obj_id, prop, proxy.get_property( prop ) )
68+
self.tree.update( obj_id, text.camel_case( prop ), proxy.get_property( prop ) )
6769

6870
self.simput_manager.proxymanager.on( _on_change )
6971

0 commit comments

Comments
 (0)