Re: [dev] [wmii]clarifications on python script usage

From: Kris Maglione <maglione.k_AT_gmail.com>
Date: Sun, 30 May 2010 16:12:08 -0400

On Sun, May 30, 2010 at 09:52:35PM +0200, pascal wrote:
>Hi again
>
>I'm using the python script and I wonder if I do it correctly. I copied the
>content of /etc/wmii-hg/python into ~/.wmii-hg and moved wmiirc.py to
>wmiirc_local.py. The thing is it seems the script in /etc/wmii-hg is read first
>because wmii is starting with the default appearance (for less than one second),
>and I get the message "witray: fatal: another system tray is already running",
>probably due to the fact that it's also called from the wmiirc_local.py.
>So I tried to only leave my modifications in the wmiirc_local.py along with the
>import statements, but then some of my modifications aren't effective, for
>example it keeps using xterm in place of urxvtc, and my theme is not applied
>all at once.

I'm getting confused trying to read the above, so I'll just
explain from the begining.

You don't want to copy wmiirc.py to wmiirc_local.py. The whole
point of wmiirc_local.py is that it gets called *in addion to*
wmiirc.py. So if you copy the former to the latter, you just
execute it twice (and therefore you execute witray twice, as
well). The witray error is because, for the moment, witray just
gives up rathe than taking over for another system tray. It may
change in the future.

As for copying files from /etc/wmii-hg, you almost certainly
don't want to do that. Instead, run wmii as ‘wmii -r
python/wmiirc’ and it will run /etc/wmii-hg/python/wmiirc for
you. Any customization you want to do, do in
~/.wmii-hg/wmiirc_local.py or
~/.wmii-hg/plugins/any_filename_you_want.py. Only in the event
that you can't manage your customizations in wmiirc_local.py
should you copy /etc/wmii-hg/python/wmiirc.py to
~/.wmii-hg/wmiirc.py and edit it. But don't copy *any* other
files.

I hope the above wasn't too confusing. If you want an example,
my wmiirc_local.py is attached.

>And then a detail, to get the time displayed in my locale I add these two lines
>in ~/.wmii-hg/wmiirc :
>import locale
>locale.setlocale(locale.LC_ALL, "")
>I wonder if that's the right place to put it, and if it could be included in
>the default configuration?

Why would you want any kind of locale-specific time? Here's what
I do:

@defmonitoR(colors=wmii['focuscolors'], name='time')
def s9time(self):
     return time.strftime('%H:%M:%S %Z')
@defmonitor(interval=60)
def s9date(self):
     return time.strftime('%a, %d %b')

-- 
Kris Maglione
Oh, come *on*.  Revelation was a mushroom dream that belonged in the
Apocrypha.  The New Testament is basically about what happened when
God got religion.
	--Terry Pratchett, alt.fan.pratchett

Received on Sun May 30 2010 - 20:12:08 UTC

This archive was generated by hypermail 2.2.0 : Sun May 30 2010 - 20:24:01 UTC