application development - separating content from function

Chris Liechti cliechti at gmx.net
Thu Jun 20 17:18:01 EDT 2002


"Henry Baumgartl" <h.baumgartl at chello.NOSPAM.nl> wrote in
news:yroQ8.260949$i6.17986369 at amsnews02.chello.com: 

> For eight months now, I am preparing for the development of an open
> source Python application to support individuals in Life Long
> Learning. It will be a mixture of PIM, extended diary, groupware,
> project management, and modules to interact with centralised knowledge
> / skill exchange servers. 
> 
> Most of the user activity is done on individual boxes. However, when
> and if needed, the application must provide intuitive and standardised
> interaction with fellow network members (e.g. project workgroups,
> mentor, and such) and centralised server modules.
> 
> What needs to be done is:
> 1. Develop GUIs and modules that are interchangeable on, at least,
> Linux, Windows, and Mac.

tkinter or wxWindows come to mind, they should run right out of he box 
without special efforts of your side on those platforms, they're portable.

something like the "observer pattern" should help separating GUI and 
problem domain and it make easier to read code.

> 2. Use the modularity of Python to allow personalised application
> adaptation, thus requiring an effective way of integrating personal
> variables into almost all scripts.

the standard module ConfigParser provides .ini style configuaration. this 
is easy to save window positions, user settings in general and much more.

if you need real plugin with dynamic loaded functions and classes:
import+reload, module imp or execfile() can be used to load plugins (.py 
files) at runtime.

in that case you migh define a simple interface like making it mandatory 
for an object to inherit from a special base class and or the file must 
provide an init() function to register itself in the main app.

> 3. And, last but not least ;-) the application needs to be
> multi-lingual. 

start with:
def _(s): return s

and write all the string you want to localize later with 
_("hello")
_("this can be translated later by replacing the _ function")

later you can use locale or a simple dictionary lookup to translate.
i saw that technique in "cplay" http://www.tf.hut.fi/~flu/cplay/

simple with a dict:
translation = {'hello':'ole'}
def _(s):
    	return translation.get(s,s)
 
> The more I have tried to solve these requirements in an elegant and
> efficient manner, the further I seem to stray from anything remotely
> resembling a viable solution. In other words, I can't see the forest
> for the trees anymore.

do one after the other, use small scripts/interactive prompt to test hacks.
maybe use CVS or some other source repository so you can try out things 
without fear as you can go back in time to get the last working version.

> Anyone working on something similar? Or, just plain brilliant in all
> things Python, and ready and willing to point me in the right
> direction and make it all worth while again :-)
> 
> Help!
> 
> Henry Baumgartl
> Dynamic Knowledge Network
> 
> *Please remove .NOSPAM from my e-mail address when abswering me
> directly.* 
> 
> 
> 



-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list