A User-Defined View: The Front End
Now how do you look at View
in the interface? Once
again, you need to extend COMBookSet
. First,
change its initializer so that it creates a
UserBookSet
instead of a
BookSet
. Second, expose a
method called
getViewData()
that calls the underlying method of
BookSet
. It’s easiest to create and add the
View
with a short chunk of Python script:
from doubletalk.userhooks import MonthlyAccountActivity view = MonthlyAccountActivity('MyCo.Assets.NCA.CurAss.Cash') TheBookSet.addView(v, 'CashBalances')
The Rolls Royce approach would be to build this on the fly after
letting users select view types and parameters from a menu; however,
this means having some sort of configuration dialog for each
View
. At a more basic level, power users writing
their own View
s could write this code themselves
and put it in a start-up script.
Having done this, all you have to do is build a generic form with a
grid. This keeps track of its name and fetches the
View
data (and a description) when asked. The next
section presents a user-defined View
of the
monthly cash balances. See Figure 8.4.
Get Python Programming On Win32 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.