Skip to content
Browse files

Added some comments thoughout the demo for educational purposes.

  • Loading branch information...
1 parent 58bc94a commit 1ab3b3c1c8e1c3c0203b728c25a0e2422efa300d Jonathan Rocher committed Mar 29, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 examples/demo/Advanced/Tabular_editor_demo.py
View
12 examples/demo/Advanced/Tabular_editor_demo.py
@@ -75,14 +75,22 @@ class MarriedPerson(Person):
#-- Tabular Adapter Definition -------------------------------------------------
class ReportAdapter(TabularAdapter):
-
+ """ The tabular adapter interfaces between the tabular editor and the data
+ being displayed. For more details, please refer to the traitsUI user guide.
+ """
+ # List of (Column labels, Column ID).
columns = [ ('Name', 'name'),
('Age', 'age'),
('Address', 'address'),
('Spouse', 'spouse') ]
row_label_name = 'surname'
+ # Interfacing between the model and the view: make some of the cell
+ # attributes a property whose behavior is then controlled by the get
+ # (and optionally set methods). The cell is identified by its column
+ # ID (age, spouse).
+
# Font fails with wx in OSX; see traitsui issue #13:
# font = 'Courier 10'
age_alignment = Constant('right')
@@ -102,6 +110,8 @@ def _get_MarriedPerson_spouse_text(self):
#-- Tabular Editor Definition --------------------------------------------------
+# The tabular editor works in conjunction with an adapter class, derived from
+# TabularAdapter.
tabular_editor = TabularEditor(
adapter = ReportAdapter(),
operations = [ 'move', 'edit' ],

0 comments on commit 1ab3b3c

Please sign in to comment.
Something went wrong with that request. Please try again.