ANN: SpeedMeter Control For wxPython ;-)

Hello Christian,

Yes, me. Not exactly the same but it seems to be a similar reason. I'm

using

python 2.3, wxpython 2.6.1.0 on linux:

Traceback (most recent call last):
  File "SpeedMeterDemo.py", line 890, in ?
    frame = SpeedMeterDemo()
  File "SpeedMeterDemo.py", line 390, in __init__
    self.SpeedWindow6.SetMiddleIcon(icon)
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 1322, in
SetMiddleIcon raise "\nERROR: Invalid Icon Passed To SpeedMeter."

ERROR: Invalid Icon Passed To SpeedMeter.

This comes from the fact that I has some icons called ".ICO" and others
".ico". On Windows, there is no difference between these files, while on
Unix/Linux they are different. So, probably, renaming all the ".ICO" files
to ".ico" files will do the job. I attach a revised version of SpeedMeter
with all the files with ".ico" extension.

Sorry for this, I am clearly not an expert on Unix/Linux.

Thanks to have tried the demo :wink: and please, NG, let me know your
comments/suggestions.

Andrea.

(See attached file: SpeedMeter.zip)

SpeedMeter.zip (24.5 KB)

···

_______________________________________________
Andrea Gavana
Reservoir Engineer
MOGI ? Reservoir Characterization and Modeling Dept.
ENI S.p.A. ? Exploration & Production Division
Via Emilia, 1 ? 20097 San Donato Milanese (MI) ? Italy
Phone: +39 02 520 62972
Fax: +39 02 520 61824
E-mail: andrea.gavana@agip.it
Restyled Internet Site: http://xoomer.virgilio.it/infinity77/
____________________________________________________

Eni S.p.A.
Sede legale in Roma,
Piazzale Enrico Mattei 1, 00144 Roma
Tel. centralino: +39 06598.21
www.eni.it
Capitale sociale € 4.002.934.326 i.v.
Registro Imprese di Roma,
Codice Fiscale 00484960588
Part. IVA 00905811006
R.E.A. Roma n. 756453

Hi Andrea,

···

andrea.gavana@Agip.it wrote:

python 2.3, wxpython 2.6.1.0 on linux:

Traceback (most recent call last):
File "SpeedMeterDemo.py", line 890, in ?
   frame = SpeedMeterDemo()
File "SpeedMeterDemo.py", line 390, in __init__
   self.SpeedWindow6.SetMiddleIcon(icon)
File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 1322, in
SetMiddleIcon raise "\nERROR: Invalid Icon Passed To SpeedMeter."

ERROR: Invalid Icon Passed To SpeedMeter.

This comes from the fact that I has some icons called ".ICO" and others
".ico". On Windows, there is no difference between these files, while on
Unix/Linux they are different. So, probably, renaming all the ".ICO" files
to ".ico" files will do the job. I attach a revised version of SpeedMeter
with all the files with ".ico" extension.

The uppercase letters were the first thing that I thought could be the problem - unfortunately they are not. Any other ideas?

Regards, Christian

Christian Kristukat wrote:

Hi Andrea,

python 2.3, wxpython 2.6.1.0 on linux:

Traceback (most recent call last):
File "SpeedMeterDemo.py", line 890, in ?
   frame = SpeedMeterDemo()
File "SpeedMeterDemo.py", line 390, in __init__
   self.SpeedWindow6.SetMiddleIcon(icon)
File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 1322, in
SetMiddleIcon raise "\nERROR: Invalid Icon Passed To SpeedMeter."

ERROR: Invalid Icon Passed To SpeedMeter.

This comes from the fact that I has some icons called ".ICO" and others
".ico". On Windows, there is no difference between these files, while on
Unix/Linux they are different. So, probably, renaming all the ".ICO" files
to ".ico" files will do the job. I attach a revised version of SpeedMeter
with all the files with ".ico" extension.

The uppercase letters were the first thing that I thought could be the problem - unfortunately they are not. Any other ideas?

I take everything back!
Silly me overlooked that not only the extensions were uppercase! Thanks.
However the control in the lower left corner is not working and there's a bunch of error messages concerning some unicode issues. I'll attach the output.

Regards, Christian

out (3.88 KB)

···

andrea.gavana@Agip.it wrote:

Traceback (most recent call last):
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 240, in OnSize
    self.UpdateDrawing()
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 255, in UpdateDrawing
    self.Draw(dc)
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 747, in Draw
    width, height, dummy, dummy = dc.GetFullTextExtent(strings, tfont)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/_gdi.py", line 3440, in GetFullTextExtent
    return _gdi_.DC_GetFullTextExtent(*args, **kwargs)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb0 in position 2: unexpected code byte

This first one is because the "º" symbol. around line 259 in
SpeedMeterDemo.py change:
ticks = [str(interval) + "°" for interval in intervals]
to
ticks = [str(interval) + "°".decode('iso8859-1') for interval in
intervals]

Traceback (most recent call last):
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 240, in OnSize
    self.UpdateDrawing()
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 255, in UpdateDrawing
    self.Draw(dc)
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 750, in Draw
    width, height, dummy = fancytext.GetFullExtent(strings, dc)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/lib/fancytext.py", line 346, in GetFullExtent
    RenderToRenderer(str, renderer, enclose)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/lib/fancytext.py", line 329, in RenderToRenderer
    p.Parse(str, 1)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/lib/fancytext.py", line 121, in startElement
    getattr(self, method)(attrs)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/lib/fancytext.py", line 230, in start
    self.characterData(code)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/lib/fancytext.py", line 139, in characterData
    width, height, descent, extl = self.dc.GetFullTextExtent(chunk)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/_gdi.py", line 3440, in GetFullTextExtent
    return _gdi_.DC_GetFullTextExtent(*args, **kwargs)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf0 in position 0: unexpected end of data
Traceback (most recent call last):
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 240, in OnSize
    self.UpdateDrawing()
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 255, in UpdateDrawing
    self.Draw(dc)
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 747, in Draw
    width, height, dummy, dummy = dc.GetFullTextExtent(strings, tfont)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/_gdi.py", line 3440, in GetFullTextExtent
    return _gdi_.DC_GetFullTextExtent(*args, **kwargs)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb0 in position 2: unexpected code byte
Traceback (most recent call last):
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 240, in OnSize
    self.UpdateDrawing()
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 255, in UpdateDrawing
    self.Draw(dc)
  File "/home/ck/testarea/SpeedMeter/SpeedMeter.py", line 750, in Draw
    width, height, dummy = fancytext.GetFullExtent(strings, dc)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/lib/fancytext.py", line 346, in GetFullExtent
    RenderToRenderer(str, renderer, enclose)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/lib/fancytext.py", line 329, in RenderToRenderer
    p.Parse(str, 1)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/lib/fancytext.py", line 121, in startElement
    getattr(self, method)(attrs)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/lib/fancytext.py", line 230, in start
    self.characterData(code)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/lib/fancytext.py", line 139, in characterData
    width, height, descent, extl = self.dc.GetFullTextExtent(chunk)
  File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/_gdi.py", line 3440, in GetFullTextExtent
    return _gdi_.DC_GetFullTextExtent(*args, **kwargs)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf0 in position 0: unexpected end of data

This one is because the pi symbol.
A simple hack to avoid this one is to change around line 365 in
SpeedMeterDemo.py this:
ticks = ["0", "<pi/>/6", "sq(<pi/>)", "2<pi/>/3", "<pi/><sup>2</sup>/4",
"<pi/>", "7<pi/>/6", "4<pi/>/3"]

to this:

ticks = ["0", "pi/6", "sq(pi)", "2pi/3", "pi<sup>2</sup>/4", "pi",
"7pi/6", "4pi/3"]

Ricardo

···

On Mon, 2005-09-26 at 17:25 +0200, Christian Kristukat wrote:

I Andrea,
you can forget those changes I suggest and do this one instead.
If you put this line in the beginning of SpeedMeterDemo.py it works on linux.
Try on Windows but I suppose it will work too.

wx.SetDefaultPyEncoding('iso8859-1')

Ricardo

···

On Sun, 2005-10-09 at 15:28 +0200, Andrea Gavana wrote:

Hello NG,

    I went back from holydays yesterday (what a great country is Canada
:wink: ), and I read your messages about SpeedMeter. Thanks to everyone that
has tried the demo and the control, I really appreciate your comments.
Regarding the last mail from Ricardo Pedroso: