pyVCP Documents

More
11 years 2 months ago - 11 years 2 months ago #61798 by Askjerry
pyVCP Documents was created by Askjerry
I was making a panel and wanted to use black <bg>#000000</bg> for the background... which of course means that I would need a different foreground color... like white.

I was wondering... since <bg> was short for background... would't <fg> would work for foreground??

I searched for <fg>... but it returned NO MATCH anywhere in the manual. I tried it anyway, and it worked.

I just thought you may want to add that information as it seemed to be missing.
linuxcnc.org/docs/html/hal/pyvcp.html#_label
Code:
<button> <padx>25</padx> <font>("Helvetica",8)</font> <halpin>"gecko-clear"</halpin><!-- Assigned to Parport 1, pin 14 RELAY --> <text>"GECKODRIVE RESET"</text> <bg>"#000000"</bg> <fg>"#ffffff"</fg> </button>

Panel Screenshot...

Last edit: 11 years 2 months ago by Askjerry.

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago #61806 by BigJohnT
Replied by BigJohnT on topic pyVCP Documents
Thanks for figuring this out. I've added it to the documents.

JT

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago #61826 by Askjerry
Replied by Askjerry on topic pyVCP Documents
Found another glitch... look at the manual for the BAR example...

<bar>
<halpin>"my-bar"</halpin>
<min_>0</min_>
<max_>150</max_>
<bgcolor>"grey"</bgcolor>
<fillcolor>"red"</fillcolor>
<range1>0,100,"green"</range1>
<range2>101,135,"orange"</range1>
<range3>136, 150,"red"</range1>
</bar>


Look at the three ranges...

<range1>0,100,"green"</range1>
<range2>101,135,"orange"</range1>
<range3>136, 150,"red"</range1>

I was chasing code until I realized they should have range 1,2,3 not 1,1,1. :blink:

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago #61837 by BigJohnT
Replied by BigJohnT on topic pyVCP Documents
And thanks again for spotting that typo. It is fixed.

JT

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago - 10 years 11 months ago #64964 by Askjerry
Replied by Askjerry on topic pyVCP Documents
I found another one for you to update... the multilabel.

First off... here is the document reference: linuxcnc.org/docs/html/hal/pyvcp.html#_multi_label

This is the example right from the page... it fails.
Code:
<multilabel> <legends>["Label1" "Label2" "Label3" "Label4" "Label5" "Label6"]</legends> <font>("Helvetica",20)</font> <disable>False</disable> </multilabel>

1) You need commas between the legends.
2) The document makes it sound like you send it a number and it reacts to that... not quite... I'll explain.

I created a multilable called "my-multi-label" and found that when I looked up the pins while in AXIS using the HAL CONFIGURATION... what I actually found was...

  • pyvcp.my-multi-label.legend0
  • pyvcp.my-multi-label.legend2
  • pyvcp.my-multi-label.legend1

So I needed to create THREE buttons, one tied to each state...

This worked perfectly... and I could select from the three states that I created.
Code:
<multilabel> <legends>["ALPHA", "BRAVO", "CHARLIE"]</legends> </multilabel>

But that wasn't enough... oh no... I had to push the envelope...
Could it handle color?
Text wrapping? (That would be cool huh?)

So... this is what I got... in my default panel blue too...
Code:
<multilabel> <halpin>"my-multi-label"</halpin> <wraplength>"250"</wraplength> <justify>"left"</justify> <legends>["ALPHA is the first legend and therefore the default to this whole experiment.", "BRAVO would naturally come next,of course it would.", "CHARLIE is the next line that should become active if I click the button."]</legends> <bg>"#000000"</bg> <fg>"#ffffff"</fg> </multilabel> <button> <font>("Helvetica",8)</font> <width>10</width> <halpin>"BTN-ALPHA"</halpin> <text>"ALPHA"</text> <bg>"#005C94"</bg> <fg>"#ffffff"</fg> </button> <button> <font>("Helvetica",8)</font> <width>10</width> <halpin>"BTN-BRAVO"</halpin> <text>"BRAVO"</text> <bg>"#005C94"</bg> <fg>"#ffffff"</fg> </button> <button> <font>("Helvetica",8)</font> <width>10</width> <halpin>"BTN-CHARLIE"</halpin> <text>"CHARLIE"</text> <bg>"#005C94"</bg> <fg>"#ffffff"</fg> </button>

I tied these together in the postgui file...
Code:
net ALPHA <= pyvcp.BTN-ALPHA net ALPHA => pyvcp.my-multi-label.legend0 net BRAVO <= pyvcp.BTN-BRAVO net BRAVO => pyvcp.my-multi-label.legend1 net CHARLIE <= pyvcp.BTN-CHARLIE net CHARLIE => pyvcp.my-multi-label.legend2

And it all works... the colors, the wrapped text, everything.

NOTE: The multilable will latch... it will stay in the last state you select... so clicking the button will set it, releasing the button has no effect... not until another button is pressed. (Or it gets another signal by whatever means.)


So now... I'll see if I can't pass data from my G-Code to this label.. things like instructions... then when they click the button... "WARNING - THE SPINDLE IS ABOUT TO START"

I hope you found this helpful.
Jerry
Last edit: 10 years 11 months ago by Askjerry.
The following user(s) said Thank You: ArcEye

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #64966 by ArcEye
Replied by ArcEye on topic pyVCP Documents

I found another one for you to update... the multilabel.
First off... here is the document reference: linuxcnc.org/docs/html/hal/pyvcp.html#_multi_label
This is the example right from the page... it fails.

<multilabel>
<legends>["Label1" "Label2" "Label3" "Label4" "Label5" "Label6"]</legends>
<font>("Helvetica",20)</font>
<disable>False</disable>
</multilabel>

1) You need commas between the legends.


You are quite right.

When I wrote multilabel, the original test xml file snippet was as below
Somehow that comma separation didn't get into the docs
Code:
<hbox> <vbox> <multilabel> <legends>["Radio1-Pressed","Radio2-Pressed","Radio3-Pressed"]</legends> <font>("Helvetica", 10)</font> <disable_pin>True</disable_pin> <initval>0</initval> </multilabel> <multilabel> <legends>["Radio4-Pressed","Radio5-Pressed","Radio6-Pressed"]</legends> <font>("Helvetica", 10)</font> <disable_pin>True</disable_pin> <initval>1</initval> </multilabel> </vbox> </hbox>

Don't know if it was a typo or some weird interaction in conversion from text to asciidoc to html.

Hopefully JT can easily amend without a PR

regards

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum