icon

Support Forum

PythonParts interface code readability: text on multiline


How to write well indented code with text on multiline?

With a code like this for an PythonPart Interface:

<Parameter>
    <Name>InfoPictureTest</Name>
    <Text>A text
    on
    severals
    lines
    </Text>
    <TextId>1000</TextId>
    <Value>AllplanSettings.PictResPalette.eHotinfo</Value>
    <ValueType>Picture</ValueType>
</Parameter>

I see in AllPlan :

"A text
    on
    severals
    lines"

I know that I can use ASCII character like this to get the good result:

<Text>A text&#13;on&#13;severals&#13;lines</Text>

But, for looooooooong text, this isn't readable.

Is it possible to write something like this using \n character for new lines?

<Parameter>
    <Name>InfoPictureTest</Name>
    <Text Value="A text
    \non
    \nseverals
    \nlines"/>
    <TextId>1000</TextId>
    <Value>AllplanSettings.PictResPalette.eHotinfo</Value>
    <ValueType>Picture</ValueType>
</Parameter>

With bad indented text I can't collapse/uncollapse properly my interface's code which is annoying...

Anhänge (1)

Typ: image/png
12-mal heruntergeladen
Größe: 1,98 KiB

Hello,

I haven't tried to find a solution in Python.
But I just wanted to clarify this:
Cr = #13 = \r (Carriage Return)
Lf = #10 = \n (Line Feed)
Have you tried CrLf (\r\n)?


Zitiert von: bertrand_c
Hello,
I haven't tried to find a solution in Python.

But I just wanted to clarify this:

Cr = #13 = \r (Carriage Return)

Lf = #10 = \n (Line Feed)

Have you tried CrLf (\r\n)?


As I said, this solution works for the AllPlan interface (using &#13;) but not for the .pyp File readability.

I'm looking for a way to write readable .pyp files with multiline text.

Hi,

Just write in multiline without indent in your pyp file

<Parameter>
    <Name>NameRow</Name>
    <Text>Name</Text>
    <ValueType>Row</ValueType>
    <Value>OVERALL:1</Value>
    <Parameters>
        <Parameter>
            <Name>InfoPicture</Name>
            <Text>Provide some more extensive explanation here.
Multi-lines are possible.</Text>
            <TextId>1005</TextId>
            <Value>AllplanSettings.PictResPalette.eHotinfo</Value>
            <ValueType>Picture</ValueType>
        </Parameter>

        <Parameter>
            <Name>Name</Name>
            <Text></Text>
            <Value></Value>
            <ValueType>String</ValueType>
        </Parameter>
    </Parameters>
</Parameter>

More details here

Best
Christophe

Anhänge (1)

Typ: image/png
4-mal heruntergeladen
Größe: 6,89 KiB

Hi,

With this last answer, I believe that well-indented code with text on multiline is impossible...

The main problem with this method of bad indented text is that it breaks IDE. They can't collapse and uncollapse properly code with bad indented text/code. This is awfull for code readability...

This is why I was looking for a solution for well indented text on multiline. One extremely long line of text with ASCII characters for new line is the best bad solution I found so far.

However, thanks for trying to help 👍​

.

I made an image to explain:

Anhänge (1)

Typ: image/jpeg
24-mal heruntergeladen
Größe: 227,47 KiB

my editor does fold/unfold without this issue, when text beginns in newline at the beginning

Allplan Webentwicklung

Private messages must be private. No support request via Private message.

Anhänge (2)

Typ: image/png
12-mal heruntergeladen
Größe: 23,09 KiB
Typ: image/png
10-mal heruntergeladen
Größe: 31,39 KiB