FlexGui touch - FSC-like myOwn tab from ext UI file

More
10 Sep 2025 07:20 - 10 Sep 2025 12:45 #334752 by ts
Hello
Im trying to include my own tab to flex gui touch (great wotks! Thanks to author!). I see that already there fsc_container which corresponds to /usr/lib/libflexgui/fsc.ui and now i wanna to add my own tab - for example i have some rs232 device to read some  parameters (thc, edm for example, device already connected to hal via user space component linuxcnc). And i dont understand how to include thc.ui to the tab like dsf / fsc ?
Last edit: 10 Sep 2025 12:45 by ts.
The following user(s) said Thank You: JT

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

More
12 Sep 2025 11:59 #334878 by JT
The simple way is to just create your tab in the ui and add your widgets then using the Python module connect all of your widgets to your Python code.

gnipsel.com/linuxcnc/flexgui/python.html

github.com/jethornton/flexgui/blob/maste...gui/startup.py#L2381
github.com/jethornton/flexgui/blob/maste...rc/libflexgui/tpc.py



JT
The following user(s) said Thank You: ts

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

More
23 Sep 2025 14:55 #335327 by ts
Hi, 

​​​​​​JT thanks for your reply.
additional for this situation question. I have two sliders. Usong Slider1 user may choose value 10..20. slider2 could be 0..100 . But if slider1 is more than 15, Slider2 could be only 80..100.
How i may realise this?

Thanks in advance.

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

More
23 Sep 2025 15:38 #335328 by JT
That would have to be done in your custom Python code using the sliders valueChanged() signal to trigger a call to your function and use the setMinimum() function of the slider to change the minimum set point.

JT

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

More
23 Sep 2025 16:13 #335330 by JT
I just tried this and it works fine
from functools import partial

def startup(parent):
	parent.slider_1.valueChanged.connect(partial(slider_1, parent))
	parent.slider_2.valueChanged.connect(partial(slider_2, parent))

def slider_1(parent):
	parent.label_1.setText(f'{parent.slider_1.value()}')
	if parent.slider_1.value() >= 15:
		parent.slider_2.setMinimum(80)
	else:
		parent.slider_2.setMinimum(0)

def slider_2(parent):
	parent.label_2.setText(f'{parent.slider_2.value()}')
The following user(s) said Thank You: ts

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

More
23 Sep 2025 16:18 #335331 by JT
The following user(s) said Thank You: ts

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

More
27 Sep 2025 06:29 #335477 by ts
Hi, JT! 
thanks a lot. 
Its works fine.
Also im used parent.slider1.setSliderPosition(int) for setting needed value with 'if' to controlling the range without changing min/max.

Best regards
 
The following user(s) said Thank You: JT

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

Time to create page: 0.078 seconds
Powered by Kunena Forum