Example #1
0
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)
Example #2
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)
Example #3
0
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)
Example #4
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)
Example #5
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)
Example #6
0
class MyFilePicker(DataSet):
	files = FilesOpenItem(label='choose files', basedir='/Users/kristen/PycharmProjects')
Example #7
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")