compatibility with wxpython 2.8

11 views
Skip to first unread message

Peter Maas

unread,
Jan 9, 2010, 5:44:52 AM1/9/10
to rur-ple-discuss
Hi,

I have written some code to make rur-ple work on my ubuntu system
which has wxpython 2.8:

def wxversiontuple():
'''returns wx.version() as a tuple of ints for numeric
comparison of versions.
'''
return tuple(map(int, wx.version().split()[0].split('.')))

# version dependent function keycode to make rur-ple work with
# wxpython 2.6 to latest
if wxversiontuple() < (2, 7, 1, 1):
def keycode(event):
return event.KeyCode()
else:
def keycode(event):
return event.KeyCode

I replaced event.KeyCode with keycode in world_display.py and out-
commented wxversion.select('2.6') in rur_start.py. The speed slider
looks alright and works. I'll play a little with the code to see
whether there
are still issues with 2.8.

Regards, Peter

P.S.: Are there code markup rules available for google groops?
Couldn't find any.

Peter Maas, Aachen, Germany.

Andre Roberge

unread,
Jan 9, 2010, 8:39:01 AM1/9/10
to rur-ple...@googlegroups.com
On Sat, Jan 9, 2010 at 6:44 AM, Peter Maas <fritz.pe...@googlemail.com> wrote:
Hi,

I have written some code to make rur-ple work on my ubuntu system
which has wxpython 2.8:

def wxversiontuple():
   '''returns wx.version() as a tuple of ints for numeric
   comparison of versions.
   '''
   return tuple(map(int, wx.version().split()[0].split('.')))

# version dependent function keycode to make rur-ple work with
# wxpython 2.6 to latest
if wxversiontuple() < (2, 7, 1, 1):
   def keycode(event):
       return event.KeyCode()
else:
   def keycode(event):
       return event.KeyCode


Good idea... I had thought of doing something similar (on my todo list when I go back to rur-ple programming) but I was thinking that I would have to do an if/else everywhere event.keyCode was called.    Of course, your solution is much cleaner.

 
I replaced event.KeyCode with keycode in world_display.py and out-
commented wxversion.select('2.6') in rur_start.py. The speed slider
looks alright and works. I'll play a little with the code to see
whether there
are still issues with 2.8.

Regards, Peter

P.S.: Are there code markup rules available for google groops? 
Couldn't find any.


I've never seen code being marked-up on google groups ... and I've read a lot of them.  So I would venture to guess that there are none.

André
Peter Maas, Aachen, Germany.

Frederic Muller

unread,
Jan 9, 2010, 10:51:49 PM1/9/10
to rur-ple...@googlegroups.com
Morning!

Great and thanks. I've added Peter to the contributor list as he is
maintaining the German translation and fixing bugs... and this way we
can all try out the fixes.

Fred

Andre Roberge wrote:
>
>
> On Sat, Jan 9, 2010 at 6:44 AM, Peter Maas
> <fritz.pe...@googlemail.com

> Andr�
>
> Peter Maas, Aachen, Germany.
>
>

Peter Maas

unread,
Jan 11, 2010, 5:22:06 PM1/11/10
to rur-ple-discuss
On 10 Jan., 04:51, Frederic Muller <f...@beijinglug.org> wrote:
> Great and thanks. I've added Peter to the contributor list as he is
> maintaining the German translation and fixing bugs... and this way we
> can all try out the fixes.

Hi,

I know some versioning programs but I'm not very familiar with SVN.
Guess I should do something like

svn ci rur_start.py rur_py/word_display.py

Is that correct?

Frederic Muller

unread,
Jan 11, 2010, 8:16:09 PM1/11/10
to rur-ple...@googlegroups.com
Hi!

I have to admit that I actually use RapidSVN under Linux and I just
right click and commit. Be careful as I just converted all py files to
utf-8 and modified the lightning.py as a lot of strings were not
internationalized (and therefore not in the po file).

If you don t feel comfortable you can email me the file(s) and I'll do
the necessary changes.

Thanks a lot.

Fred

Peter Maas

unread,
Jan 13, 2010, 6:04:46 PM1/13/10
to rur-ple-discuss
On 12 Jan., 02:16, Frederic Muller <f...@beijinglug.org> wrote:
> I have to admit that I actually use RapidSVN under Linux and I just
> right click and commit.

Hi,

good idea! I have NetBeans installed recently which is a decent IDE
for
Java and Python and has good Subversion support. The code is
committed.
I have put wxversiontuple in misc.py because I could not find a better
place.

> Be careful as I just converted all py files to
> utf-8 and modified the lightning.py as a lot of strings were not
> internationalized (and therefore not in the po file).

I have committed rur_start.py, rur_py/misc.py and rur_py/
world_display.py. I think
Subversion would not allow me to do this if the repository versions
were newer.

Regards, Peter.

Peter Maas, Aachen, Germany.

Frederic Muller

unread,
Jan 14, 2010, 9:55:21 AM1/14/10
to rur-ple...@googlegroups.com
Nice. Didn't have time to test yet but hopefully will be able to this
weekend.

Fred

Frederic Muller

unread,
Jan 14, 2010, 9:51:02 PM1/14/10
to rur-ple...@googlegroups.com
Hi!

I get this error at startup:

Traceback (most recent call last):
File "./rur_start.py", line 38, in <module>
if rur_py.misc.wxversiontuple() < (2,6):
File "/home/fred/apps/rurple/rur-ple/rur_py/misc.py", line 26, in
wxversiontuple


return tuple(map(int, wx.version().split()[0].split('.')))

AttributeError: 'module' object has no attribute 'version'

I'm using 2.6.

Also noticed the � from Andr� in rur_start.py became a <?>, but I doubt
that's the problem ;-)

Any idea?

Thanks.

Fred

Peter Maas

unread,
Jan 15, 2010, 3:18:26 PM1/15/10
to rur-ple-discuss
On 15 Jan., 03:51, Frederic Muller <f...@beijinglug.org> wrote:
> AttributeError: 'module' object has no attribute 'version'
>
> I'm using 2.6.

Hi Fred,

sorry, I was thinking that 2.6 also has a version method. I installed
2.6 additionally, tested under both versions, fixed and committed.
The wx browser uses different fonts in 2.6 and 2.8 by the way.
I wonder how future versions of wxpython will differ. It could be
necessary at some time to raise the lower version limit to avoid
too much testing and version specific code.

> Also noticed the from Andr in rur_start.py became a <?>, but I doubt
> that's the problem ;-)

No, that's because it was still latin-1. I changed it to utf-8.

Frederic Muller

unread,
Jan 15, 2010, 9:04:00 PM1/15/10
to rur-ple...@googlegroups.com
Peter Maas wrote:
> On 15 Jan., 03:51, Frederic Muller <f...@beijinglug.org> wrote:
>
>> AttributeError: 'module' object has no attribute 'version'
>>
>> I'm using 2.6.
>>
>
> Hi Fred,
>
> sorry, I was thinking that 2.6 also has a version method. I installed
> 2.6 additionally, tested under both versions, fixed and committed.
> The wx browser uses different fonts in 2.6 and 2.8 by the way.
> I wonder how future versions of wxpython will differ. It could be
> necessary at some time to raise the lower version limit to avoid
> too much testing and version specific code.
>
Cool, seems all is working now and that it even fixed some other bugs
that were on the list (map loading refresh and world reset, help in
lightning editor).
I think for now we prefer to keep both python and wxpython version as
low as possible. I don't mind doing the QA for each version and each
specific problem. I'll follow up with this on a different thread started
by Andr� a few weeks back.

Thanks a lot.

Fred

Reply all
Reply to author
Forward
0 new messages