示例#1
0
 def returnlistfileinfolder(self):
     """ return list file in folder"""
     pathtocopy = getpathfromtk(self.output1)
     lfilecopy = listfileinfolder(pathtocopy)
     lfileafterfilter = filterlistbylstr (criteria=[".gif",".jpg"],
                                         liststr=lfilecopy)
     return lfileafterfilter
示例#2
0
 def mfileopend(self, outputtk, combopc):
     mfileopen(outputtk)
     pathfilep = getpathfromtk(outputtk, Warning_path_existing=False)
     lsheets = listsheetofwb(pathfilep)
     try:
         combopc.config(values=["Active Sheet"] + lsheets)
     except:
         pass
示例#3
0
 def mfileopenparent(self):
     """ open file parent"""
     self.output1p.delete(0, 'end')
     # ask directory
     files = filedialog.askopenfilename(title="Directory of parent file",
                                        initialdir=self.output1p.get())
     self.output1p.insert(tk.END, files)
     # get path from entry
     self.pathfilep = getpathfromtk(self.output1p)
示例#4
0
def getdirpathfromorigin(output1):
    # Get path full
    global pathinout
    pathinout = getpathfromtk(output1)
    filename = ExtractFileNameFromPath(pathinout)
    filename1 = getfilenamewoexten(filename)
    # get dirpath from full path
    dn = getdirpath(pathinout)

    ps = PathSteel(dir_path=dn, FileName=filename1 + ".csv")
    pathf = ps.refpath()
    return pathf
示例#5
0
    def synserverfileexc(self, pathtemp, indexcol=None):
        filenametemp = ExtractFileNameFromPath(path=pathtemp)

        dirname = abspath("")
        fullname = PathFromFileNameAndDirpath(dir_path=dirname,
                                              filename=filenametemp)
        ########################################
        pathfulloutput = getpathfromtk(output1)
        filename = ExtractFileNameFromPath(pathfulloutput)
        dbk = nmgui(tktk=self.master).returndirpath(
            getfilenamewoexten(filename))
        ########################################
        #create diff forder for diff file
        dirpathdiff = nmgui(tktk=self.master).returndirpath("diff_history")
        inynameing1 = inynameing.replace(" ", " ")
        pathdiff = PathFromFileNameAndDirpath(dir_path = dirpathdiff,
                                            filename = dt_string_sr +\
                                                 "_" + inynameing1 +\
                                                      "_" + filename)

        ps = PathSteel(dir_path =dbk,
                        FileName = dt_string_sr +\
                                "_" + inynameing1 +\
                                     "_" + filename)
        dbk_fullpath = ps.refpath()

        #get path to orginal location with file name diff

        comparetwofile1 = comparetwofile(
            path_OLD=pathtemp,
            path_NEW=fullname,
            index_col=None,
            usernamein=inynameing1,
            pathtcsvtosavedata=getdirpathfromorigin(output1),
            difpathtobk=dbk_fullpath,
            pathtorgindiff=pathdiff,
            dt=dt_string)
        comparetwofile1.excel_diff()
示例#6
0
    def mfolderopenchild(self):
        """ open folder of child files"""
        try:
            closeallfileexcel(namek_ofpname="AZB")
        except:
            pass
        self.output1.delete(0, 'end')
        # ask directory
        files = filedialog.askdirectory(title="Directory of child files",
                                        initialdir=self.output1.get())
        self.output1.insert(tk.END, files)
        # get path from entry
        self.pathin = getpathfromtk(self.output1)
        try:
            self.scf.destroy()
        except:
            pass
        self.scf = scrollbarvn(parent=self.frameb, bg="white")
        self.scframe = self.scf.frame
        if self.pathin:
            # return list in folder
            fpexcel = listfileinfolder(self.pathin)
            # filter file in folder
            plist = filterlistbylstr(criteria=["AZB"], liststr=fpexcel)

            # return list path excel sheeet
            lpsheet = [
                refullpath(dirpath=self.pathin, filename=fpname)
                for fpname in plist
            ]

            # return list sheet excel
            lsexcel = listexcel(l_ex=lpsheet).returnlsheet()
            # create check list box
            self.cb = ChecklistBox(parent=self.scframe,
                                   choices=plist,
                                   listsheetname=lsexcel,
                                   width=123)
示例#7
0
 def returnfiletocopyquotation(self):
     """ return path file excel in folder """
     return getpathfromtk(self.output2)
示例#8
0
    def guiforgd(self):
        """Create interface for software"""
        gui(tktk=self.root,
            pathico=None,
            width=700,
            height=420,
            widthx=420,
            widthy=0,
            resizable=[True, True],
            title="FAPP").setcfbs()

        self.sc = scbg(
            parent=self.root,
            cavheight=250,
            cavwidth=365,
            isonlyaframe=False,
            bg="#e6ecf5",
            bgpr="#5b9bd5",
            framea=[0, 0, 365, 250, "#e6ecf5"],
        )
        large_font = ("times new roman", 12)
        large_font_1 = ("times new roman", 17)
        lb = tk.Label(self.root,
                      text="Mr.Nhuần - [email protected]",
                      font=large_font,
                      bg="#5b9bd5")
        lb.place(relx=0.5, rely=0.87, anchor=tk.CENTER)

        self.framea = self.sc.framea

        lbt = tk.Label(
            self.framea,
            bg="#e6ecf5",
            fg="black",
            text="Input your information",
            font=large_font_1,
        )
        lbt.grid(row=0, column=0, columnspan=6, sticky=tk.EW)
        # path to folder child
        repath = tk.Label(
            self.framea,
            text="Retrieve Path:",
            width=10,
            font=large_font,
            bg="#e6ecf5",
        )
        repath.grid(row=1, column=0, sticky=tk.W, padx=(5, 0))

        self.output1 = tk.Entry(
            self.framea,
            font=large_font,
            justify=tk.CENTER,
            width=20,
            relief=tk.SOLID,
            bg="yellow",
        )
        self.output1.grid(row=2, column=0, padx=(5, 0))

        button = tk.Button(self.framea,
                           height=1,
                           width=2,
                           bd=1,
                           command=lambda: self.mfileopend(
                               outputtk=self.output1, combopc=self.combopc))
        button.grid(row=2, column=1, sticky="we")

        lsheets = None
        self.pc = tk.StringVar()
        self.combopc = ttk.Combobox(
            self.framea,
            textvariable=self.pc,
            width=20,
            values=["Active Sheet", "Select Sheet Name"],
            state="readonly",
            justify='center')

        self.combopc.grid(column=2, row=2, padx=(10, 0))

        self.combopc.bind("<<ComboboxSelected>>", self.selected_rev)
        self.combopc.current(1)

        # destination
        repathdes = tk.Label(
            self.framea,
            text="Destination Path:",
            font=large_font,
            bg="#e6ecf5",
        )
        repathdes.grid(row=3, column=0, sticky=tk.W, pady=(5, 0), padx=(5, 0))

        self.repathdes = tk.Entry(
            self.framea,
            font=large_font,
            justify=tk.CENTER,
            relief=tk.SOLID,
            bg="yellow",
        )
        self.repathdes.grid(row=4, column=0, sticky=tk.EW, padx=(5, 0))

        buttondes = tk.Button(
            self.framea,
            height=1,
            width=4,
            bd=1,
            command=lambda: self.mfileopend(outputtk=self.repathdes,
                                            combopc=self.combo_des))
        buttondes.grid(row=4, column=1, sticky="we")

        self.pc_des = tk.StringVar()
        self.combo_des = ttk.Combobox(
            self.framea,
            textvariable=self.pc_des,
            width=15,
            values=["Active Sheet", "Select Sheet Name"],
            state="readonly",
            justify='center')
        self.combo_des.grid(column=2, row=4, sticky=tk.EW, padx=(10, 0))

        self.combo_des.current(1)

        self.combo_des.bind("<<ComboboxSelected>>", self.selected_des)

        func = tk.Label(
            self.framea,
            text="Function Excel:",
            font=large_font,
            bg="#e6ecf5",
        )
        func.grid(row=5, column=0, sticky=tk.W, padx=(5, 0))
        self.pc_fun = tk.StringVar()

        lfun = ["Select Function In Excel"] + filterlistbylstr(
            liststr=list(returndictrowforcsv(self.pathconfig).keys()),
            criteria_is_not=True,
            criteria=["sub_"],
            upper=True)
        self.combo_fun = ttk.Combobox(self.framea,
                                      textvariable=self.pc_fun,
                                      width=15,
                                      values=lfun,
                                      state="readonly",
                                      justify='center')
        self.combo_fun.grid(column=0,
                            row=6,
                            columnspan=3,
                            sticky=tk.EW,
                            padx=(5, 0))

        self.combo_fun.current(0)

        self.combo_fun.bind("<<ComboboxSelected>>", self.selected_des)

        button_open = tk.Button(
            self.framea,
            height=1,
            width=8,
            text="Open_Conf",
            bd=1,
            command=lambda: openexcelbyxl(self.pathconfigexell))
        button_open.grid(row=7, column=0, sticky="w", padx=(5, 0))

        button_conf = tk.Button(
            self.framea,
            height=1,
            width=8,
            text="Up_Conf",
            bd=1,
            command=lambda: hconfazb(pathconf=self.pathconfig,
                                     pathexconf=self.pathconfigexell
                                     ).convertocsv())
        button_conf.grid(row=7, column=2, sticky="e")

        run = tk.Button(self.framea,
                        height=1,
                        width=4,
                        text="Run",
                        bd=1,
                        command=lambda: fformulas(
                            retr_path=getpathfromtk(
                                self.output1, Warning_path_existing=False),
                            des_path=getpathfromtk(
                                self.repathdes, Warning_path_existing=False),
                            retr_sheetname=self.pc.get(),
                            des_sheetname=self.pc_des.get(),
                            fuction=self.pc_fun.get(),
                            pathconf=self.pathconfig).filltoexcell())
        run.grid(row=9, column=1, sticky="e")

        run = tk.Button(self.framea,
                        height=1,
                        width=4,
                        text="Quit",
                        bd=1,
                        command=self.root.quit)
        run.grid(row=10, column=1, sticky="e")
示例#9
0
 def openfile1(self, output):
     # get path full
     self.pathinout = getpathfromtk(output)
     # save as file path from path original
     pathst = PathSteel(pathorigrn=self.pathinout)
     pathst.saveasfiletopathAndopen()
示例#10
0
    def getfullnamefromoutput(self):

        pathfulloutput = getpathfromtk(output1)
        return pathfulloutput