I like to persist the AUI layout but things like the caption should not be persisted as they are user language dependend and also don't want to have to throw away a layout persist file if I change the caption of something.
Do we need a new style for this?
Currently I use:
PM.PM_SAVE_RESTORE_AUI_PERSPECTIVES
maybe have something like:
PM.PM_SAVE_RESTORE_AUI_LAYOUTONLY_PERSPECTIVES
or
PM.PM_SAVE_RESTORE_AUI_NOCAPTION_PERSPECTIVES
Werner
Hi Werner,
I like to persist the AUI layout but things like the caption should not be
persisted as they are user language dependend and also don't want to have to
throw away a layout persist file if I change the caption of something.
Do we need a new style for this?
Currently I use:
PM.PM_SAVE_RESTORE_AUI_PERSPECTIVES
maybe have something like:
PM.PM_SAVE_RESTORE_AUI_LAYOUTONLY_PERSPECTIVES
or
PM.PM_SAVE_RESTORE_AUI_NOCAPTION_PERSPECTIVES
This is a good idea but a bit complicated to implement: the pane
captions are restored inside the AUI code, and specifically when you
call LoadPerspective to load an existing perspective. It has been
argued in the past (although I can't find the thread right now) that
AUI shouldn't save and restore pane captions as they are
language/translation dependent. But nothing has been done to change
this behaviour, as far as I remember.
There is also a ticket for wxAUI about this:
http://trac.wxwidgets.org/ticket/12528
The only possibility I see at the moment is a convoluted approach in
which the pane captions are always stored in their original (default)
language in the perspective; then, when restoring the perspective, the
appropriate translation is applied for the pane caption. The whole
process requires keeping some kind of dictionary with Name -> Caption
and use that to flip through saving/loading translated captions. It's
a fair bit of work overall and I am not exactly sure I can get it
right...
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
···
On 19 April 2012 15:42, Werner wrote:
Hi Werner,
Hi Andrea,
Hi Werner,
I like to persist the AUI layout but things like the caption should not
be
persisted as they are user language dependend and also don't want to have
to
throw away a layout persist file if I change the caption of something.
Do we need a new style for this?
Currently I use:
PM.PM_SAVE_RESTORE_AUI_PERSPECTIVES
maybe have something like:
PM.PM_SAVE_RESTORE_AUI_LAYOUTONLY_PERSPECTIVES
or
PM.PM_SAVE_RESTORE_AUI_NOCAPTION_PERSPECTIVES
This is a good idea but a bit complicated to implement: the pane
captions are restored inside the AUI code, and specifically when you
call LoadPerspective to load an existing perspective. It has been
argued in the past (although I can't find the thread right now) that
AUI shouldn't save and restore pane captions as they are
language/translation dependent. But nothing has been done to change
this behaviour, as far as I remember.
There is also a ticket for wxAUI about this:
wxTrac has been migrated to GitHub Issues - wxWidgets
The only possibility I see at the moment is a convoluted approach in
which the pane captions are always stored in their original (default)
language in the perspective; then, when restoring the perspective, the
appropriate translation is applied for the pane caption. The whole
process requires keeping some kind of dictionary with Name -> Caption
and use that to flip through saving/loading translated captions. It's
a fair bit of work overall and I am not exactly sure I can get it
right...
It is both I18N/gettext issue and also if you change the caption in the
source code, neither will show up as persist restore brings back the old
one.
What about if persist restore gets the 'current' caption just before doing
the actual restore and then reset it after the restore?
That's a possibility as well, and I believe it will be easier to
implement than my original idea. I don't have a lot of time at the
moment but I'll see what I can do in the near future. Of course, if
you would like to give it a try and implement it yourself, I'll be
more than happy to apply patches (hint hint
).
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
···
On 22 April 2012 12:46, Werner wrote:
On 22/04/2012 12:19, Andrea Gavana wrote:
On 19 April 2012 15:42, Werner wrote:
Hi Andrea,
...
That's a possibility as well, and I believe it will be easier to implement than my original idea. I don't have a lot of time at the moment but I'll see what I can do in the near future. Of course, if you would like to give it a try and implement it yourself, I'll be more than happy to apply patches (hint hint
).
Hint hint has arrived:-) .
Will give it a try over the next few days.
Werner
···
On 23/04/2012 13:49, Andrea Gavana wrote:
Hi Andrea,
....
That's a possibility as well, and I believe it will be easier to
implement than my original idea. I don't have a lot of time at the
moment but I'll see what I can do in the near future. Of course, if
you would like to give it a try and implement it yourself, I'll be
more than happy to apply patches (hint hint
).
Started to have a look at this and first just wanted to see if the replace tactic would work, so no flag yet.
In the attached patch I save the caption loaded from code and then later on restore it. Checking it through the debugger I can see that the correct thing gets restored - BUT on screen I see the data from the persist restore.
I searched but just don't see where else the caption is being reset during the persist restore process.
If you have a tip on where else I should look, please let me know.
Will have another look at it this afternoon.
Werner
frameAUI.patch (851 Bytes)
···
On 23/04/2012 13:49, Andrea Gavana wrote:
I think I got it, mixed up "p" and "pane" when doing the restore.
Now I need to figure out how/where to create the flag and how to pass it around.
- I think the flag should be in persist and it passes it to "framemanager.LoadPerspective". Are you o.k. with that approach?
Werner
···
On 25/04/2012 09:16, Werner wrote:
Hi Andrea,
On 23/04/2012 13:49, Andrea Gavana wrote:
....
That's a possibility as well, and I believe it will be easier to
implement than my original idea. I don't have a lot of time at the
moment but I'll see what I can do in the near future. Of course, if
you would like to give it a try and implement it yourself, I'll be
more than happy to apply patches (hint hint
).
Started to have a look at this and first just wanted to see if the replace tactic would work, so no flag yet.
In the attached patch I save the caption loaded from code and then later on restore it. Checking it through the debugger I can see that the correct thing gets restored - BUT on screen I see the data from the persist restore.
I searched but just don't see where else the caption is being reset during the persist restore process.
If you have a tip on where else I should look, please let me know.
Will have another look at it this afternoon.
Hi Andrea,
...
I think I got it, mixed up "p" and "pane" when doing the restore.
Now I need to figure out how/where to create the flag and how to pass it
around.
- I think the flag should be in persist and it passes it to
"framemanager.LoadPerspective". Are you o.k. with that approach?
Attached a proposed patch. Please review carefully the stuff in persist_handler as I don't really know what I am
doing with extracting/calculating on flags, i.e. would it work when one uses/adds other flags.
I think that would be OK, thank you for your contribution.
It is nothing compared to all the stuff you do for wxPython, so thanks to you;-) .
Werner
restorecodecaption.patch (3.49 KB)
···
On 25/04/2012 13:28, Andrea Gavana wrote: