[Panel-devel] getThemePath broken in SK

Ryan Nickell p0z3r at earthlink.net
Mon Jun 6 00:47:26 CEST 2005


On Mon, 2005-06-06 at 09:09 +1200, Matt wrote:
> On Mon, 06 Jun 2005 08:36, Petri Damsten wrote:
> > On Sunday 05 June 2005 22:35, Matt wrote:
> > > Could you also explain the new readThemeFile function, so I can
> > > understand if it will help me.
> >
> > This code should produce two similar outputs if it's run from non skz
> > themes. Latter should also work from skz theme.
> >
> >     # Reading file (doesn't work with skz themes)
> >     f = open(karamba.getThemePath(widget) + '/maindata.xml')
> >     s = f.read()
> >     f.close()
> >     print s
> >
> >     # This works also in skz themes
> >     s = karamba.readThemeFile(widget, 'maindata.xml')
> >     print s
> >
> > Petri
> 
> I'm not sure that that will help either of my issues.  The codecs.open() 
> function is what I use to be able to use utf-8 encoded translation files.  In 
> the second example, is the new object 's' an unadulterated version of 
> maindata.xml?  If so, I may still be able to manipulate it, to decode it.  
> I'll need to update from svn and test it later today.
You could use the ZipFile class in python to get the data read in as
well.  I'm not sure how this will affect the codecs.open() method that
you are currently using, but here's some example code:
>>> import zipfile
>>> file = zipfile.ZipFile("liquid_weather.skz")
>>> translations = file.read('translations/English')

> 
> In terms of changing to a new 'root' directory in the theme, if you're using 
> an skz file, are all files relative to the .skz file?
> 
Btw, I looked at the os.chdir() you have, and I'm not sure why you chdir
into the theme path to execute 'dcop kxdocker'?
I may be missing something as I only looked over it quickly.

-Ryan



More information about the Panel-devel mailing list