Discussion:
Dynamic initialization/updating guidata items
Sadique Sheik
2012-12-02 13:40:54 UTC
Permalink
Hi,

I would like to have a ChoiceItem (dropdown list) the content of which are
to be populated dynamically (or atleast during the __init__). Is there any
possibility to do that ?

Thanks
Sadique
picca-eE6tJkUsrWpDGTAf/
2013-04-18 13:28:34 UTC
Permalink
Post by Sadique Sheik
I would like to have a ChoiceItem (dropdown list) the content of which are
to be populated dynamically (or atleast during the __init__). Is there any
possibility to do that ?
Thanks
Sadique
I am also interested by this feature.

So is there a solution to update a ChoiceItem dynamically

Cheers

Fred
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Johannes Eckstein
2013-04-18 19:07:34 UTC
Permalink
Hi,

yes there is:

import guidata

import guidata.dataset.datatypes as dt
import guidata.dataset.dataitems as di

class Processing(dt.DataSet):
"""Example"""
a = di.FloatItem("Parameter #1", default=2.3)
b = di.IntItem("Parameter #2", min=0, max=10, default=5)
autotext = ""
text = di.TextItem("Expl",default=autotext)
type = di.ChoiceItem("Processing algorithm",
("type 1", "type 2", "type 3"))

app = guidata.qapplication()

param = Processing()
param.edit()
param.text = "my text"
param.type = ("my_type 1", "my_type 2", "mai_thai 3")

param.edit()
Post by Sadique Sheik
I would like to have a ChoiceItem (dropdown list) the content of
which are to be populated dynamically (or atleast during the
__init__). Is there any possibility to do that ?
Thanks
Sadique
I am also interested by this feature.
So is there a solution to update a ChoiceItem dynamically
Cheers
Fred
--
You received this message because you are subscribed to the Google
Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
picca-eE6tJkUsrWpDGTAf/
2013-04-20 09:24:34 UTC
Permalink
ok thanks, Indeed it works when I run edit() on the dataset.

now I am using this dataset inside a DataSetEditGroupBox

So do you know how to refresh the contain of this DatasetEditGroupBox once
I changed the
dataset choice item content ?
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Chris Marshall
2013-09-03 10:17:31 UTC
Permalink
I am having the same problem. I would like to specify the list of options
dynamically.

Johannes, if I run your code , I cannot see the options being updated.

They are still : ("type 1", "type 2", "type 3")

This is the same result that I have had before.

Is there some way of updating this?

Thanks,

Chris.
Post by Johannes Eckstein
Hi,
import guidata
import guidata.dataset.datatypes as dt
import guidata.dataset.dataitems as di
"""Example"""
a = di.FloatItem("Parameter #1", default=2.3)
b = di.IntItem("Parameter #2", min=0, max=10, default=5)
autotext = ""
text = di.TextItem("Expl",default=autotext)
type = di.ChoiceItem("Processing algorithm",
("type 1", "type 2", "type 3"))
app = guidata.qapplication()
param = Processing()
param.edit()
param.text = "my text"
param.type = ("my_type 1", "my_type 2", "mai_thai 3")
param.edit()
Post by Sadique Sheik
I would like to have a ChoiceItem (dropdown list) the content of which
are to be populated dynamically (or atleast during the __init__). Is there
any possibility to do that ?
Thanks
Sadique
I am also interested by this feature.
So is there a solution to update a ChoiceItem dynamically
Cheers
Fred
--
You received this message because you are subscribed to the Google Groups
"guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Assaf B
2013-09-18 20:16:19 UTC
Permalink
same here,
the example doesn't work.
I use WinPython 64bit 2.7.5.0 with Guidata 1.6.1
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Assaf B
2013-10-01 12:12:56 UTC
Permalink
well, a very ugly (but working) work around is to wrap the class with a
function, and having the function input parameter as the classes globals.
Not the pretiest, and of course, not methodological, but the following
example works:

from guidata.dataset.datatypes import DataSet

from guidata.dataset.dataitems import ChoiceItem


def choiceFunc(choiceVec):


class guiclass(DataSet):

choice1 = ChoiceItem("first choice ",choiceVec)


e = guiclass()

e.edit()

return e.choice1

if __name__ == "__main__":

# Create QApplication

import guidata

_app = guidata.qapplication()

choiceVec = [(0, "0"), (1, "1")]

choice1 = choiceFunc(choiceVec)


choiceVec = [(2, "2"), (3, "3")]

choice2 = choiceFunc(choiceVec)
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Assaf B
2013-10-01 12:14:42 UTC
Permalink
Well, a very ugly work around is to wrap the GUI class with a function.
The attached file isn't the pretiest but is working
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Jason Sexauer
2013-10-10 02:20:50 UTC
Permalink
I have another pretty ugly solution here:

http://stackoverflow.com/questions/19279133/edit-guidata-choices/19280321#19280321

I feel like there has to be a cleaner way.
Post by Assaf B
Well, a very ugly work around is to wrap the GUI class with a function.
The attached file isn't the pretiest but is working
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Jason Sexauer
2013-10-10 02:17:18 UTC
Permalink
I had an even more ugly work around posted here:

http://stackoverflow.com/questions/19279133/edit-guidata-choices/19280321#19280321

I feel like there should be a cleaner way to do this...
Post by Assaf B
Well, a very ugly work around is to wrap the GUI class with a function.
The attached file isn't the pretiest but is working
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Loading...