Hi folks!
I’m learning the Adw/Gtk template system, using Python. At this point I have three templates set up. This is in the main application window:
<object class="AdwNavigationView">
<child>
<object class="SpeciesList"/>
</child>
<child>
<object class="SpeciesDetails"/>
</child>
</object>
With the following templates:
<?xml version='1.0' encoding='UTF-8'?>
<interface>
<template class="SpeciesList" parent="AdwNavigationPage">
<property name="title">Species List</property>
<property name="child">
<object class="GtkButton">
<property name="label">Go To Species Details</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="action-name">navigation.push</property>
<property name="action-target">'species-details'</property>
</object>
</property>
</template>
</interface>
<?xml version='1.0' encoding='UTF-8'?>
<interface>
<template class="SpeciesDetails" parent="AdwNavigationPage">
<property name="title">Species Details</property>
<property name="tag">species-details</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<property name="show-end-title-buttons">false</property>
</object>
</child>
<property name="content">
<object class="GtkButton">
<property name="label">Go To Species List</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="action-name">navigation.pop</property>
</object>
</property>
</object>
</property>
</template>
</interface>
I’d like to initialise the SpeciesDetails
object with either an “add” state or “edit” state, with the latter filling out the form before it is displayed to the user.
At this point there’s very little python involved, and I’d like to know the best way to do this.
Many thanks,
J.R.