Esempio n. 1
0
    def __init__(self, parent, controller):
        self.parent = parent
        self.controller = controller
        tk.Frame.__init__(self, parent)

        self.inyname = Label(self,
                             text="INPUT YOUR NAME",
                             width=17,
                             bg="SteelBlue2",
                             fg="black")

        # create full path
        self.pathcre = r"C:\NLT"
        Path(self.pathcre).mkdir(parents=True, exist_ok=True)
        # return path full
        ps = PathSteel(dir_path=self.pathcre, FileName="nhuan.csv")
        self.pathf = ps.refpath()
        rinput = rcsv(pathtor=self.pathf, indexarrtoget=[0])
        row = rinput.Rerowbyindxaindexarr()
        row = list(set(row))
        self.inynamein = ttk.Combobox(self, values=row)

        self.button = tk.Button(self,
                                text="Next",
                                command=lambda: self.checkinputyourname())
        self.inyname.pack()
        self.inynamein.pack()
        self.button.pack()
Esempio n. 2
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
Esempio n. 3
0
    def __init__(self, root):
        self.root = root
        dirname = os.path.dirname(__file__)

        # ===================================
        self.imagelogopath = PathSteel(dir_path=dirname,
                                       Is_Directory_Path_To_SubFolder=True,
                                       FileName="logo.png",
                                       subfolder="img")
        self.pathconfig1 = PathSteel(dir_path=dirname,
                                     Is_Directory_Path_To_SubFolder=True,
                                     FileName="hrdata_modified.csv",
                                     subfolder="config")
        self.pathconfig = resource_path_is_from_pyinstall_and_dev(
            self.pathconfig1.refpath())

        pathconfigexell = PathSteel(dir_path=dirname,
                                    Is_Directory_Path_To_SubFolder=True,
                                    FileName="conf_ex.xlsx",
                                    subfolder="config")
        self.pathconfigexell = resource_path_is_from_pyinstall_and_dev(
            pathconfigexell.refpath())

        self.imagelogo = ImageTk.PhotoImage(file=self.imagelogopath.refpath())

        # path to config of excel to copy
        self.pathconfigexcelcopy = resource_path_is_from_pyinstall_and_dev(
            PathSteel(dir_path=dirname,
                      Is_Directory_Path_To_SubFolder=True,
                      FileName="config_hm.xlsx",
                      subfolder="config").refpath())

        self.pathtokey = resource_path_is_from_pyinstall_and_dev(
            refullpath(dirpath=dirname,
                       filename="key.key",
                       folderchild="config"))
        self.pathtovaluecsv_key = resource_path_is_from_pyinstall_and_dev(
            refullpath(dirpath=dirname,
                       folderchild="config",
                       filename="fn.csv"))
        self.ser_key = resource_path_is_from_pyinstall_and_dev(
            refullpath(dirpath=dirname,
                       folderchild="config",
                       filename="seri.key"))
        self.valueser_key = resource_path_is_from_pyinstall_and_dev(
            refullpath(dirpath=dirname,
                       folderchild="config",
                       filename="ser.csv"))

        k = key_license(pathtokey=self.pathtokey,
                        pathtoserial_key=self.ser_key,
                        root=self.root,
                        pathtovaluecsv_key=self.pathtovaluecsv_key,
                        pathvalueser_key=self.valueser_key)
        print("returnk", k)
        # account authentication
        """
Esempio n. 4
0
    def __init__(self,
                 pathfolder=None,
                 fileparent="WHITEX - TONG HOP NGAN SACH.xlsx",
                 filekid="AZB-INPUT.xlsx",
                 subfolderinput="0.input",
                 subfolderoutput="1.output",
                 kipnamesheet=[
                     "AZB-20", "AZB-40", "AZB-50", "AZB-60", "AZB-70", "AZB-80"
                 ],
                 runforexcel="both"):
        self.fileparent = fileparent
        self.pathfolder = pathfolder
        self.filekid = filekid
        self.subfolderinput = subfolderinput
        self.subfolderoutput = subfolderoutput
        self.runforexcel = runforexcel
        self.kipnamesheet = kipnamesheet

        self.ps = PathSteel(dir_path=self.pathfolder,
                            Is_Directory_Path_To_SubFolder=True,
                            subfolder=self.subfolderinput,
                            FileName=self.filekid)
        # return file kid
        self.pathkid = self.ps.refpath()
        # return fileparent
        self.ps.subfolder = self.subfolderoutput
        self.ps.FileName = self.fileparent
        self.pathparent = self.ps.refpath()

        self.namesheet = [
            "AZB-10", "AZB-20", "AZB-30", "AZB-40", "AZB-50", "AZB-60",
            "AZB-70", "AZB-80"
        ]
        #set keysheet
        self.keysheet = {self.namesheet[0]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[1]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[2]:[6,4,19,None,6,4,19,None],\
                        self.namesheet[3]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[4]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[5]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[6]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[7]:[41,3,18,None,41,3,18,None]}
Esempio n. 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()
Esempio n. 6
0
def CreateFileExcel(pathin,pathout):
    #filename = "Config_Setting.csv"

    pathconf = PathSteel(dir_path =pathin,
                     FileName = "Config_Setting.csv")\
                    .refpath()

    #fullpath = os.path.join(pathin,filename)

    # get path store data to handling
    Right_Genneral_All_path = PathFromFileNameAndDirpath(dir_path =pathin,
                                                         filename ="Right_Genneral_All.csv"
                                                         )
                                    
    Left_Genneral_All_path = PathFromFileNameAndDirpath(dir_path =pathin,
                                                         filename ="Left_Genneral_All.csv"
                                                         )

    # key value 
    keyvalue = ["ValueGeneral", 
                "Columnmove",
                "LocationCellForMoveColumn",
                "GenneralColumnNotChange",
                "GeneralConcernRaffter",
                "Genneral_Select",
                "LocationOfRowLeft",
                "LocationOfRowRight",
                "ExcelCellForMoveColumnRight",
                "LocationOfPurlin",
                "startrow",
                ]
                
    #location in conf
    locvalue = [12,16,17,19,20,21,23,24,25,26,30]

    credict_c = credict(KeyValues = keyvalue, 
                        LocConf = locvalue,
                        Config_Setting_Path = pathconf)
    credict_list = credict_c.Dictfromkeyandvalueconf()

    # create arr from keyvalue  
    valgen = credict_list.get("ValueGeneral", "")
    colmv = credict_list.get("Columnmove", "")
    locmvcol = credict_list.get("LocationCellForMoveColumn", "")
    gencolnotchg = credict_list.get("GenneralColumnNotChange", "")
    genconraf = credict_list.get("GeneralConcernRaffter", "")
    gensel = credict_list.get("Genneral_Select", "")
    locrowleft = credict_list.get("LocationOfRowLeft", "")
    locrowright = credict_list.get("LocationOfRowRight", "")
    excemvcolright = credict_list.get("ExcelCellForMoveColumnRight", "")
    locpur = credict_list.get("LocationOfPurlin", "")
    strow = credict_list.get("startrow", "")

    # data template  
    if IsRunningInPyinstallerBundle():
        #NameFile = ExtractFileNameFromPath(DataExcel)
        DataExcel = resource_path_is_from_pyinstall_and_dev(FileName = 'DataALL - Template.xlsx',
                                                         Subfolder="Data",
                                                         Is_Directory_Path_To_SubFolder= True,
                                                         dir_path=sys._MEIPASS)

    else:
        # get file excel from template excel (full path)
        DataExcel = PathSteel(modulename =templatexc,
                             FileName ='DataALL - Template.xlsx')\
                            .getpathmodule()
            
        """
        DataExcel = os.path.join((os.path.dirname(templatexc.__file__)),
                                'DataALL - Template.xlsx') 
        """

    book = load_workbook(DataExcel)
    writer = ExcelWriter(DataExcel,
                        engine='openpyxl')
    writer.book = book
    writer.sheets = dict((ws.title, ws) for ws in book.worksheets)

    for path in [Left_Genneral_All_path,
                Right_Genneral_All_path]:
            
            df1 = pd.read_csv(path, delimiter=',',
                                    index_col = 0)
            dfCount = df1.shape
            df1.to_csv(path)
            #write Left to Excel 
            dfValueGeneral = pd.read_csv(path, 
                                        delimiter=',',
                                        usecols  = valgen,
                                        nrows= 1)

            dfValueGeneral.to_excel(writer,'General Member',
                                    index=False,header=True ,
                                    startcol=0,startrow \
                                    = strow[0])

            worksheet = writer.sheets['General Member']

            # create frame to excel 
            excellframe = toexcel(worksheet = worksheet,
                                            path = path,
                                            path_conf =pathconf,
                                            lpath=Left_Genneral_All_path,
                                            rpath = Right_Genneral_All_path)

            if path == Left_Genneral_All_path:
                usecolsArr = locrowleft
                LocationMoveColumn = locmvcol
                #write path to excel 
                excellframe.wrivaltoexc()
            else:
                usecolsArr = locrowright
                LocationMoveColumn = excemvcolright
                #write path to excel 
                excellframe.wrivaltoexc()
            #Write genneral to excel
            DfChangegenneral = pd.read_csv(path,
                                         delimiter=',',
                                         usecols = gencolnotchg,
                                         nrows= 1 
                                         )

            DfChangegenneral.to_excel(writer,
                                    'General Member',
                                    index=False,
                                    header=True,
                                    startcol=0,
                                    startrow= int(usecolsArr[1])
                                    )

            #write Genneral Concern Raffter
            DfChangegenneral = pd.read_csv(path,
                                             delimiter=',',
                                             usecols = genconraf 
                                             )

            DfChangegenneral.to_excel(writer,
                                    'General Member',
                                    index=False,
                                    header=True ,
                                    startcol=0,
                                    startrow=int(usecolsArr[2])
                                    )

            #write genneral selected 
            DfChangegenneral = pd.read_csv(path,
                                     delimiter=',',
                                     usecols = gensel,
                                     nrows= 1)
            DfChangegenneral.to_excel(writer,
                                    'General Member',
                                    index=False,
                                    header=True ,
                                    startcol=0,
                                    startrow= int(usecolsArr[0])
                                    )

            #write purlin roof 
            DfChangegenneral = pd.read_csv(path,
                                         delimiter=',',
                                         usecols = locpur,
                                         nrows= 1)

            DfChangegenneral.to_excel(writer,
                                    'General Member',
                                    index=False,
                                    header=True ,
                                    startcol=0,
                                    startrow= int(usecolsArr[3]))
            worksheet = writer.sheets['General Member']

            #Wirte move Column to excel
            excellframe.writemovecol(LocationMoveColumn,
                                                colmv)
    # create full path from dirpath 
    path = PathSteel(dir_path =pathout,
                     FileName ='new_big_file.xlsx')\
                    .refpath()
    #path = os.path.join(pathout,'new_big_file.xlsx') 
    book.save(path) 
Esempio n. 7
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()
Esempio n. 8
0
 def dowloadfilexcelfromeven(self, fullname):
     # save as file path from path original
     pathst = PathSteel(pathorigrn=fullname)
     pathst.saveasfiletopathAndopen()
Esempio n. 9
0
class azbg:
    def __init__(self, root):
        self.root = root
        dirname = os.path.dirname(__file__)

        # ===================================
        self.imagelogopath = PathSteel(dir_path=dirname,
                                       Is_Directory_Path_To_SubFolder=True,
                                       FileName="logo.png",
                                       subfolder="img")
        self.pathconfig1 = PathSteel(dir_path=dirname,
                                     Is_Directory_Path_To_SubFolder=True,
                                     FileName="hrdata_modified.csv",
                                     subfolder="config")
        self.pathconfig = resource_path_is_from_pyinstall_and_dev(
            self.pathconfig1.refpath())

        pathconfigexell = PathSteel(dir_path=dirname,
                                    Is_Directory_Path_To_SubFolder=True,
                                    FileName="conf_ex.xlsx",
                                    subfolder="config")
        self.pathconfigexell = resource_path_is_from_pyinstall_and_dev(
            pathconfigexell.refpath())

        self.imagelogo = ImageTk.PhotoImage(file=self.imagelogopath.refpath())

        # path to config of excel to copy
        self.pathconfigexcelcopy = resource_path_is_from_pyinstall_and_dev(
            PathSteel(dir_path=dirname,
                      Is_Directory_Path_To_SubFolder=True,
                      FileName="config_hm.xlsx",
                      subfolder="config").refpath())

        self.pathtokey = resource_path_is_from_pyinstall_and_dev(
            refullpath(dirpath=dirname,
                       filename="key.key",
                       folderchild="config"))
        self.pathtovaluecsv_key = resource_path_is_from_pyinstall_and_dev(
            refullpath(dirpath=dirname,
                       folderchild="config",
                       filename="fn.csv"))
        self.ser_key = resource_path_is_from_pyinstall_and_dev(
            refullpath(dirpath=dirname,
                       folderchild="config",
                       filename="seri.key"))
        self.valueser_key = resource_path_is_from_pyinstall_and_dev(
            refullpath(dirpath=dirname,
                       folderchild="config",
                       filename="ser.csv"))

        k = key_license(pathtokey=self.pathtokey,
                        pathtoserial_key=self.ser_key,
                        root=self.root,
                        pathtovaluecsv_key=self.pathtovaluecsv_key,
                        pathvalueser_key=self.valueser_key)
        print("returnk", k)
        # account authentication
        """
        #write_key(self.ser_key)
        key = load_key(self.ser_key)
        try:
            valueser_key = decrypt(filename=self.valueser_key,key = key)
        except:
            valueser_key = None
        #encrypt(filename=self.valueser_key,key = key,nametow=b"actived")
        aucre = authkey(
                        product_id=7018,
                        key=valueser_key,
                        pathtokey = self.pathtokey,
                        pathtovaluecsv_key = self.pathtovaluecsv_key
                        )
        if aucre == False:
            self.createinputserial()
        else:
            self.guiforgd()
        """

    def createinputserial(self):
        gui(tktk=self.root,
            pathico=None,
            width=400,
            height=300,
            widthx=420,
            widthy=0,
            resizable=[True, True],
            title="AZB").setcfbs()

        self.canvas1 = tk.Canvas(root, width=400, height=300, bg="#5b9bd5")
        self.canvas1.pack()
        self.canvas1.create_text(200,
                                 100,
                                 text="Input Serial Number",
                                 fill="darkblue",
                                 font="Times 20 italic bold")
        self.entry1 = tk.Entry(root,
                               width=25,
                               justify=tk.CENTER,
                               font="Times 15 italic")
        self.canvas1.create_window(200, 140, window=self.entry1)
        button1 = tk.Button(text='OK',
                            command=self.getSquareRoot,
                            font="Times 15 italic")
        self.canvas1.create_window(200, 180, window=button1)

    def getSquareRoot(self):
        x1 = self.entry1.get()
        #label1 = tk.Label(root, text= float(x1)**0.5)
        aucre = authkey(product_id=7018,
                        key=str(x1),
                        pathtokey=self.pathtokey,
                        pathtovaluecsv_key=self.pathtovaluecsv_key)
        label1 = tk.Label(root,
                          text="the key is invalid or it can not be activated",
                          fg="red")

        if aucre == False:
            self.canvas1.create_window(200, 230, window=label1)
        else:
            write_key(self.ser_key)
            key = load_key(self.ser_key)
            encrypt(filename=self.valueser_key,
                    key=key,
                    nametow=str(x1).encode('utf_8'))
            self.canvas1.destroy()
            self.guiforgd()

    def guiforgd(self):
        gui(tktk=self.root,
            pathico=None,
            width=700,
            height=700,
            widthx=420,
            widthy=0,
            resizable=[True, True],
            title="AZB").setcfbs()

        self.sc = scbg(parent=self.root,
                       cavheight=420,
                       cavwidth=470,
                       isonlyaframe=False,
                       bg="#e6ecf5",
                       bgpr="#5b9bd5",
                       framea=[0, 0, 470, 130, "#e6ecf5"],
                       frameb=[0, 130, 470, 100, "white"],
                       framec=[0, 240, 470, 160, "#e6ecf5"])
        self.framea = self.sc.framea
        self.frameb = self.sc.frameb
        self.framec = self.sc.framec
        large_font = ("times new roman", 12)
        lbt = tk.Label(
            self.framea,
            bg="#e6ecf5",
            image=self.imagelogo,
        )
        lbt.grid(row=0, column=0, columnspan=3, sticky=tk.EW)
        # path to folder child
        lbt1 = tk.Label(
            self.framea,
            text="Path To Folder:",
            width=10,
            font=large_font,
            bg="#e6ecf5",
        )
        lbt1.grid(row=1, column=0, sticky=tk.W)
        # create output text, it is used to save directory
        self.output1 = tk.Entry(self.framea,
                                font=large_font,
                                justify=tk.CENTER,
                                width=40,
                                relief=tk.SOLID,
                                bg="yellow")
        self.output1.grid(
            row=1,
            column=1,
        )
        button = tk.Button(self.framea,
                           height=1,
                           width=4,
                           bd=1,
                           command=lambda: self.mfolderopenchild())
        button.grid(row=1, column=2, sticky="we")

        # path to folder parent file
        lbt1 = tk.Label(self.framec,
                        text="Path To Pfile:",
                        width=10,
                        font=large_font,
                        bg="#e6ecf5")
        lbt1.grid(row=0, column=0, sticky=tk.W)
        # frame c
        # create output text, it is used to save directory
        self.output1p = tk.Entry(self.framec,
                                 font=large_font,
                                 justify=tk.CENTER,
                                 width=40,
                                 relief=tk.SOLID,
                                 bg="yellow")

        self.output1p.grid(
            row=0,
            column=1,
        )
        button = tk.Button(self.framec,
                           height=1,
                           width=4,
                           bd=1,
                           command=lambda: self.mfileopenparent())
        button.grid(row=0, column=2, sticky="we")
        #copy past range
        self.openfile5 = tk.Button(self.framec,
                                   text="Copy HM",
                                   width=10,
                                   height=1,
                                   command=lambda: crangeactive(
                                       pathconf=self.pathconfig,
                                       pathconfigexcelcopy=self.
                                       pathconfigexcelcopy).copyrangfromconf())
        self.openfile5.grid(row=1, column=1, sticky="w")

        #copy past range
        self.openfile5 = tk.Button(
            self.framec,
            text="Fct",
            width=10,
            height=1,
            command=lambda: hdatahm(pathconf=self.pathconfig))
        self.openfile5.grid(row=1, column=1, sticky="e")

        #only handling data tong hop
        self.openfile2 = tk.Button(
            self.framec,
            text="ValueFTHVT",
            width=10,
            height=1,
            command=lambda: hexcel(pathconf=self.pathconfig
                                   ).valuehangmucforthvt())
        self.openfile2.grid(row=2, column=1, sticky="w")

        #only handling to parent
        self.openfile4 = tk.Button(
            self.framec,
            text="Update Data",
            width=10,
            height=1,
            command=lambda: hexcel(pathconf=self.pathconfig,
                                   pathconfigexcelcopy=self.pathconfigexcelcopy
                                   ).gdatafromothersheet())

        self.openfile4.grid(row=2, column=1, sticky="e")

        #only handling data kid
        self.openfile1 = tk.Button(self.framec,
                                   text="Child",
                                   width=10,
                                   height=1,
                                   command=lambda: self.hdatafilechecked())

        self.openfile1.grid(row=3, column=1, sticky="w")

        #only handling to parent
        self.openfile3 = tk.Button(self.framec,
                                   text="Run To Parent",
                                   width=10,
                                   height=1,
                                   command=lambda: self.getCheckedItem())

        self.openfile3.grid(row=3, column=1, sticky="e")

        # open conf excel
        self.openfile3a = tk.Button(
            self.framec,
            text="open config",
            width=10,
            height=1,
            command=lambda: openexcelbyxl(self.pathconfigexell))
        self.openfile3a.grid(row=4, column=1, sticky="w")

        # open conf excel
        self.openfile3b = tk.Button(
            self.framec,
            text="update config",
            width=10,
            height=1,
            command=lambda: hconfazb(pathconf=self.pathconfig,
                                     pathexconf=self.pathconfigexell
                                     ).convertocsv())
        self.openfile3b.grid(row=4, column=1, sticky="e")

        # open conf excel
        self.openfile3a = tk.Button(
            self.framec,
            text="Temp excelhm",
            width=10,
            height=1,
            command=lambda: openexcelbyxl(self.pathconfigexcelcopy))
        self.openfile3a.grid(row=5, column=1, sticky="w")

        #only handling to parent
        self.openfile5 = tk.Button(
            self.framec,
            text="Update PTVT",
            width=10,
            height=1,
            command=lambda: covertcsvexcel(pathconf=self.pathconfig))
        self.openfile5.grid(row=5, column=1, sticky="e")

        #quit widget
        buttom_quit = tk.Button(self.framec,
                                text="Exit",
                                width=10,
                                height=1,
                                command=self.root.quit)
        buttom_quit.grid(row=3, column=1)

    # open file follow directory
    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)

    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)

    def getCheckedItem(self):
        """ get checked item """
        listcheked = self.cb.getCheckedItems()
        for eleexcell in listcheked:
            pathtocopy = refullpath(dirpath=self.pathin, filename=eleexcell)
            cexcel(pathdes=self.pathfilep,
                   pathtocopy=pathtocopy,
                   pathconf=self.pathconfig).copysheettoexcelexist()

    def hdatafilechecked(self):
        """halding data value"""
        listcheked = self.cb.getCheckedItems()
        for eleexcell in listcheked:
            pathtocopy = refullpath(dirpath=self.pathin, filename=eleexcell)
            hexcel_child(pathtocopy=pathtocopy,
                         pathconf=self.pathconfig).runaz30azb60()
Esempio n. 10
0
class kidtomother:
    def __init__(self,
                 pathfolder=None,
                 fileparent="WHITEX - TONG HOP NGAN SACH.xlsx",
                 filekid="AZB-INPUT.xlsx",
                 subfolderinput="0.input",
                 subfolderoutput="1.output",
                 kipnamesheet=[
                     "AZB-20", "AZB-40", "AZB-50", "AZB-60", "AZB-70", "AZB-80"
                 ],
                 runforexcel="both"):
        self.fileparent = fileparent
        self.pathfolder = pathfolder
        self.filekid = filekid
        self.subfolderinput = subfolderinput
        self.subfolderoutput = subfolderoutput
        self.runforexcel = runforexcel
        self.kipnamesheet = kipnamesheet

        self.ps = PathSteel(dir_path=self.pathfolder,
                            Is_Directory_Path_To_SubFolder=True,
                            subfolder=self.subfolderinput,
                            FileName=self.filekid)
        # return file kid
        self.pathkid = self.ps.refpath()
        # return fileparent
        self.ps.subfolder = self.subfolderoutput
        self.ps.FileName = self.fileparent
        self.pathparent = self.ps.refpath()

        self.namesheet = [
            "AZB-10", "AZB-20", "AZB-30", "AZB-40", "AZB-50", "AZB-60",
            "AZB-70", "AZB-80"
        ]
        #set keysheet
        self.keysheet = {self.namesheet[0]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[1]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[2]:[6,4,19,None,6,4,19,None],\
                        self.namesheet[3]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[4]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[5]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[6]:[41,3,18,None,41,3,18,None],\
                        self.namesheet[7]:[41,3,18,None,41,3,18,None]}

    def transferdatatoparent(self):
        """ tranfer data to parent """
        for ns in self.namesheet:
            vals = self.keysheet.get(ns)
            if ns in self.kipnamesheet:
                continue
            else:
                self.ht = hdata (pathfile=self.pathkid,sheetname=ns,\
                                rowindexstart=vals[0],columnmh=vals[1],\
                                columntotp=vals[2],valuecelltoskip=vals[3],\
                                pathfile_to=self.pathparent,sheetname_to=ns,\
                                rowindexstart_to=vals[4],columnmh_to=vals[5],\
                                columntotp_to=vals[6],valuecelltoskip_to=vals[7]
                                )
                if self.runforexcel == "kid":
                    self.ht.hldatakid()
                elif self.runforexcel == "mother":
                    self.ht.hldataparent()
                else:
                    self.ht.hldatakid()
                    self.ht.hldataparent()