From: Andy T. <an...@ha...> - 2005-04-19 11:01:24
|
Sells, Fred wrote: > I'm cool with that, as long as I'm off the hook for liability, the usual GPL > verbage. Would appreciate a brief credit though. > > -----Original Message----- > From: Schollnick, Benjamin [mailto:Ben...@xe...] > Sent: Monday, April 11, 2005 11:37 AM > To: pyt...@li... > Subject: RE: [Pythoncard-users] newbie, tool to print resource structure > Importance: Low > > > >>But if I did, what I'd probably do is add some code to the "saveFile" >>function in the resourceEditor, so that each time I saved the >>resource >>file, I also saved the equivalent nice, readable version. >> >>I wrote a couple of lines of code to do a very basic version >>of that - >>here's a context diff ... >>(it's the same little code fragment inserted in two places). > > > Very useful.... I would suggest that Kevin consider adding it to the > Resource editor and maybe even expanding on it.... > > Possibly noting any non-default values that have been configured for the > widgets... > > - Ben > > The danger with this approach is that the printer friendly version *could* get out of sync with the resource file. Especially if the resource file is edited outside the resourceEditor. I think the original suggestion is better, just a little routine, something like; >>> resfile = open('<resource file name>') >>> resource = eval(resfile.read()) >>> for background in resource['application']['backgrounds']: >>> for component in background['components']: >>> print "%s: %s %s" % (component['name'], component['type'], component['position']) N.B. it should be a trivial exercise to turn this into a handy documentation function and put it into a module. I'll leave that (and any bug fixes) as an exercise for the reader. Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ |