예제 #1
0
파일: gui.py 프로젝트: KGerring/lintful
class PyLintSelectDataSet(DataSet):
	
	def cb_run_button(self, item, value, parent=None):
		print("\nitem: ", item, "\nvalue:", value)
		if self.results is None:
			self.results = ''
		self.results += str(value) + '\n'
		print("results:", self.results)
		#return value
	
	def cb_run_files(self, item, value):
		print("\nitem: ", item, "\nvalue:", value)
		#self.dictitem.set_default('files', [])
		if self.openfiles is not None:
			self.dictitem['files'].extend(self.openfiles)
		else:
			self.dictitem['files'].extend([])
		#
		#if self.dictitem is None:
		#	self.dictitem = {}
		#for i,v in enumerate(value):
		#	self.dictitem[i]  = v
		print(self.dictitem)
	
	openfiles = FilesOpenItem('lint files', formats='py',
	                          check=True).set_prop('display', callback=cb_run_files)
	opendirectory = DirectoryItem('lint_directory',
		default='/Users/kristen/PycharmProjects/proj/lintful/lintful')
	
	run_button = ButtonItem('run_linter', callback =cb_run_button, default = False)
	#run_button.bind(ResponsiveDataSet)
	#ditem = DataItem('data', True)
	results = TextItem("Results")
	dictitem = DictItem('dictionary', default = {'files': []}).set_prop("display", active=True)
예제 #2
0
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")
예제 #3
0
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)
예제 #4
0
파일: _gui_tmp.py 프로젝트: BD75/mpsrad
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")
예제 #5
0
class RemoteParameters(ActivableDataSet):  #Sequence parameters
    #read database to know default directory
    db = SqliteDB.DBReader()
    directoryPath = DirectoryItem("Seq. dir.", default=db.DefaultDirectory)
    first_holo_seq = IntItem(_("First hologram"), default=0, min=0)
    #last holo seq is defined with framesNumberProp that is modified when a new directory is choose
    last_holo_seq = IntItem(_("Last hologram"), default=framesNumberprop)
    saveAllStack = ChoiceItem(_("Save All stacks"), [(True, 'Yes'),
                                                     (False, 'False')],
                              default=False)
예제 #6
0
    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")
예제 #7
0
class RemoteParameters(ActivableDataSet):  #Sequence parameters
    # read database to know default directory
    db = SqliteDB.DBReader()
    directoryPath = DirectoryItem("Seq. dir.", default=db.DefaultDirectory)
    first_holo_seq = IntItem(_("First hologram"), default=0, min=0)
    # last holo seq is defined with framesNumberProp that is modified when a
    # new directory is choose
    last_holo_seq = IntItem(_("Last hologram"), default=0, min=0)
    #    saveAllStack = ChoiceItem(_("Save All stacks"), [(True, 'Yes'),
    #                              (False, 'False')], default=False)
    #create list of choice from database
    db = SqliteDB.DBReader()
    choice = db.choiceItemDB()
    MODB = ChoiceItem(_("Magnification"), choice).set_prop("display",
                                                           callback=None)
예제 #8
0
파일: gui.py 프로젝트: zanppa/motor-sim
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")
예제 #9
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")
예제 #10
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)
예제 #11
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)
예제 #12
0
class SubDataSet(DataSet):
    dir = DirectoryItem("Directory", TEMPDIR)
    fname = FileOpenItem("Single file (open)", ("csv", "eta"), FILE_CSV.name)
    fnames = FilesOpenItem("Multiple files", "csv", FILE_CSV.name)
    fname_s = FileSaveItem("Single file (save)", "eta", FILE_ETA.name)
예제 #13
0
class SubDataSet(DataSet):
    dir = DirectoryItem("Directory", TEMPDIR)
    #fname = FileOpenItem("Single file (open)", ("xlsm", "eta"), FILE_xlsm.name)
    fnames = FilesOpenItem("Multiple_files", "xlsm", FILE_xlsm.name)
예제 #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")