pyVCP Documents

More
26 Aug 2015 06:48 - 26 Aug 2015 07:02 #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
	      <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...

Attachments:
Last edit: 26 Aug 2015 07:02 by Askjerry.

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

More
26 Aug 2015 18:51 #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
27 Aug 2015 12:47 #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
27 Aug 2015 19:22 #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
08 Nov 2015 07:11 - 08 Nov 2015 15:01 #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.
<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.
<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...
<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...
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: 08 Nov 2015 15:01 by Askjerry.
The following user(s) said Thank You: ArcEye

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

More
08 Nov 2015 10:40 #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
<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.

More
08 Nov 2015 14:09 - 08 Nov 2015 14:57 #64968 by Askjerry
Replied by Askjerry on topic pyVCP Documents
It is also missing the <halpin>name</halpin> assignments... without those how would you pass information to it.

Also... I don't get the <disable_pin>True</disable_pin> part... don't you want to have a pin to pass the information to???

Or am I missing the context of the pin?

Thanks,
Jerry
Last edit: 08 Nov 2015 14:57 by Askjerry.

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

More
08 Nov 2015 15:05 - 08 Nov 2015 15:11 #64969 by Askjerry
Replied by Askjerry on topic pyVCP Documents
I just checked: linuxcnc.org/docs/html/hal/pyvcp.html#_number_displays

It still has the incorrect sample for the bar. (As of 8 NOV 2015)
<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>

Also, reference: linuxcnc.org/docs/html/hal/pyvcp.html#_buttons

It does not include the <fg> attribute.

I think you may have updated your local documents... but not yet uploaded them to the public.

Jerry
Last edit: 08 Nov 2015 15:11 by Askjerry.

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

More
08 Nov 2015 15:16 #64970 by ArcEye
Replied by ArcEye on topic pyVCP Documents

It is also missing the <halpin>name</halpin> assignments... without those how would you pass information to it.


They are not missing, just not listed. If not specified it defaults to 'multilabel' in the same way as all the widgets default to the widget name.

Also... I don't get the <disable_pin>True</disable_pin> part... don't you want to have a pin to pass the information to???
Or am I missing the context of the pin?


Yes, you are missing the point of it.
The disable field creates a disable pin, with which you can disable the widget (greyed out typically, depends upon your display manager etc)

regards

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

More
08 Nov 2015 16:55 - 08 Nov 2015 17:08 #64975 by Askjerry
Replied by Askjerry on topic pyVCP Documents
I made a really cool discovery... well... for me anyway... I found that I could insert LINE BREAKS into the <label></label> and <multilabel><multilabel> objects. I was wondering if using the "\n" would work or not... and it does.

Here is the XML from a section of my PECK DRILL pyvcp panel...
<!-- Instruction message with text wrapping and updates. 					  -->
<multilabel>
	<halpin>"peck-drill-notice"</halpin>
	<!-- Set label information here... big run-on lines... can't be helped.                   -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<legends>["\n INSTRUCTIONS: \n \n After you enter information into the widget above, press the button to start. \n \n There will be a short delay for safety. \n", "\n WARNING: \n \n \n A program is running, please use caution. \n \n \n"]</legends>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!-- Finish label information here...                                                     -->
	<wraplength>"250"</wraplength>
	<justify>"center"</justify>
	<font>("Helvetica",10)</font>
	<bg>"#000000"</bg>
	<fg>"#ffffff"</fg>
	<width>22</width>
</multilabel>

The label is then associated with PROGRAM... if it is running or if it is idle.

Here is the section of my postgui file...
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Custom settings.
# --------------------------------------------------------------------------------------------------	
net panel-PGM-RUN	<= halui.program.is-running	
net panel-PGM-IDLE	<= halui.program.is-idle
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Set up PECK-DRILL and BOLT-HOLE announcement system. (Multilabel Messages)
# --------------------------------------------------------------------------------------------------
net panel-PGM-IDLE	=> pyvcp.bolt-hole-notice.legend0	# Display IDLE message.
net panel-PGM-RUN	=> pyvcp.bolt-hole-notice.legend1	# Display WARNING message.
net panel-PGM-IDLE	=> pyvcp.peck-drill-notice.legend0	# Display IDLE message.
net panel-PGM-RUN	=> pyvcp.peck-drill-notice.legend1	# Display WARNING message.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

And here is the panel in operation...

Attachments:
Last edit: 08 Nov 2015 17:08 by Askjerry. Reason: Clarity
The following user(s) said Thank You: Cheech, hoffb77

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

Time to create page: 0.161 seconds
Powered by Kunena Forum