Re: Pipe in FlexInset Names

2012-12-13 Thread Andrew Parsloe

On 12/12/2012 11:02 a.m., Jean-Marc Lasgouttes wrote:

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could
you give an example of the usefulness of this trick?

JMarc



I've created a system (to be launched on the world 'soon') where python 
scripts can be launched from within LyX using the converter mechanism, 
but more conveniently. You insert a custom inset from the Insert  
Custom Insets list. The inset name visible to the user might be, say, 
'calculate formula'. The part of the name after the pipe symbol and 
invisible to the user is the name of the python script (perhaps 
calcul8.py) that does the calculating. In LyX format in a document it 
produces the line '\begin_inset Flex:calculate formula|calcul8'. A 
master script scanning the document can thus find which specific script 
to call to perform the desired action from the name alone, rather than 
having to keep a separate dictionary associating inset names with script 
names (which is how I did things before).


Andrew


Re: Pipe in FlexInset Names

2012-12-13 Thread Andrew Parsloe



On 12/12/2012 5:10 p.m., Richard Heck wrote:

On 12/11/2012 05:02 PM, Jean-Marc Lasgouttes wrote:

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could
you give an example of the usefulness of this trick?


And I am sure we can find some way legitimately to provide the same
functionality in 2.1, which may not be insanely far away now.

rh



Good. I look forward to it.

Andrew


Re: Pipe in FlexInset Names

2012-12-13 Thread Andrew Parsloe

On 12/12/2012 11:02 a.m., Jean-Marc Lasgouttes wrote:

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could
you give an example of the usefulness of this trick?

JMarc



I've created a system (to be launched on the world 'soon') where python 
scripts can be launched from within LyX using the converter mechanism, 
but more conveniently. You insert a custom inset from the Insert  
Custom Insets list. The inset name visible to the user might be, say, 
'calculate formula'. The part of the name after the pipe symbol and 
invisible to the user is the name of the python script (perhaps 
calcul8.py) that does the calculating. In LyX format in a document it 
produces the line '\begin_inset Flex:calculate formula|calcul8'. A 
master script scanning the document can thus find which specific script 
to call to perform the desired action from the name alone, rather than 
having to keep a separate dictionary associating inset names with script 
names (which is how I did things before).


Andrew


Re: Pipe in FlexInset Names

2012-12-13 Thread Andrew Parsloe



On 12/12/2012 5:10 p.m., Richard Heck wrote:

On 12/11/2012 05:02 PM, Jean-Marc Lasgouttes wrote:

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could
you give an example of the usefulness of this trick?


And I am sure we can find some way legitimately to provide the same
functionality in 2.1, which may not be insanely far away now.

rh



Good. I look forward to it.

Andrew


Re: Pipe in FlexInset Names

2012-12-13 Thread Andrew Parsloe

On 12/12/2012 11:02 a.m., Jean-Marc Lasgouttes wrote:

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could
you give an example of the usefulness of this "trick"?

JMarc



I've created a system (to be launched on the world 'soon') where python 
scripts can be launched from within LyX using the converter mechanism, 
but more conveniently. You insert a custom inset from the Insert > 
Custom Insets list. The inset name visible to the user might be, say, 
'calculate formula'. The part of the name after the pipe symbol and 
invisible to the user is the name of the python script (perhaps 
calcul8.py) that does the calculating. In LyX format in a document it 
produces the line '\begin_inset Flex:calculate formula|calcul8'. A 
master script scanning the document can thus find which specific script 
to call to perform the desired action from the name alone, rather than 
having to keep a separate dictionary associating inset names with script 
names (which is how I did things before).


Andrew


Re: Pipe in FlexInset Names

2012-12-13 Thread Andrew Parsloe



On 12/12/2012 5:10 p.m., Richard Heck wrote:

On 12/11/2012 05:02 PM, Jean-Marc Lasgouttes wrote:

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could
you give an example of the usefulness of this "trick"?


And I am sure we can find some way legitimately to provide the same
functionality in 2.1, which may not be insanely far away now.

rh



Good. I look forward to it.

Andrew


Re: Pipe in FlexInset Names

2012-12-12 Thread Jean-Marc Lasgouttes

Le 12/12/2012 05:10, Richard Heck a écrit :

And I am sure we can find some way legitimately to provide the same
functionality in 2.1, which may not be insanely far away now.


We still do not know what the real functionality is :)

JMarc



Re: Pipe in FlexInset Names

2012-12-12 Thread Jean-Marc Lasgouttes

Le 12/12/2012 05:10, Richard Heck a écrit :

And I am sure we can find some way legitimately to provide the same
functionality in 2.1, which may not be insanely far away now.


We still do not know what the real functionality is :)

JMarc



Re: Pipe in FlexInset Names

2012-12-12 Thread Jean-Marc Lasgouttes

Le 12/12/2012 05:10, Richard Heck a écrit :

And I am sure we can find some way legitimately to provide the same
functionality in 2.1, which may not be insanely far away now.


We still do not know what the real functionality is :)

JMarc



Re: Pipe in FlexInset Names

2012-12-11 Thread Andrew Parsloe

On 11/12/2012 5:23 a.m., Richard Heck wrote:

On 12/08/2012 04:17 AM, Andrew Parsloe wrote:

(1) If an inset name contains a vertical bar, |, the part after the
bar is not shown in the Insert  Custom Insets list, but is retained
in LyX format. Using the schema, inset definition = Custom Insets
list = LyX file format,

InsetLayout Flex:foo|bah = foo = \begin_inset Flex foo|bah

(This works also with quotes around inset names containing spaces.)
This is surprisingly useful, but doesn't seem to be documented in the
Customization manual. It allows information, which doesn't need to be
shown to the user, to be passed in the name of the inset from the
module in which it is defined to LyX. I've used this 'to serious
purpose' and without ill effect so far, but would like to be sure,
given the lack of documentation, that it is not going to snag on some
other feature of LyX.


The | character is used in Qt4 to specify menu shortcuts. See e.g. the
stdmenus.inc file. So whatever follows it is being interpreted as an
attempt to specify a menu shortcut. So I'd not recommend using it this
way, but I'm not sure what we should do about it. At least, we should
put something into the documentation.

...


Richard

Thanks for the responses to this and my other custom inset queries 
Richard. I've put in a bug report about ResetsFont in custom insets. I'm 
going to continue to use the pipe symbol for its unintended purpose -- 
I've yet to see any deleterious side-effects and some deliberate 
trying-to-break-it experimenting suggests Qt4 is fairly robust in the 
way it handles inappropriate shortcut suggestions.


Andrew


Re: Pipe in FlexInset Names

2012-12-11 Thread Jean-Marc Lasgouttes

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could 
you give an example of the usefulness of this trick?


JMarc



Re: Pipe in FlexInset Names

2012-12-11 Thread Richard Heck

On 12/11/2012 05:02 PM, Jean-Marc Lasgouttes wrote:

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could 
you give an example of the usefulness of this trick?


And I am sure we can find some way legitimately to provide the same 
functionality in 2.1, which may not be insanely far away now.


rh



Re: Pipe in FlexInset Names

2012-12-11 Thread Andrew Parsloe

On 11/12/2012 5:23 a.m., Richard Heck wrote:

On 12/08/2012 04:17 AM, Andrew Parsloe wrote:

(1) If an inset name contains a vertical bar, |, the part after the
bar is not shown in the Insert  Custom Insets list, but is retained
in LyX format. Using the schema, inset definition = Custom Insets
list = LyX file format,

InsetLayout Flex:foo|bah = foo = \begin_inset Flex foo|bah

(This works also with quotes around inset names containing spaces.)
This is surprisingly useful, but doesn't seem to be documented in the
Customization manual. It allows information, which doesn't need to be
shown to the user, to be passed in the name of the inset from the
module in which it is defined to LyX. I've used this 'to serious
purpose' and without ill effect so far, but would like to be sure,
given the lack of documentation, that it is not going to snag on some
other feature of LyX.


The | character is used in Qt4 to specify menu shortcuts. See e.g. the
stdmenus.inc file. So whatever follows it is being interpreted as an
attempt to specify a menu shortcut. So I'd not recommend using it this
way, but I'm not sure what we should do about it. At least, we should
put something into the documentation.

...


Richard

Thanks for the responses to this and my other custom inset queries 
Richard. I've put in a bug report about ResetsFont in custom insets. I'm 
going to continue to use the pipe symbol for its unintended purpose -- 
I've yet to see any deleterious side-effects and some deliberate 
trying-to-break-it experimenting suggests Qt4 is fairly robust in the 
way it handles inappropriate shortcut suggestions.


Andrew


Re: Pipe in FlexInset Names

2012-12-11 Thread Jean-Marc Lasgouttes

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could 
you give an example of the usefulness of this trick?


JMarc



Re: Pipe in FlexInset Names

2012-12-11 Thread Richard Heck

On 12/11/2012 05:02 PM, Jean-Marc Lasgouttes wrote:

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could 
you give an example of the usefulness of this trick?


And I am sure we can find some way legitimately to provide the same 
functionality in 2.1, which may not be insanely far away now.


rh



Re: Pipe in FlexInset Names

2012-12-11 Thread Andrew Parsloe

On 11/12/2012 5:23 a.m., Richard Heck wrote:

On 12/08/2012 04:17 AM, Andrew Parsloe wrote:

(1) If an inset name contains a vertical bar, |, the part after the
bar is not shown in the Insert > Custom Insets list, but is retained
in LyX format. Using the schema, inset definition => Custom Insets
list => LyX file format,

InsetLayout Flex:foo|bah => foo => \begin_inset Flex foo|bah

(This works also with quotes around inset names containing spaces.)
This is surprisingly useful, but doesn't seem to be documented in the
Customization manual. It allows information, which doesn't need to be
shown to the user, to be passed in the name of the inset from the
module in which it is defined to LyX. I've used this 'to serious
purpose' and without ill effect so far, but would like to be sure,
given the lack of documentation, that it is not going to snag on some
other feature of LyX.


The | character is used in Qt4 to specify menu shortcuts. See e.g. the
stdmenus.inc file. So whatever follows it is being interpreted as an
attempt to specify a menu shortcut. So I'd not recommend using it this
way, but I'm not sure what we should do about it. At least, we should
put something into the documentation.

...


Richard

Thanks for the responses to this and my other custom inset queries 
Richard. I've put in a bug report about ResetsFont in custom insets. I'm 
going to continue to use the pipe symbol for its unintended purpose -- 
I've yet to see any deleterious side-effects and some deliberate 
trying-to-break-it experimenting suggests Qt4 is fairly robust in the 
way it handles inappropriate shortcut suggestions.


Andrew


Re: Pipe in FlexInset Names

2012-12-11 Thread Jean-Marc Lasgouttes

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could 
you give an example of the usefulness of this "trick"?


JMarc



Re: Pipe in FlexInset Names

2012-12-11 Thread Richard Heck

On 12/11/2012 05:02 PM, Jean-Marc Lasgouttes wrote:

Le 11/12/12 23:00, Andrew Parsloe a écrit :

Thanks for the responses to this and my other custom inset queries
Richard. I've put in a bug report about ResetsFont in custom insets. I'm
going to continue to use the pipe symbol for its unintended purpose --
I've yet to see any deleterious side-effects and some deliberate
trying-to-break-it experimenting suggests Qt4 is fairly robust in the
way it handles inappropriate shortcut suggestions.


If you are ready to have your layout broken one day this is OK. Could 
you give an example of the usefulness of this "trick"?


And I am sure we can find some way legitimately to provide the same 
functionality in 2.1, which may not be insanely far away now.


rh



Pipe in FlexInset Names

2012-12-10 Thread Richard Heck

On 12/08/2012 04:17 AM, Andrew Parsloe wrote:
(1) If an inset name contains a vertical bar, |, the part after the 
bar is not shown in the Insert  Custom Insets list, but is retained 
in LyX format. Using the schema, inset definition = Custom Insets 
list = LyX file format,


InsetLayout Flex:foo|bah = foo = \begin_inset Flex foo|bah

(This works also with quotes around inset names containing spaces.) 
This is surprisingly useful, but doesn't seem to be documented in the 
Customization manual. It allows information, which doesn't need to be 
shown to the user, to be passed in the name of the inset from the 
module in which it is defined to LyX. I've used this 'to serious 
purpose' and without ill effect so far, but would like to be sure, 
given the lack of documentation, that it is not going to snag on some 
other feature of LyX.


The | character is used in Qt4 to specify menu shortcuts. See e.g. the 
stdmenus.inc file. So whatever follows it is being interpreted as an 
attempt to specify a menu shortcut. So I'd not recommend using it this 
way, but I'm not sure what we should do about it. At least, we should 
put something into the documentation.


(2) Quotes are needed if a custom inset name has a space. I noticed 
that if the space is deleted but the quotes retained, not only does 
the inset disappear from the Custom Insets list (it's replaced by a 
blank line), but in LyX format it becomes undefined:


InsetLayout Flex:foobah =  = \begin_inset Flex undefined

The natural behaviour seems to me for the quotes to have no effect 
when there's no space in the name. This feels like a bug.


This is a bug in the layout2layout conversion routine. Quoted names that 
do not contain spaces were wrongly being detected as unquoted names. 
I've fixed it. Since this is just in the layout2layout.py script, you 
can fix the bug in your own installation by applying 24dea042c.



(3) Underscores in inset names:

InsetLayout Flex:foo_bah = foo bah = \begin_inset Flex foo bah

Although the underscore is replaced by a space in the middle  right 
columns, using quotes around the name again produces invisibility in 
the Custom Insets list and an undefined inset in LyX file format. 
Again I can't see any documentation about underscores in the 
Customization manual.



Same bug.

Richard




Pipe in FlexInset Names

2012-12-10 Thread Richard Heck

On 12/08/2012 04:17 AM, Andrew Parsloe wrote:
(1) If an inset name contains a vertical bar, |, the part after the 
bar is not shown in the Insert  Custom Insets list, but is retained 
in LyX format. Using the schema, inset definition = Custom Insets 
list = LyX file format,


InsetLayout Flex:foo|bah = foo = \begin_inset Flex foo|bah

(This works also with quotes around inset names containing spaces.) 
This is surprisingly useful, but doesn't seem to be documented in the 
Customization manual. It allows information, which doesn't need to be 
shown to the user, to be passed in the name of the inset from the 
module in which it is defined to LyX. I've used this 'to serious 
purpose' and without ill effect so far, but would like to be sure, 
given the lack of documentation, that it is not going to snag on some 
other feature of LyX.


The | character is used in Qt4 to specify menu shortcuts. See e.g. the 
stdmenus.inc file. So whatever follows it is being interpreted as an 
attempt to specify a menu shortcut. So I'd not recommend using it this 
way, but I'm not sure what we should do about it. At least, we should 
put something into the documentation.


(2) Quotes are needed if a custom inset name has a space. I noticed 
that if the space is deleted but the quotes retained, not only does 
the inset disappear from the Custom Insets list (it's replaced by a 
blank line), but in LyX format it becomes undefined:


InsetLayout Flex:foobah =  = \begin_inset Flex undefined

The natural behaviour seems to me for the quotes to have no effect 
when there's no space in the name. This feels like a bug.


This is a bug in the layout2layout conversion routine. Quoted names that 
do not contain spaces were wrongly being detected as unquoted names. 
I've fixed it. Since this is just in the layout2layout.py script, you 
can fix the bug in your own installation by applying 24dea042c.



(3) Underscores in inset names:

InsetLayout Flex:foo_bah = foo bah = \begin_inset Flex foo bah

Although the underscore is replaced by a space in the middle  right 
columns, using quotes around the name again produces invisibility in 
the Custom Insets list and an undefined inset in LyX file format. 
Again I can't see any documentation about underscores in the 
Customization manual.



Same bug.

Richard




Pipe in FlexInset Names

2012-12-10 Thread Richard Heck

On 12/08/2012 04:17 AM, Andrew Parsloe wrote:
(1) If an inset name contains a vertical bar, |, the part after the 
bar is not shown in the Insert > Custom Insets list, but is retained 
in LyX format. Using the schema, inset definition => Custom Insets 
list => LyX file format,


InsetLayout Flex:foo|bah => foo => \begin_inset Flex foo|bah

(This works also with quotes around inset names containing spaces.) 
This is surprisingly useful, but doesn't seem to be documented in the 
Customization manual. It allows information, which doesn't need to be 
shown to the user, to be passed in the name of the inset from the 
module in which it is defined to LyX. I've used this 'to serious 
purpose' and without ill effect so far, but would like to be sure, 
given the lack of documentation, that it is not going to snag on some 
other feature of LyX.


The | character is used in Qt4 to specify menu shortcuts. See e.g. the 
stdmenus.inc file. So whatever follows it is being interpreted as an 
attempt to specify a menu shortcut. So I'd not recommend using it this 
way, but I'm not sure what we should do about it. At least, we should 
put something into the documentation.


(2) Quotes are needed if a custom inset name has a space. I noticed 
that if the space is deleted but the quotes retained, not only does 
the inset disappear from the Custom Insets list (it's replaced by a 
blank line), but in LyX format it becomes undefined:


InsetLayout "Flex:foobah" =>  => \begin_inset Flex undefined

The natural behaviour seems to me for the quotes to have no effect 
when there's no space in the name. This feels like a bug.


This is a bug in the layout2layout conversion routine. Quoted names that 
do not contain spaces were wrongly being detected as unquoted names. 
I've fixed it. Since this is just in the layout2layout.py script, you 
can fix the bug in your own installation by applying 24dea042c.



(3) Underscores in inset names:

InsetLayout Flex:foo_bah => foo bah => \begin_inset Flex foo bah

Although the underscore is replaced by a space in the middle & right 
columns, using quotes around the name again produces invisibility in 
the Custom Insets list and an undefined inset in LyX file format. 
Again I can't see any documentation about underscores in the 
Customization manual.



Same bug.

Richard