|
From: Kevin A. <al...@se...> - 2002-01-25 06:57:56
|
I've updated the dbBrowser, textEditor, and resourceEditor samples in cvs so
that they can load localized dialogs and windows. My earlier message was
misleading, the Background and GenericDialog classes both expect to receive
resources as part of their initialization. When I wrote the message I was
thinking about the PythonCardApp class and the app initialization which is
different. I didn't update textRouter, since it creates its dialogs
dynamically and so the same localization strategy won't work.
Anyway, simply changing the code to use the internationalResourceName
function I already wrote for the backgrounds works fine. You just pass in a
full path instead of just a filename in case the current working directory
has changed since the app was started.
class FindDialog(dialognew.GenericDialog):
def __init__(self, aBg, searchText='', wholeWordsOnly=0,
caseSensitive=0) :
# load the resource
path = os.path.join(aBg.stack.app.applicationDirectory, \
model.internationalResourceName('find'))
aDialogRsrc = res.ResourceFile(path).getResource()
dialognew.GenericDialog.__init__(self, aBg, aDialogRsrc)
I agree with Francois that the resourceEditor should be one of the examples
of a localized PythonCard app. However, it won't be possible to localize the
Property Editor window until I rewrite it. Also, many of the dialogs and
menu items in resourceEditor will be changing quite a bit over the next
month since the resourceEditor is one of the things I want to spend a lot of
time improving. I expect I'll end up changing, adding, and removing dialogs
and menus, but I won't know which ones until I start the modifications.
So, nobody (that's probably you Francois) should put much time into doing a
localized version of the resourceEditor for their language just yet, unless
they want to deal with changes the next few weeks. I don't want anyone
wasting their time without at least knowing it might be wasted. :)
ka
> -----Original Message-----
> From: pyt...@li...
> [mailto:pyt...@li...]On Behalf Of Kevin
> Altis
> Sent: Tuesday, January 22, 2002 11:02 PM
> To: pythoncard-Users
> Subject: [Pythoncard-users] localizing dialogs
>
>
> The dialognew.py module which contains the GenericDialog class
> won't handle
> the same localization solution I used for the Background without
> a change to
> its __init__. This is best illustrated by looking at a fragment of the
> FindDialog class from textEditor.pyw
>
> class FindDialog(dialognew.GenericDialog):
> def __init__(self, aBg, searchText='', wholeWordsOnly=0,
> caseSensitive=0) :
> # load the resource
> path = os.path.join(aBg.stack.app.applicationDirectory,
> 'find.rsrc.py')
> aDialogRsrc = res.ResourceFile(path).getResource()
> dialognew.GenericDialog.__init__(self, aBg, aDialogRsrc)
> ...
>
> As you can see, GenericDialog expects to receive a Resource, not
> a filename.
> I think that I'm going to change the code so that only a string
> is passed to
> the GenericDialog __init__ and then GenericDialog will use
> roughly the same
> algorithm for loading the resource file as the Background class does. The
> __init__ above would become
>
> dialognew.GenericDialog.__init__(self, aBg, 'find')
>
> I'll think about this some more before checking anything in tomorrow.
>
> ka
>
>
> _______________________________________________
> Pythoncard-users mailing list
> Pyt...@li...
> https://lists.sourceforge.net/lists/listinfo/pythoncard-users
>
|