Closed hayg25 closed 3 years ago
Hi, can't say for sure, but it looks like you are trying to use a TaurusAttrListComboBox
for something that is not its purpose.
You are not suppossed to call addItems
on a TaurusAttrListComboBox
. Instead, a TaurusAttrListComboBox
populates itself from the value of the taurus attribute it has as its model. I think that for your purposes, (assuming that the ["PiC","PrC","PiS","PrS","QS","PS","PhD"]
list is not coming from a Taurus Attribute), you should use a pure Qt QComboBox
instead...
Then I see another issue in your code which is your call to self.form.parentModelChanged(updated_Model[i])
.
As a first warning, using the "parent model API" is already discouraged... but I cannot give more specific hints because without an explanation of what updated_Model
is, I cannot understand exactly what do you want to achieve. Maybe if you give us a bit of context (basically helping us understanding what do you intend to do) we could be of more help.
Hi @cpascual,
Basically what I have HF signals from different boards ["PiC","PrC","PiS","PrS","QS","PS","PhD"]. Each element corresponds to a Device Server (7 device servers in this example). What I want, is to access to the HF signal board parameters from a TaurusForm, and switch from board to board (by changing the device server ID) by using the ComboBox.
Ok I try to use a pure Qt QComboBox.
May be you have other way to display the Panel ? Like using N = 7 buttons ?
In your situation, I see 2 main approaches
create the 7 taurusforms from the beginning l and put them in a tab widget
use a QComboBox and connect its item text changed signal to a method that uses a dict to map each text to a list of attribute names and then calls form.setModel with the list
The first is the simplest and more compact and intuitive, and also is the most responsive if you change the viewed device often, because the forms are always ready. On the down side, it takes a bit more time to initialize at the beguinning and does not scale well if you have a lot of devices and/or attributes.
Note1: the first approach can be implemented without coding by simply populating a TaurusGui with the 7 forms and ordering the panels as tabs
On July 23, 2020 8:32:34 AM GMT+01:00, Guler Hayg notifications@github.com wrote:
Hi @cpascual, Basically what I have HF signals from different boards ["PiC","PrC","PiS","PrS","QS","PS","PhD"]. Each element corresponds to a Device Server (7 device servers in this example). What I want, is to access to the HF signal board parameters from a TaurusForm, and switch from board to board (by changing the device server ID) by using the ComboBox.
Ok I try to use a pure Qt QComboBox. May be you have other way to display the Panel ? Like using N = 7 buttons ?-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/taurus-org/taurus/issues/1130#issuecomment-662860809
Thanks @cpascual, could you please provide an example to create the 7 taurusforms from the beginning l and put them in a tab widget, I would like to put them on the side part of my plot.
could you please provide an example
Here is a working example of what I mean (using 2 forms and dummy eval attributes for the models):
import sys
from taurus.external.qt import Qt
from taurus.qt.qtgui.panel import TaurusForm
from taurus.qt.qtgui.application import TaurusApplication
app = TaurusApplication()
d = { # map your models for each form here
"dev1": ["eval:11", "eval:12", "eval:13"],
"dev2": ["eval:21", "eval:22", "eval:23"],
}
tw = Qt.QTabWidget()
for name, models in d.items():
f = TaurusForm()
f.setModel(models)
tw.addTab(f, name)
tw.show()
sys.exit(app.exec_())
Does it help?
Also note that if you just want a plot and an explorer of devices, you can use the taurus panel
command and you get just that.
Or, for more flexibility, you can create a new GUI with the taurus newgui
wizard and add the plot and all the forms with the wizard (without coding) and then just sort them as you wish (e.g. plot on the left and forms tabbed on the right).
could you please provide an example
Here is a working example of what I mean (using 2 forms and dummy eval attributes for the models):
import sys from taurus.external.qt import Qt from taurus.qt.qtgui.panel import TaurusForm from taurus.qt.qtgui.application import TaurusApplication app = TaurusApplication() d = { # map your models for each form here "dev1": ["eval:11", "eval:12", "eval:13"], "dev2": ["eval:21", "eval:22", "eval:23"], } tw = Qt.QTabWidget() for name, models in d.items(): f = TaurusForm() f.setModel(models) tw.addTab(f, name) tw.show() sys.exit(app.exec_())
Does it help?
Dear @cpascual, many thanks yes that's what I want :) Thanks a lot.
Dear All, I try to update a TaurusForm using TaurusAttrListComboBox(): see the code below
I tried to update it using parentModelChanged and I failed to update. I also tried resetModel same problem with additional error message :
TaurusForm: Cannot handle model "State". Using default widget.
Thanks for the feedback