예제 #1
0
파일: first_tab.py 프로젝트: Grosss10/Home
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")
예제 #2
0
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")
예제 #3
0
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)
예제 #4
0
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')
예제 #5
0
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")
예제 #6
0
class FitParamDataSet(DataSet):
    name = StringItem(_("Name"))
    value = FloatItem(_("Value"), default=0.0)
    min = FloatItem(_("Min"), default=-1.0)
    max = FloatItem(_("Max"), default=1.0).set_pos(col=1)
    steps = IntItem(_("Steps"), default=5000)
    format = StringItem(_("Format"), default="%.3f").set_pos(col=1)
    logscale = BoolItem(_("Logarithmic"), _("Scale"))
    unit = StringItem(_("Unit"), default="").set_pos(col=1)
예제 #7
0
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")
예제 #8
0
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)
예제 #9
0
파일: formater_OK.py 프로젝트: zXpp/zzpp
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)
예제 #10
0
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")
예제 #11
0
class TaurusTrendParam(DataSet):
    model = StringItem("Model", default="")
    maxBufferSize = IntItem("Buffer Size", default=16384)
    useArchiving = BoolItem("Use Archiving", default=False)
    stackMode = ChoiceItem("Stack Mode", [("datetime", "Absolute Time"),
                                          ("timedelta", "Relative Time"),
                                          ("event", "Event")],
                           default="datetime")

    def update_param(self, curve):
        self.model.update_param(curve.taurusparam.model)
        self.maxBufferSize.update_param(curve.taurusparam.maxBufferSize)
        self.stackMode.update_param(curve.taurusparam.stackMode)

    def update_curve(self, curve):
        curve.setModel(self.model)
        curve.setBufferSize(self.maxBufferSize)
예제 #12
0
 class ModifyParam(DataSet):
     """
     Modification Parameter Setting
     Linear:  New Array = a * Original Array + b <br>
     Moving Average: Decide point number(to get average, or regard it as sinc filter)
     """
     text = StringItem("New Name", default="Modify_" + name)
     a = FloatItem("a :", default=1.0)
     b = FloatItem("b :", default=0.0)
     _en = GetAttrProp("enable")
     enable = BoolItem(
         "Enable Moving Average",
         help="If disabled, the following parameters will be ignored",
         default=False).set_prop("display", store=_en)
     points = IntItem("Window", default=5,
                      min=1).set_prop("display",
                                      active=FuncProp(_en, lambda x: x))
예제 #13
0
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)
예제 #14
0
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")