class DefaultParameters(DataSet): """ Settings Instructions 'comment': <br>Plain text or <b>rich text</b> are both supported. """ data_dir = DirectoryItem("Directory",'D:\\Users\\thomas\\Data\\CloudStation\\Projects\\IMUs\\Jansenberger\\data') _bg = BeginGroup("Time View") acc_limit = FloatItem("Limit [Accelerometer]", default=0.5, min=0, max=3, step=0.01, slider=True) gyr_limit = FloatItem("Limit [Gyroscope]", default=300, min=100, max=1000, step=1, slider=True) init_channel = ChoiceItem("Initial Channel", [(16, "acc"), (32, "gyr")], radio=True) _eg = EndGroup("Time View") _bcolor = BeginGroup("Traffic Light") color_top = ColorItem("Top", default="red") color_middle = ColorItem("Middle", default="#ffaa00") color_bottom = ColorItem("Bottom", default="#00aa00") upper_thresh = FloatItem("Upper Threshold", default=0.7, min=0, max=2, step=0.01, slider=True) lower_thresh = FloatItem("Lower Threshold", default=0.3, min=0.1, max=1, step=0.01, slider=True) _ecolor = EndGroup("Colors") opening_view = ChoiceItem("Initial View", [(16, 'Time-View'), (32, "xy-View"), (64, 'TrafficLight-View')], radio=True)
class TestParameters(DataSet): def cb_example(self, item, value): print("\nitem: ", item, "\nvalue:", value) if self.results is None: self.results = '' self.results += str(value) + '\n' print("results:", self.results) def update_x1plusx2(self, item, value): print("\nitem: ", item, "\nvalue:", value) if self.x1 is not None and self.x2 is not None: self.x1plusx2 = self.x1 + self.x2 else: self.x1plusx2 = None string = StringItem("String", default="foobar").set_prop("display", callback=cb_example) x1 = FloatItem("x1").set_prop("display", callback=update_x1plusx2) x2 = FloatItem("x2").set_prop("display", callback=update_x1plusx2) x1plusx2 = FloatItem("x1+x2").set_prop("display", active=False) color = ColorItem("Color", default="red").set_prop("display", callback=cb_example) choice = ChoiceItem("Single choice", [(16, "first choice"), (32, "second choice"), (64, "third choice")], default=64).set_pos(col=1, colspan=2).set_prop( "display", callback=cb_example) results = TextItem("Results")
def add_range_to_plot(self, plot, this_range): self.myrange = make.range(this_range[0], this_range[1]) self.myrange.itemChanged() self.myrange.set_movable(False) if False: # make all colors black/gray # check /usr/lib/python2.7/dist-packages/guiqwt/config.py for parameters # from guidata.dataset.dataitems import ColorItem self.myrange.shapeparam.fill = ColorItem("gray") self.myrange.shapeparam.line.color = "#000000" self.myrange.shapeparam.sel_line.color = "#000000" self.myrange.shapeparam.symbol.facecolor = "#000000" self.myrange.shapeparam.sel_symbol.facecolor = "#000000" # self.myrange.shapeparam.update_range( self.myrange) # creates all the above QObjects self.myrange.set_resizable(False) self.myrange.itemChanged() # print self.myrange._can_move, "move" # disp2 = make.computations(self.myrange, "TL", # [(curve, "min=%.5f", lambda x,y: y.min()), # (curve, "max=%.5f", lambda x,y: y.max()), # (curve, "avg=%.5f", lambda x,y: y.mean())]) # plot.add_item( disp2 ) plot.add_item(self.myrange) self.myranges.append(self.myrange)
class TestParameters(DataSet): """ DataSet test The following text is the DataSet 'comment': <br>Plain text or <b>rich text<sup>2</sup></b> are both supported, as well as special characters (α, β, γ, δ, ...) """ files = SubDataSetItem("files") string = StringItem("String") text = TextItem("Text") _bg = BeginGroup("A sub group") float_slider = FloatItem("Float (with slider)", default=0.5, min=0, max=1, step=0.01, slider=True) fl1 = FloatItem("Current", default=10., min=1, max=30, unit="mA", help="Threshold current") fl2 = FloatItem("Float (col=1)", default=1., min=1, max=1, help="Help on float item").set_pos(col=1) fl3 = FloatItem("Not checked float").set_prop('data', check_value=False) bool1 = BoolItem("Boolean option without label") bool2 = BoolItem("Boolean option with label", "Label").set_pos(col=1, colspan=2) color = ColorItem("Color", default="red") choice = ChoiceItem("Single choice", [(16, "first choice"), (32, "second choice"), (64, "third choice")]).set_pos(col=1, colspan=2) _eg = EndGroup("A sub group") floatarray = FloatArrayItem("Float array", default=np.ones((50, 5), float), format=" %.2e ").set_pos(col=1) g0 = BeginTabGroup("group") mchoice1 = MultipleChoiceItem( "MC type 1", ["first choice", "second choice", "third choice"]).vertical(2) mchoice2 = ImageChoiceItem("MC type 2", [("rect", "first choice", "gif.png" ), ("ell", "second choice", "txt.png" ), ("qcq", "third choice", "file.png" )] ).set_pos(col=1) \ .set_prop("display", icon="file.png") mchoice3 = MultipleChoiceItem("MC type 3", [str(i) for i in range(10)]).horizontal(2) eg0 = EndTabGroup("group") integer_slider = IntItem("Integer (with slider)", default=5, min=0, max=100, slider=True) integer = IntItem("Integer", default=5, min=3, max=6).set_pos(col=1)
class ExampleDataSet(ActivableDataSet): """ Example <b>Activable dataset example</b> """ enable = BoolItem( "Enable parameter set", help="If disabled, the following parameters will be ignored", default=False) param0 = ChoiceItem("Param 0", ['choice #1', 'choice #2', 'choice #3']) param1 = FloatItem("Param 1", default=0, min=0) param2 = FloatItem("Param 2", default=.93) color = ColorItem("Color", default="red")
class TestParameters(DataSet): """ DataSet test The following text is the DataSet 'comment': <br>Plain text or <b>rich text<sup>2</sup></b> are both supported, as well as special characters (α, β, γ, δ, ...) """ dir = DirectoryItem("Directory", TEMPDIR) fname = FileOpenItem("Open file", ("csv", "eta"), FILE_CSV.name) fnames = FilesOpenItem("Open files", "csv", FILE_CSV.name) fname_s = FileSaveItem("Save file", "eta", FILE_ETA.name) string = StringItem("String") text = TextItem("Text") float_slider = FloatItem("Float (with slider)", default=0.5, min=0, max=1, step=0.01, slider=True) integer = IntItem("Integer", default=5, min=3, max=16, slider=True).set_pos(col=1) dtime = DateTimeItem("Date/time", default=datetime.datetime(2010, 10, 10)) date = DateItem("Date", default=datetime.date(2010, 10, 10)).set_pos(col=1) bool1 = BoolItem("Boolean option without label") bool2 = BoolItem("Boolean option with label", "Label") _bg = BeginGroup("A sub group") color = ColorItem("Color", default="red") choice = ChoiceItem("Single choice 1", [('16', "first choice"), ('32', "second choice"), ('64', "third choice")]) mchoice2 = ImageChoiceItem("Single choice 2", [("rect", "first choice", "gif.png"), ("ell", "second choice", "txt.png"), ("qcq", "third choice", "file.png")]) _eg = EndGroup("A sub group") floatarray = FloatArrayItem("Float array", default=np.ones((50, 5), float), format=" %.2e ").set_pos(col=1) mchoice3 = MultipleChoiceItem("MC type 1", [str(i) for i in range(12)]).horizontal(4) mchoice1 = MultipleChoiceItem( "MC type 2", ["first choice", "second choice", "third choice" ]).vertical(1).set_pos(col=1)
class DisplayBoard(dt.DataSet): """c4o5x5 The following text is the DataSet 'comment': <br>Plain text or <b>rich text<sup>2</sup></b> are both supported, as well as special characters (α, β, γ, δ, ...) """ #leaving this in as an example #ideally we'd have an array of 5x5 but the UI toolkit won't render arrays like it does variables, as far as I can tell #worst case we're writing a "move from UI to backend class" function A1 = ColorItem("A1", default="black") A2 = ColorItem("A2", default="black").set_pos(col=1) A3 = ColorItem("A3", default="black").set_pos(col=2) A4 = ColorItem("A4", default="black").set_pos(col=3) A5 = ColorItem("A5", default="black").set_pos(col=4) B1 = ColorItem("B1", default="black") B2 = ColorItem("B2", default="black").set_pos(col=1) B3 = ColorItem("B3", default="black").set_pos(col=2) B4 = ColorItem("B4", default="black").set_pos(col=3) B5 = ColorItem("B5", default="black").set_pos(col=4) C1 = ColorItem("C1", default="black") C2 = ColorItem("C2", default="black").set_pos(col=1) C3 = ColorItem("C3", default="black").set_pos(col=2) C4 = ColorItem("C4", default="black").set_pos(col=3) C5 = ColorItem("C5", default="black").set_pos(col=4) D1 = ColorItem("D1", default="black") D2 = ColorItem("D2", default="black").set_pos(col=1) D3 = ColorItem("D3", default="black").set_pos(col=2) D4 = ColorItem("D4", default="black").set_pos(col=3) D5 = ColorItem("D5", default="black").set_pos(col=4) E1 = ColorItem("E1", default="black") E2 = ColorItem("E2", default="black").set_pos(col=1) E3 = ColorItem("E3", default="black").set_pos(col=2) E4 = ColorItem("E4", default="black").set_pos(col=3) E5 = ColorItem("E5", default="black").set_pos(col=4)