class TestParameters(DataSet): _bg = BeginGroup("R/W Commands") readcmd = FileOpenItem("Read command", "exe", "") writecmd = FileOpenItem("Write command", "exe", "") _eg = EndGroup("R/W Commands") _bg = BeginGroup("Channels") ch1n = IntItem("Channel #1", default=3, min=1, max=4) ach1n = EvalStringItem("K1", default="1").set_pos(col=1) ch2n = IntItem("Channel #2", default=4, min=1, max=4) ach2n = EvalStringItem("K2", default="1").set_pos(col=1) _eg = EndGroup("Channels") _bg = BeginGroup("Pulse") period = FloatItem("Period", min=0.5, default=1.0, help="Time between two sequential clock pulse") duration = FloatItem("Duration", min=0.5, max=period, default=0.7, help="Duaration of the clock pulse") syncch = IntItem("#Sync channel", default=1, min=1, max=2, help="The sync DAC channel") _eg = EndGroup("Pulse") _bg = BeginGroup("Save raw channels data") raw_savedir = DirectoryItem("Directory", os.getcwd() + "\\tmp") raw_fileprefix = StringItem("File Name", default="raw_") _eg = EndGroup("Save raw channels data")
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 Controlwidget(DataSet): Directory = DirectoryItem("Directory", default=os.path.abspath("../data/")) _bt = BeginGroup("Frequency and time").set_pos(col=0) Frequency = FloatItem("Frequency", default=142.175, unit="GHz").set_prop("display", format="%3.1f") IntegrationTime = FloatItem("Integration time", default=5., unit="s").set_prop("display", format="%3.1f") BlankTime = IntItem("Blank time", default=5, unit="ms") _et = EndGroup("Frequency and time") _bs = BeginGroup("Sweep").set_pos(col=1) Sweep = ChoiceItem("Sweep", ["Off", "On"], default=False) FrequencyStep = FloatItem("Frequency step", default=.2, unit="GHz").set_prop("display", format="%3.1f") Offset = FloatItem("Offset", default=6., unit="GHz").set_prop("display", format="%3.1f") SweepStep = FloatItem("Sweep step", default=10., unit="GHz").set_prop("display", format="%3.1f") _es = EndGroup("Sweep") _bo = BeginGroup("Other").set_pos(col=2) Chopper = ChoiceItem("Chopper", ["Cold", "Hot", "Antenna", "Reference"], default=0) Antenna = IntItem("Antenna offset", default=1000, unit="") NSpec = IntItem("Spectra per file", default=7000, unit="") Format = ChoiceItem("File format", ["e", "a"], default=0) _eo = EndGroup("Other")
class HKset(DataSet): _bd=BeginGroup("DACs").set_pos(col=0) GunnBias=FloatItem("GunnBias",default=1.,unit="").set_prop("display",format="%4.2f") LoopGain=FloatItem("LoopGain",default=1.,unit="").set_prop("display",format="%4.2f") HmxBias=FloatItem("HmxBias",default=1.,unit="").set_prop("display",format="%4.2f") _ed=EndGroup("DACs") _ba=BeginGroup("ADCs").set_pos(col=1) OffsetVolt=FloatItem("Offset Volt.",default=1.,unit="V").set_prop("display",format="%4.2f") PLLIFLevel=FloatItem("PLL IF Level",default=1.,unit="V").set_prop("display",format="%4.2f") HmxCurrent=FloatItem("HmxCurrent",default=1.,unit="mA").set_prop("display",format="%4.2f") _ea=EndGroup("ADCs") _bc1=BeginGroup("Cryostat").set_pos(col=2) Band2=FloatItem("Band2",default=1.,unit="<sup>o</sup>K").set_prop("display",format="%4.2f") Band3=FloatItem("Band3",default=1.,unit="<sup>o</sup>K").set_prop("display",format="%4.2f") ColdLoad=FloatItem("ColdLoad",default=1.,unit="<sup>o</sup>K").set_prop("display",format="%4.2f") _ec1=EndGroup("Cryostat") _bc2=BeginGroup("Cryostat").set_pos(col=3) T_04K=FloatItem("T_04K",default=1.,unit="<sup>o</sup>K").set_prop("display",format="%4.2f") T_15K=FloatItem("T_15K",default=1.,unit="<sup>o</sup>K").set_prop("display",format="%4.2f") T_77K=FloatItem("T_77K",default=1.,unit="<sup>o</sup>K").set_prop("display",format="%4.2f") _ec2=EndGroup("Cryostat") _be=BeginGroup("Environment").set_pos(col=4) RoomTemp=FloatItem("Room",default=1.,unit="<sup>o</sup>K").set_prop("display",format="%4.2f") OutsideTemp=FloatItem("Outside",default=1.,unit="<sup>o</sup>K").set_prop("display",format="%4.2f") Humidity=FloatItem("Humidity",default=1.,unit="%").set_prop("display",format="%4.2f") _ee=EndGroup("Environment")
class GroupSelection(DataSet): """ Group selection test <b>Group selection example:</b> """ g1 = BeginGroup("group 1") enable1 = BoolItem( "Enable parameter set #1", help="If disabled, the following parameters will be ignored", default=False).set_prop("display", store=prop1) param1_1 = FloatItem("Param 1.1", default=0, min=0).set_prop("display", active=prop1) param1_2 = FloatItem("Param 1.2", default=.93).set_prop("display", active=prop1) _g1 = EndGroup("group 1") g2 = BeginGroup("group 2") enable2 = BoolItem( "Enable parameter set #2", help="If disabled, the following parameters will be ignored", default=True).set_prop("display", store=prop2) param2_1 = FloatItem("Param 2.1", default=0, min=0).set_prop("display", active=prop2) param2_2 = FloatItem("Param 2.2", default=.93).set_prop("display", active=prop2) _g2 = EndGroup("group 2")
class TestParameters2(TestParameters): bool1 = BoolItem("Boolean option (bis)") g1 = BeginGroup("Group") a = FloatItem("Level 1") gg1 = BeginGroup("sub-group") b = FloatItem("Level 2a") c = FloatItem("Level 2b") _gg1 = EndGroup("sub-group end") _g1 = EndGroup("sub-group")
class first_tab(ActivableDataSet): # stock market analysis runuploaddata = ValueProp(False) enable = BoolItem( "Enable parameter set", help="If disabled, the following parameters will be ignored", default=False) default_exps_file = os.path.join(gc.data_root_folder, gc.default_exps_file) experiments_to_analyze = FileOpenItem("Stocks to analyze", formats=["csv"], basedir=gc.data_root_folder, default=default_exps_file) # Sleep sleep_help = "the application will sleep for the indicated amount of hours before starting with the processing" sleep_hours = FloatItem("Delay start (hours)", help=sleep_help, slider=True, min=0, max=48, default=0) ### #Begin of groups ### sg1 = BeginGroup("Uploading Chart Data") # xxx item1_upload_data = BoolItem("Upload Data").set_prop("display", store=runuploaddata) _sg1 = EndGroup("Uploading Chart Data")
class ExampleMultiGroupDataSet(DataSet): param0 = ChoiceItem("Choice", ['deazdazk', 'aeazee', '87575757']) param1 = FloatItem("Foobar 1", default=0, min=0) t_group = BeginTabGroup("T group") a_group = BeginGroup("A group") param2 = FloatItem("Foobar 2", default=.93) dir1 = DirectoryItem("Directory 1") file1 = FileOpenItem("File 1") _a_group = EndGroup("A group") b_group = BeginGroup("B group") param3 = FloatItem("Foobar 3", default=123) _b_group = EndGroup("B group") c_group = BeginGroup("C group") param4 = FloatItem("Foobar 4", default=250) _c_group = EndGroup("C group") _t_group = EndTabGroup("T group")
class FindData(DataSet): g1 = BeginGroup('Data Upload') fname = FileOpenItem('Open File', ('xlsx', 'xls')) _g1 = EndGroup('Data Upload') g2 = BeginGroup('Optional Parameters') enable = BoolItem('activate optional parameters', default=False).set_prop('display', store=prop1) rescore = IntItem('# of choices to score').set_prop('display', active=prop1) rescore6 = BoolItem('rescore 6 minutes', default=False) rescore12 = BoolItem('rescore 12 minutes', default=False) _g2 = EndGroup('Optional Parameters') save = FileSaveItem('create results', formats='xlsx')
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 cSet(DataSet): _bg1 = BeginGroup("Source 1").set_pos(0) tab1 = ChoiceItem("Tab", ['a']) data1 = ChoiceItem("Data", ['a']) _eg1 = EndGroup("") _bg2 = BeginGroup("Source 2").set_pos(1) tab2 = ChoiceItem("Tab", ['a']) data2 = ChoiceItem("Data", ['a']) _eg2 = EndGroup("") _bg3 = BeginGroup("Operation").set_pos(2) function = ChoiceItem("Function", [('y1-y2', 'y1-y2'), ('y1+y2', 'y1+y2'), ('y1/y2', 'y1/y2'), ('custom', 'f(x,y1,y2)')]) custom = StringItem("f(x,y1,y2):") _eg3 = EndGroup("") text = TextItem("").set_pos(3)
class AnotherDataSet(DataSet): """ Example 2 <b>Simple dataset example</b> """ param0 = ChoiceItem("Choice", ['deazdazk', 'aeazee', '87575757']) param1 = FloatItem("Foobar 1", default=0, min=0) a_group = BeginGroup("A group") param2 = FloatItem("Foobar 2", default=.93) param3 = FloatItem("Foobar 3", default=123) _a_group = EndGroup("A group")
class HKset(DataSet): _bc = BeginGroup("Cryostat").set_pos(col=0) Cold_Load = FloatItem("Cold Load", default=1., unit="K").set_prop("display", format="%4.2f") Hot_Load = FloatItem("Hot Load", default=1., unit="K").set_prop("display", format="%4.2f") HEMT = FloatItem("HEMT", default=1., unit="K").set_prop("display", format="%4.2f") _ec = EndGroup("Cryostat") _bfa = BeginGroup("CTS Filters").set_pos(col=1) T3_A = FloatItem("CTS1 A", default=1., unit="K").set_prop("display", format="%4.2f") T3_B = FloatItem("CTS1 B", default=1., unit="K").set_prop("display", format="%4.2f") T2_A = FloatItem("CTS2 A", default=1., unit="K").set_prop("display", format="%4.2f") T2_B = FloatItem("CTS2 B", default=1., unit="K").set_prop("display", format="%4.2f") _efa = EndGroup("CTS Filters") _bfb = BeginGroup("Other").set_pos(col=2) T6_A = FloatItem("T6 A", default=1., unit="K").set_prop("display", format="%4.2f") T6_B = FloatItem("T6 B", default=1., unit="K").set_prop("display", format="%4.2f") T7_A = FloatItem("T7 A", default=1., unit="K").set_prop("display", format="%4.2f") T7_B = FloatItem("T7 B", default=1., unit="K").set_prop("display", format="%4.2f") _efb = EndGroup("Other") choice = [(-2, "short circuit"), (-1, "no sensor"), (0, "Pirani"), (1, "Pirani/Cathode")] _bp = BeginGroup("Pressure").set_pos(col=3) P1_Dewar = FloatItem("P1 Dewar", default=0., unit="mbar").set_prop("display", format="%4.2f") P1_Ident = ChoiceItem("P1 Ident.", choice, default=-1) P2_Pump = FloatItem("P2 Pump", default=0., unit="mbar").set_prop("display", format="%4.2f") P2_Ident = ChoiceItem("P2 Ident.", choice, default=-1) _ep = EndGroup("Pressure")
class Controlset(DataSet): Directory = DirectoryItem("Directory", default=os.path.abspath("../../data/")) _bt = BeginGroup("Configuration").set_pos(col=0) Frequency = FloatItem("Frequency", default=21.1, unit="GHz").set_prop("display", format="%3.1f") IntegrationTime = FloatItem("Integration time", default=5., unit="s").set_prop("display", format="%3.1f") BlankTime = IntItem("Blank time", default=5, unit="ms") Antenna = IntItem("Antenna offset", default=1000, unit="") NSpec = IntItem("Spectra per file", default=7000, unit="") _et = EndGroup("Configuration")
class AppSettings( DataSet ): serialports = list_serial_ports() ports = [] for s in serialports: # windows port is only a number if isinstance(s,int): port = s label = 'COM%d' % (port+1) else: port = label = s ports.append( (port, '%s' % label) ) use_virtual_serial = BoolItem(u"Enable virtual serial", help=u"If enabled, data from the testdata directory are used.", default=False) # 'ports' must be a tuble, like (0,'COM1') for windows serialport = ChoiceItem("Serial Port", ports) bh_packets = MultipleChoiceItem("Enable BioHarness Packets", ["RR Data", "Breathing", "ECG", "Summary Packets", "Accelerometer (not implemented yet)"], [0,1]).vertical(1).set_pos(col=0) timedsession = ChoiceItem("Timed Session", [(5, "5 minutes"), (10, "10 minutes"), (15, "15 minutes"), (20, "20 minutes"), (30, "30 minutes")] ) g1 = BeginGroup("Data Storage") # Database storage: enable_database = BoolItem(u"Enable InfluxDB storage", help=u"If disabled, the following parameters will be ignored", default=False).set_prop("display", store=DataStorage_database) db_url = StringItem(u"URL", notempty=True).set_prop("display", active=DataStorage_database) db_port = StringItem(u"Port", notempty=True).set_prop("display", active=DataStorage_database) db_user = StringItem(u"User", notempty=True).set_prop("display", active=DataStorage_database) db_pwd = StringItem(u"Password", notempty=True).set_prop("display", active=DataStorage_database) db_dbname = StringItem(u"Database", notempty=True).set_prop("display", active=DataStorage_database) # Files storage enable_files = BoolItem(u"Enable files storage", help=u"If disabled, the following parameters will be ignored", default=False).set_prop("display", store=DataStorage_files) directory_storage = DirectoryItem("Directory").set_prop("display", active=DataStorage_files) _g1 = EndGroup("Data Storage")
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 TestParameters(DataSet): """ PPT Converter Choose according to your function """ #fname = FileOpenItem("Open file", "ppt", FILE_ppt.name) #_eg = StartGroup("Convert_Mode") PPTnames = FilesOpenItem("Open_files", ("ppt", "pptx"), help="Input your PPT file") ##list outpath = DirectoryItem("OutDirectory", default=PPTnames._props["data"]["basedir"], help="default is the PPt path") outname = StringItem('Outlabel', help="default is the ppt name ") dtime = DateTimeItem("Date/time", default=datetime.datetime( 2017, 10, 10)) #text = TextItem("Text") g1 = BeginGroup("Convert_Mode") # outMode = MultipleChoiceItem("", # ["Raw", "Resized", # ],help="(default concated)",default=(1,)).horizontal(1)#.set_pos(col=1) raw = BoolItem("Raw", default=False, help="normal mode").set_pos(col=0) _prop = GetAttrProp("resize") #choice = ChoiceItem('Choice', choices).set_prop("display", store=_prop) resize = BoolItem("Resized", default=True, help="normal mode").set_pos(col=1).set_prop("display", store=_prop) newsize = IntItem("NewSize(width_dpi)", default=709, min=0, help="if changed,dpi", max=2160, slider=True).set_pos(col=2).set_prop( "display", active=FuncProp(_prop, lambda x: x)).set_pos(col=2) _g1 = EndGroup("Convert_Mode") outFormat = MultipleChoiceItem( "OuterForm", ["Pngs", "Con_Pngs", "PDF", "HTML", "XML"], help="(default all)", default=(0, 1, 2, 3, 4), ).horizontal(1)
class ImageParam(DataSet): #_hide_data = False #_hide_size = True #title = StringItem(_("Title"), default=_("Untitled")).set_prop("display", hide=True) #data = FloatArrayItem(_("Settings")).set_prop("display", # hide=GetAttrProp("_hide_data")) _prop = GetAttrProp("otype") otype = StringItem("Type of data", default="Unknown").set_prop("display", store=_prop) #, hide=True) title = StringItem(_("Title"), default=_("Untitled")).set_prop("display", hide=True) _bg = BeginGroup("Range setting") #feed = ChoiceItem("Feed", [(1, "1"), (2, "2"), (3, "3")]).set_prop("display", active=False) #section = ChoiceItem("Section", [("Ch0", "0"), ("Ch1", "1"), ("Ch2", "2"), # ("Ch3", "3")]).set_pos(col=1, colspan=2) #polar = ChoiceItem("Polar", [(16, "first choice"), (32, "second choice"), # (64, "third choice")]).set_pos(col=2, colspan=2) #_prop = GetAttrProp("otype") #otype = ChoiceItem("Type of data", [("On/Off: off source", "On/Off: off source"), ("OTF", "OTF"), ("Unknown", "Unknown")], default="Unknown").set_prop("display", store=_prop, hide=True) #otype = StringItem("Type of data", default="Unknown").set_prop("display", store=_prop)#, hide=True) rangei = IntItem( _("num. samples begin"), help= _("Select a number of samples at the begin of the data to use for the computation" ), min=0, default=0).set_prop("display", active=FuncProp( _prop, lambda x: x == 'OTF' or x == 'Unknown')) ranges = IntItem( _("num. samples end"), help= _("Select a number of sameples at the end of the data to use for the computation" ), min=0, default=0).set_prop( "display", active=FuncProp(_prop, lambda x: x == 'OTF' or x == 'Unknown')).set_pos( col=1, colspan=2) rall = BoolItem(_("All"), default=True).set_pos(col=2, colspan=2).set_prop( "display", active=FuncProp(_prop, lambda x: x == 'OTF' or x == 'Unknown'), hide=True) excluded = IntItem( _("Excluded samples"), help= _("Select a number of samples to exclude from the computation at the begining and end of the data symmetrically" ), min=0, default=0).set_prop("display", active=FuncProp( _prop, lambda x: x == 'OTF' or x == 'Unknown')) eall = BoolItem(_("All"), default=True).set_pos(col=1, colspan=2).set_prop("display", hide=True) _eg = EndGroup("Range setting") _bg2 = BeginGroup("Fit Range") frangei = IntItem( _("intitial freq sample"), help=_("Select the first freq sample to use for the fit computation"), min=0, default=0) franges = IntItem( _("last freq sample"), help= _("Select the last freq sample to use for the fit computation (if 0 take max)" ), min=0, default=0).set_pos(col=1, colspan=1) _eg2 = EndGroup("Fit Range") #selected = BoolItem(_("Selected"), default=True) selected = ChoiceItem("Selected", [(True, "Yes"), (False, "No")], default=True).set_prop("display", hide=True)
class TestParameters(DataSet): """ PPT_Converter:Based on Glance Choose according to your demond """ def updatedir(self, item, value): print("\nitem: ", item, "\nvalue:", value) if self.PPTnames and value[0]: self.outpath = os.path.split(value[0])[0] print(os.path.split(value[0])) if len(value) > 0: #如果只是选择了单个文件 self.outprefix = os.path.basename(value[0]).split('.')[0] else: #选了多个文件 self.outpath = os.getcwdu() self.outprefix = None self.WebTitle = self.outprefix print("\nitem: ", self.outpath, "\nvalue:", self.WebTitle) #self.ImagesDirName=str(self.newsize) # self.htmlTitle=self.outprefix #fname = FileOpenItem("Open file", "ppt", FILE_ppt.name) #_eg = StartGroup("Convert_Mode") g0 = BeginGroup("Select Your PPTs to Manipulate") PPTnames = FilesOpenItem("OpenPPTs", ("ppt", "pptx"), help="Select your PPT files", all_files_first=True).set_prop( 'display', callback=updatedir) ##list outpath = DirectoryItem( "OutPath", help= "Select the output path.\nDefault is the path where you choose your PPT" ).set_prop('display', active=True) WebTitle = StringItem( 'HTML/XML Title\n(Glance)', help= "The Title of the generated html/xml file.\nDefault is the PPT's filename" ).set_prop('display', active=True) outprefix = StringItem( 'OutFilePrefix', help="The prefix of generated file .\nDefault is the ppt name " ).set_prop('display', active=True) _g0 = EndGroup("Select Your PPTs to Manipulate") g1 = BeginGroup("Select Your Convert_Mode") # outMode = MultipleChoiceItem("", # ["Raw", "Resized", # ],help="(default concated)",default=(1,)).horizontal(1)#.set_pos(col=1) raw = BoolItem( "Raw", default=False, help= "Those Generated Files will Use Pngs Exported from PPT Slides Without any Crop or Resize" ).set_pos(col=0) _prop = GetAttrProp("resize") #choice = ChoiceItem('Choice', choices).set_prop("display", store=_prop) resize = BoolItem( "Resized", default=True, help= "Means You Want to Resize those Raw Pngs Before Use Them In Your Final Formats\ " ).set_pos(col=1).set_prop("display", store=_prop) newsize = IntItem("NewSize\n(width_dpi)", default=709, min=0, help="The Value Must be lower than the raw png's Width!", max=2160, slider=True).set_prop("display", active=FuncProp( _prop, lambda x: x)) ImagesDirName = StringItem( 'ImagesDirName', help= "The DirName of Resized Pngs used in Html/Xml/LongPng file.\nDefault is the Png wideth size If You Leave It Empty" ).set_prop('display', active=FuncProp(_prop, lambda x: x)) _g1 = EndGroup("Select Your Convert_Mode") g2 = BeginGroup("Which Format Do U Want To Generate") must = BoolItem( "Pngs", default=True, help="You Cannot Remove Pngs If You Want to Get Other Types." ).set_prop("display", active=0).set_pos(col=0) outFormat = MultipleChoiceItem( "Optional", ["Long_Png", "PDF", "HTML", "XML"], help= "(Default all,But I won't give U the Long_Png with Raw Pngs.\nAnd the 1st choice('Pngs') is default to generate.)", default=(1, 2, 3)).horizontal(1).set_pos(col=1) _g2 = EndGroup("Which Format Do U Want To Generate")
class ReconstructionParameters(ActivableDataSet): #Preprocessing Parameters #events associated to different parameters def _threshold_change(self, item, value): if self.threshold_change_cb is not None: self.threshold_change_cb() def set_threshold_change_cb(self, cb): self.threshold_change_cb = cb def _unwrap_change(self, item, value): if self.unwrap_change_cb is not None: self.unwrap_change_cb() def set_unwrap_change_cb(self, cb): self.unwrap_change_cb = cb def _use_filter_size_aberration_change(self, item, value): if self.use_filter_size_aberration_change_cb is not None: self.use_filter_size_aberration_change_cb() def set_use_filter_size_aberration_change_cb(self, cb): self.use_filter_size_aberration_change_cb = cb def _use_filter_amplitude_change(self, item, value): if self.use_filter_amplitude_change_cb is not None: self.use_filter_amplitude_change_cb() def set_use_filter_amplitude_change_cb(self, cb): self.use_filter_amplitude_change_cb = cb def _filter_size_aberration_change(self, item, value): if self.filter_size_aberration_change_cb is not None: self.filter_size_aberration_change_cb() def set_filter_size_aberration_change_cb(self, cb): self.filter_size_aberration_change_cb = cb def _bool_deriv_change(self, item, value): if self.bool_deriv_change_cb is not None: self.bool_deriv_change_cb() def set_bool_deriv_change_cb(self, cb): self.bool_deriv_change_cb = cb def _XYImport_change(self, item, value): if self.XYImport_change_cb is not None: self.XYImport_change_cb() def set_XYImport_change_cb(self, cb): self.XYImport_change_cb = cb def _bool_ThresholdMethod_change(self, item, value): if self.bool_ThresholdMethod_change_cb is not None: self.bool_ThresholdMethod_change_cb() def set_bool_ThresholdMethod_change_cb(self, cb): self.bool_ThresholdMethod_change_cb = cb def _particlecontrast_change(self, item, value): if self.particlecontrast_change_cb is not None: self.particlecontrast_change_cb() def set_particlecontrast_change_cb(self, cb): self.particlecontrast_change_cb = cb def _it_eros_change(self, item, value): if self.it_eros_change_cb is not None: self.it_eros_change_cb() def set_it_eros_change_cb(self, cb): self.it_eros_change_cb = cb def _it_dil_change(self, item, value): if self.it_dil_change_cb is not None: self.it_dil_change_cb() def set_it_dil_change_cb(self, cb): self.it_dil_change_cb = cb def _XYImportFilePath_change(self, item, value): if self.XYImportFilePath_change_cb is not None: self.XYImportFilePath_change_cb() def set_XYImportFilePath_change_cb(self, cb): self.XYImportFilePath_change_cb = cb #Initialization of buttons in different groups unwrap = ChoiceItem(_("Unwrap"), [(True, 'Yes'), (False, 'False')], default=False).set_prop("display", callback=_unwrap_change) unwrap_change_cb = None #Group Filtering Filtering_group = BeginGroup("Filtering") use_filter_size_aberration = ChoiceItem( _("Use uniform filter for aberration compensation"), [(True, 'Yes'), (False, 'False')], default=False).set_prop("display", callback=_use_filter_size_aberration_change) use_filter_size_aberration_change_cb = None filter_size_aberration = IntItem( _("Filter size (aberr. compens.)"), default=100, slider=False, unit='pixels', min=1, max=300).set_prop("display", callback=_filter_size_aberration_change) filter_size_aberration_change_cb = None use_filter_amplitude = ChoiceItem( _("Use amplitude Filter"), [(False, 'No'), (True, 'Yes')], default=False).set_prop("display", callback=_use_filter_amplitude_change) use_filter_amplitude_change_cb = None def _adjust_aberration_change(self, item, value, parent): if self.adjust_aberration_change_cb is not None: self.adjust_aberration_change_cb() def set_adjust_aberration_change_cb(self, cb): self.adjust_aberration_change_cb = cb aberration_perform = ButtonItem("Adjust Filtering", callback=_adjust_aberration_change) adjust_aberration_change_cb = None def _bcgRemove_change(self, item, value): if self.bcgRemove_change_cb is not None: self.bcgRemove_change_cb() def set_bcgRemove_change_cb(self, cb): self.bcgRemove_change_cb = cb def _bcgCompute_change(self, item, value, parent): if self.bcgCompute_change_cb is not None: self.bcgCompute_change_cb() def set_bcgCompute_change_cb(self, cb): self.bcgCompute_change_cb = cb _Filtering_group = EndGroup("Filtering") Filtering_group = BeginGroup("Background") bcgRemove = ChoiceItem(_("Background remove"), [(True, 'Yes'), (False, 'False')], default=False).set_prop("display", callback=_bcgRemove_change) bcgRemove_change_cb = None bcgCompute = ButtonItem("Compute Background", callback=_bcgCompute_change) bcgCompute_change_cb = None _Filtering_group = EndGroup("Background") #Import xy (enable/disable importation of file or detection parameters) propImport = GetAttrProp( "XYImport") # to enable/disable Import XY File path if True or False XYImport = ChoiceItem(_("Import XY Position"), [(False, 'No'), (True, 'Yes')], default=False).set_prop("display", callback=_XYImport_change, store=propImport) XYImport_change_cb = None XYImportFilePath = FileOpenItem( "File Path", formats='txt', default=r'D:\Mesures\3DTracking_Donner\15.05.03_46.68\Sequence_import_xy' ).set_prop("display", active=FuncProp(propImport, lambda x: x == True), callback=_XYImportFilePath_change) XYImportFilePath_change_cb = None #Group Detection parameters Detection_group = BeginGroup("Detection XY").set_prop( "display", active=FuncProp(propImport, lambda x: x == False)) bool_deriv = ChoiceItem(_("Derive"), [(True, 'Yes'), (False, 'No')], default=False).set_prop( "display", callback=_bool_deriv_change) bool_deriv_change_cb = None particlecontrast = ChoiceItem(_("Particle Contrast"), [(0, 'Positive'), (1, 'Negative')]).set_prop( "display", callback=_particlecontrast_change) particlecontrast_change_cb = None threshold = FloatItem( ("Threshold"), default=10., slider=False, min=0., max=255, step=1, ).set_prop("display", callback=_threshold_change) threshold_change_cb = None bool_ThresholdMethod = ChoiceItem( _("Threshold Method"), [(-2, 'No threshold/max value'), (-1, 'Manual'), (0, 'Huang'), (2, 'Intermodes'), (3, 'ReniEntropy'), (4, 'Triangle'), (5, 'Otsu'), (6, 'Yen'), (7, 'Moments'), (8, 'IsoData'), (9, 'Peak Detection')], default=0).set_prop("display", callback=_bool_ThresholdMethod_change) bool_ThresholdMethod_change_cb = None #Threshold method #-1=manual #0=Huang #1=Intermodes #2=MaxEntropy #3=ReniEntropy #4=Triangle #5=Otsu #6=Yen #7=Moments #8=IsoData #9=Peak Detection #erosion and dilatation iterations it_eros = IntItem(_("Iter. erosion"), default=1, slider=False, unit='pixels', min=0).set_prop("display", callback=_it_eros_change) it_eros_change_cb = None it_dil = IntItem(_("Iter. dilatation"), default=4, slider=False, unit='pixels', min=0).set_prop("display", callback=_it_dil_change) it_dil_change_cb = None def _adjust_detection_change(self, item, value, parent): if self.adjust_detection_change_cb is not None: self.adjust_detection_change_cb() def set_adjust_detection_change_cb(self, cb): self.adjust_detection_change_cb = cb detection_perform = ButtonItem("Adjust Detection", callback=_adjust_detection_change) adjust_detection_change_cb = None _Detection_group = EndGroup("Detection XY")