Hello,community !
I am developing wxPython app. (almost done actually)
It works fine on win2k and XP ,but not on win98.
Main trouble - i didn't see my national symbols in XRC dialogs,
with NON UNICODE wxPython.
Firstly, i have used unicode version of wxPython,
but it didn't works properly on win9x.
(crash with TaskBarIcon, and other little and big problems with
events)
Non unicode version works just fine but i can not see
russian symbols in XRCed dialogs.
On top of my.xrc file i've got something like this
<?xml version="1.0" encoding="cp1251"?>
All my labels are written in 1251 codepage.
It works for unicode wxPython.
cp1251 - it's not unicode,right?
So there must be a way...
If i want to use non unicode version (for win9x compatibility)
how can i achieve this?
If dialog is created not from XRC then everything is fine.
(
Of course i've used
import locale
locale.setlocale(locale.LC_ALL,'Russian_Russia.1251')
)
Should i set locale in XML parser?
I've appreciate every hint.
···
---------------------------------------
My environment:
win2k . App going to work with win9x
python 2.2.2
wxPythonWIN32-2.4.0.7-Py22.exe
Hello,community !
I am developing wxPython app. (almost done actually)
It works fine on win2k and XP ,but not on win98.
Main trouble - i didn't see my national symbols in XRC dialogs,
with NON UNICODE wxPython.
Firstly, i have used unicode version of wxPython,
but it didn't works properly on win9x.
(crash with TaskBarIcon, and other little and big problems with
events)
Non unicode version works just fine but i can not see
russian symbols in XRCed dialogs.
On top of my.xrc file i've got something like this
<?xml version="1.0" encoding="cp1251"?>
All my labels are written in 1251 codepage.
It works for unicode wxPython.
cp1251 - it's not unicode,right?
So there must be a way...
If i want to use non unicode version (for win9x compatibility)
how can i achieve this?
If dialog is created not from XRC then everything is fine.
(
Of course i've used
import locale
locale.setlocale(locale.LC_ALL,'Russian_Russia.1251')
)
Should i set locale in XML parser?
You probably need to set the wxLocale too.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Main trouble - i didn't see my national symbols in XRC dialogs,
with NON UNICODE wxPython.
You probably need to set the wxLocale too.
Ok,Robin, i've made my home work.
Here is a small app which demonstrates my problem:
# cut here
# Interesting thread with the same problem.
# Problem didn't solved?
# http://lists.wxwindows.org/archive/wxPython-users/msg16348.html
# XRC and i18n
# Didn't get national charsets in XRC dialogs.
# But XRCed shows them CORRECTLY!
# How can be?
from wxPython.wx import *
from wxPython.xrc import *
import locale
# cut here
test.xrc is attached.
It contains simple panel
---------------------------------------
Name :@@@@@@@@@@@@
Address
(in russian 1251 codepage):@@@@@@@@@@@@
Phone :@@@@@@@@@@@@
----------------------------------------
In my environment program prints :
L.Init successfull
Russian_Russia.1251
ru_RU
ru_RU
wxFONTENCODING_CP1251 = wxLocale_GetSystemEncoding()
---------------------------------------
So, wxLocale is set? right?
I think so.
But WHY i still don't see 'address' label
in my panel ???
btw, last version of XRCEd displays my panel CORRECTLY!
I've checked the source of XRCEd with grep and there no such thing as
wxLocale inside them.
What am i doing wrong?
Please,help me, i'm stuck.
My environment:
win2k,python22,wxPythonWIN32-2.4.1.2-Py23.exe
P.S.
demo.py in new 2.4.1.2 says:
import wx.html
ImportError: No module named html.
I've checked
C:\python22\Lib\site-packages\wx\html.py is there.
What the matter?
Ok,Robin, i've made my home work.
Here is a small app which demonstrates my problem:
sorry, I had zero time to reply to this. It may be the old problem of
using wxXRC_USE_LOCALE flag when creating wxXmlResource. This flag is
on default and tells the system to translate everything from XRC
files (i.e. it expects .xrc files to be in English). Try initializing
it like this:
res = wxXmlResource(0)
It _may_ help, I'm not sure if it is really it. If it doesn't help,
try "windows-1251" instead of "cp1251".
#
from wxPython.wx import *
from wxPython.xrc import *
#----------------------------------------------------------------------
class TestPanel(wxPanel):
def __init__(self, parent):
wxPanel.__init__(self, parent, -1)
res = wxXmlResource('test.xrc',wxXRC_NO_SUBCLASSING)
# ^^^^^^^^^^^^^^^^^^^^^
# That is IMPORTANT!
# if not using this flag everything get screwed up.
# Seems very strange to me, but it works.
# Note that i have not even initialyze wxLocale.
# Anyway it doesn't help.
myapp = MyApp(0)
myapp.MainLoop()
# cut here
I've attached my test.xrc if anyone is curious.
Note, that you should have on top of your XRC file
<?xml version="1.0" encoding="put_you_national_encoding_here"?>
Everything is working now.
And i can use non unicode build of wxPython with no problem.
P.S.
win2000 professional
wxPythonWIN32-2.4.1.2-Py22.exe
python 2.2.2
P.P.S.
Thanks to Robin Dunn for being responsive and helpful.