Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion geos-trame/src/geos/trame/app/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def deck_ui( self ) -> None:
self.deckEditor = DeckEditor(
source=self.tree,
classes="ma-2",
style="flex: 1; height: 100%;",
style="flex: 1; height: 100vh;",
)

with vuetify.VCol(
Expand Down
2 changes: 1 addition & 1 deletion geos-trame/src/geos/trame/app/deck/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def to_xml( obj: BaseModel ) -> str:
attribute_name_generator=text.camel_case,
)

config = SerializerConfig( indent=" ", xml_declaration=False )
config = SerializerConfig( indent=" ", xml_declaration=False, ignore_default_attributes=True )
serializer = XmlSerializer( context=context, config=config )

return format_xml( serializer.render( obj ) )
Expand Down
14 changes: 13 additions & 1 deletion geos-trame/src/geos/trame/app/ui/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,24 @@ def _on_active_id( self, active_id: str | None, **_: Any ) -> None:
self.state.active_type = None
self.state.active_types = []
return


# read from the tree
active_block = self.tree.decode( active_id )

simput_type = type( active_block ).__name__

self.simput_manager.proxymanager.get_instances_of_type( simput_type )
#TODO (Q1) why the return is not used ??
# sim_item = self.simput_manager.proxymanager.get_instances_of_type( simput_type )
#update proxy with decoded data

self.simput_manager.proxymanager.commit_all()
# proxy = self.simput_manager.proxymanager.get(active_id)
# if not proxy:
# return
# for k,v in dict(active_block).items():
# proxy.set_property(k,v)
# proxy.commit()

self.state.active_id = active_id
self.state.active_ids = [ active_id ]
Expand Down
12 changes: 11 additions & 1 deletion geos-trame/src/geos/trame/app/ui/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,26 @@ def _updated_tasks(self, *tasks: Any, **_: Any) -> None:
if not self.tree._search(f'Problem/Events/0/PeriodicEvent/{t["id"]}'):
self.tree.input_file.pb_dict['Problem']['Events'][0]['PeriodicEvent'].append( self.tree.encode_data(PeriodicEvent(name="test")) )

#TODO test if tasks/events added
proxy = self.simput_manager.proxymanager.get(f'Problem/Events/0/PeriodicEvent/{t["id"]}')
self.tree.update(f'Problem/Events/0/PeriodicEvent/{t["id"]}','beginTime', event['begin_time'])
proxy.set_property("begin_time",event['begin_time'])
self.tree.update(f'Problem/Events/0/PeriodicEvent/{t["id"]}','endTime', event['end_time'])
proxy.set_property("end_time",event['end_time'])
self.tree.update(f'Problem/Events/0/PeriodicEvent/{t["id"]}','name', event['name'])
proxy.set_property("name",event['name'])
self.tree.update(f'Problem/Events/0/PeriodicEvent/{t["id"]}','target', self.tree.registered_targets[event['category']])
proxy.set_property("target", self.tree.registered_targets[event['category']] )

if "freq" in t and t["freq"] is not None:
self.tree.update(f'Problem/Events/0/PeriodicEvent/{t["id"]}','timeFrequency', timedelta(days=int(t["freq"])).total_seconds())
proxy.set_property("time_frequency", timedelta(days=int(t["freq"])).total_seconds())

proxy.commit()


rm_list.extend( range(len(self.state.tasks),len(self.tree.input_file.problem.events[0].periodic_event)) )
#remove lost indexes
rm_list.extend( range(len(self.state.tasks),len(self.tree.input_file.problem.events[0].periodic_event)) )
for i in rm_list:
self.tree.drop(f'Problem/Events/0/PeriodicEvent/{i}')

Expand Down
Loading