class Frame_serviceimpl_option(FormatableFrame): ''' classdocs ''' def __init__(self, parent=None, dtos=None, trans=None, **configs): ''' Constructor ''' self.__result = None self.__error = None self.__funclists = {} #functions list backup FormatableFrame.__init__(self, parent.get_mainframe(), dtos, trans, **configs) #overwrite create_widges def create_widges(self): javaconstant = Java_constant() #frame self.__frame1 = FormatableFrame(self) self.__frame1.pack(side=TOP) #Title self.__label01 = Label(self.__frame1, text="ServiceImpl generator options", width=45) self.__label01.pack(side=TOP, fill=X, ipady=10) #---- java validation flag self.__error = None self.__result = True #---- panel 01 ---------- canv1 = Canvas(self, height=30, width=550) #label self.__label01 = Label(canv1, text='ServiceImpl name :') self.__label01.place(height=20, width=130, relx=0.03, rely=0.2) #input self.__feet = StringVar() self.__dicinput = Entry(canv1, textvariable=self.__feet, borderwidth=3, bg='black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__dicinput.place(height=20, width=250, relx=0.3, rely=0.2) canv1.pack() #---- panel 02 ---------- serviceInterDTO = self.get_dtos().get_serviceInterDTO() if not serviceInterDTO: self.__pack_errorpanel() return canv2 = Canvas(self, height=150, width=550) #label01 self.__label01 = Label(canv2, text='Select the functions :') self.__label01.place(height=20, width=150, relx=0.01, rely=0.05) #left listbox and scrollbar self.__listboxleft = Listbox(canv2, width=30) self.__scrollleft = Scrollbar(canv2) self.__listboxleft.config(yscrollcommand=self.__scrollleft.set) self.__listboxleft.place(height=120, width=220, relx=0.02, rely=0.18) self.__scrollleft.place(height=120, width=20, relx=0.42, rely=0.18) self.__scrollleft.config(command=self.__listboxleft.yview) #middle buttons self.__button01 = Button(canv2, text='>', relief=RAISED, cursor='hand2') self.__button01.bind( '<Button-1>', self.__to_right_click_event) #bind button click event self.__button01.place(height=25, width=25, relx=0.465, rely=0.2) self.__button02 = Button(canv2, text='>>', relief=RAISED, cursor='hand2') self.__button02.bind( '<Button-1>', self.__all_to_right_click_event) #bind button click event self.__button02.place(height=25, width=25, relx=0.465, rely=0.4) self.__button03 = Button(canv2, text='<', relief=RAISED, cursor='hand2') self.__button03.bind( '<Button-1>', self.__to_left_click_event) #bind button click event self.__button03.place(height=25, width=25, relx=0.465, rely=0.6) self.__button04 = Button(canv2, text='<<', relief=RAISED, cursor='hand2') self.__button04.bind( '<Button-1>', self.__all_to_left_click_event) #bind button click event self.__button04.place(height=25, width=25, relx=0.465, rely=0.8) #right listbox and scrollbar self.__listboxright = Listbox(canv2, width=30) self.__scrollright = Scrollbar(canv2) self.__listboxright.config(yscrollcommand=self.__scrollright.set) self.__listboxright.place(height=120, width=220, relx=0.52, rely=0.18) self.__scrollright.place(height=120, width=20, relx=0.92, rely=0.18) self.__scrollright.config(command=self.__listboxright.yview) canv2.pack() #---- panel 03 ---------- canv3 = Canvas(self, height=100, width=550) #label label1 = Label(canv3, text='Options:') label1.place(height=20, width=60, relx=0, rely=0) #radio box self.__vari1 = IntVar() self.__rad1 = Radiobutton(canv3, text='Re-write the previous file', variable=self.__vari1, value=1) self.__rad1.place(height=20, width=170, relx=0.1, rely=0.2) self.__rad1.select() self.__rad2 = Radiobutton(canv3, text='Attach new functions to the file', variable=self.__vari1, value=2) self.__rad2.place(height=20, width=210, relx=0.1, rely=0.45) self.__rad2.deselect() self.__rad3 = Radiobutton(canv3, text='Save the previous file as backup', variable=self.__vari1, value=3) self.__rad3.place(height=20, width=220, relx=0.1, rely=0.7) self.__rad3.deselect() canv3.pack() # set the serviceImpl name fileconstant = File_constant() serviceImpl_name = self.get_dtos().get_businessentityname( ) + fileconstant.SERVICEIMPL_SUFFIX + fileconstant.JAVA_SUFFIX self.__feet.set(serviceImpl_name) #set the function list to the left box for javaMtd in serviceInterDTO.get_class_methods(): self.__funclists[javaMtd.get_method_name()] = javaMtd # CRUD functions are mandatory if javaMtd.get_method_name( ) == javaconstant.JAVA_FUNCTION_CREATE or javaMtd.get_method_name( ) == javaconstant.JAVA_FUNCTION_UPDATE or javaMtd.get_method_name( ) == javaconstant.JAVA_FUNCTION_DELETE or javaMtd.get_method_name( ) == javaconstant.JAVA_FUNCTION_FETCH: self.__listboxright.insert(END, javaMtd.get_method_name()) continue #add items into list box self.__listboxleft.insert(END, javaMtd.get_method_name()) #overwrite create_widges def add_bottom(self, parent): #bottom frame exFuncs = { 'Next': { 'process': self.get_nextframe(), 'before': self.before_next }, 'Prev': { 'process': self.get_prevframe(), 'before': self.before_prev } } self.__buttom = Frame_bottom(parent, ['Next', 'Prev'], exFuncs) self.__buttom.pack(fill=X, ipady=10, side=BOTTOM) def before_next(self): ''' overwrite the function in super class verify the input directory ''' if not self.__result: showwarning( 'Warning', 'There are error existing, the ServiceImpl cannot be generated.' ) return # write serviceImpl result, message, filefullpath, javaDTO = Java_processor.create_serviceImpl( self.__feet.get(), self.get_trans(), self.get_dtos(), self.__listboxright.get(0, END), self.__vari1.get()) if not result: showerror('Error', message) return False # store the serviceImpl full path self.get_dtos().set_serviceImplInfo(self.__feet.get(), filefullpath, javaDTO) return True def __pack_errorpanel(self): ''' pack the error panel ''' canv2 = Canvas(self, height=50, width=550) #label01 self.__label01 = Label(canv2, text=self.__error, fg='red') self.__label01.place(height=40, width=500, relx=0.01, rely=0.05) canv2.pack() def __to_right_click_event(self, event): ''' move the selection to the right list box ''' if not self.__listboxleft or self.__listboxleft.size() == 0: return select_item = None if len(self.__listboxleft.curselection()) > 0: selection = self.__listboxleft.selection_get() #the dict.items() will convert to tuple for tup in self.__funclists.items(): if tup[0] == selection: select_item = tup break if select_item: #add into right self.__listboxright.insert(END, select_item[0]) select_idx = self.__listboxleft.curselection() #remove from left self.__listboxleft.delete(select_idx[0]) def __all_to_right_click_event(self, event): ''' move all items to the right list box ''' select_items = [] if len(self.__listboxleft.get(0, END)) > 0: for select_item in self.__listboxleft.get(0, END): select_items.append(select_item) self.__listboxleft.delete(0, END) for select_item in select_items: #add into right self.__listboxright.insert(END, select_item) def __to_left_click_event(self, event): ''' move the selection to the left list box ''' javaconstant = Java_constant() if not self.__listboxright or self.__listboxright.size() == 0: return select_item = None if len(self.__listboxright.curselection()) > 0: selection = self.__listboxright.selection_get() #the dict.items() will convert to tuple idx = 0 for tup in self.__funclists.items(): if tup[0] == selection: if selection == javaconstant.JAVA_FUNCTION_CREATE or selection == javaconstant.JAVA_FUNCTION_UPDATE or selection == javaconstant.JAVA_FUNCTION_DELETE or selection == javaconstant.JAVA_FUNCTION_FETCH: return select_item = tup break idx = idx + 1 if select_item: #add into left self.__listboxleft.insert(idx, select_item[0]) select_idx = self.__listboxright.curselection() #remove from right self.__listboxright.delete(select_idx[0]) def __all_to_left_click_event(self, event): ''' move all items to the right list box ''' javaconstant = Java_constant() select_items = [] if len(self.__listboxright.get(0, END)) > 0: crud_nbr = 0 for select_item in self.__listboxright.get(0, END): if select_item == javaconstant.JAVA_FUNCTION_CREATE or select_item == javaconstant.JAVA_FUNCTION_UPDATE or select_item == javaconstant.JAVA_FUNCTION_DELETE or select_item == javaconstant.JAVA_FUNCTION_FETCH: crud_nbr = crud_nbr + 1 continue select_items.append(select_item) self.__listboxright.delete(crud_nbr, END) for select_item in select_items: #add into right self.__listboxleft.insert(END, select_item)
class Frame_ts_handler_commonservice(FormatableFrame): ''' classdocs ''' def __init__(self, parent=None, dtos=None, trans=None, **configs): ''' Constructor ''' self.__result = True self.__error = None FormatableFrame.__init__(self, parent.get_mainframe(), dtos, trans, **configs) #overwrite create_widges def create_widges(self): fileconstant = File_constant() #frame self.__frame1 = FormatableFrame(self) self.__frame1.pack(side=TOP) #Title self.__label01 = Label(self.__frame1, text="TS CommonService generator options", width=45) self.__label01.pack(side=TOP, fill=X, ipady=10) #---- panel 01 ---------- canv1 = Canvas(self, height=30, width=550) #label self.__label01 = Label(canv1, text='CommonService name :') self.__label01.place(height=20, width=130, relx=0.03, rely=0.2) #input self.__feet = StringVar() self.__dicinput = Entry(canv1, textvariable=self.__feet, borderwidth=3, bg='black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__dicinput.place(height=20, width=250, relx=0.3, rely=0.2) canv1.pack() #---- panel 02 ---------- canv2 = Canvas(self, height=100, width=550) self.__label02 = Label(canv2, text='Please select the imports:', width=30) self.__label02.place(height=20, width=200, relx=0.05, rely=0.02) canv2.pack() # TODO: add import options: constant, MockDTO #---- panel 03 ---------- canv3 = Canvas(self, height=150, width=550) self.__label03 = Label(canv3, text='Please select the contents:', width=30) self.__label03.place(height=20, width=200, relx=0.05, rely=0.02) canv3.pack() if self.get_dtos().get_businessentityname(): # get the mock ds name mock_ds_name = self.get_dtos().get_businessentityname( ) + fileconstant.TS_COMMON_SERVICE_SUFFIX + fileconstant.TS_SUFFIX self.__feet.set(mock_ds_name) #overwrite create_widges def add_bottom(self, parent): #bottom frame exFuncs = { 'Next': { 'process': self.get_nextframe(), 'before': self.before_next }, 'Prev': None } self.__buttom = Frame_bottom(parent, ['Next', 'Prev'], exFuncs) self.__buttom.pack(fill=X, ipady=10, side=BOTTOM) def before_next(self): ''' overwrite the function in super class verify the input directory ''' if not self.__result: showwarning( 'Warning', 'There are error existing, the CommonService cannot be generated.' ) return # --------------------- analysis the DTO if needed --------------------- # if not self.get_dtos().get_tsdtos() or not self.get_dtos( ).get_tsdto_value('TSDtoDTO'): #path constant fileconstant = File_constant() proj_path = self.get_trans().get_projectpath() # get the main table interface name main_tb_name = self.get_dtos().get_maintableInterDTO( ).get_class_name() # get the generated ds name gene_ds_name = fileconstant.TS_DATASET_PREFIX + main_tb_name + fileconstant.TS_SUFFIX # get the generated ds full path gene_ds_filefullpath = proj_path + fileconstant.RESOURCE_TS_MAIN_PATH + fileconstant.RESOURCE_TS_DTO_BL_FOLDER + gene_ds_name # get the mock ds full path mock_ds_filefullpath = proj_path + fileconstant.RESOURCE_TS_MAIN_PATH + fileconstant.RESOURCE_TS_DTO_UI_FOLDER + gene_ds_name.replace( fileconstant.TS_SUFFIX, fileconstant.TS_MOCK_DS_SUFFIX + fileconstant.TS_SUFFIX) # use MockDTO if existing if File_processor.verify_dir_existing(mock_ds_filefullpath): TS_processor.analysis_DTO(self.get_dtos(), mock_ds_filefullpath) elif File_processor.verify_dir_existing(gene_ds_filefullpath): TS_processor.analysis_DTO(self.get_dtos(), gene_ds_filefullpath) else: showerror( 'Error', 'The DTO interface TS is not existing, please check.') return False # create the observable object self.__result, self.__message = TS_processor.create_TS_CommonService( self.get_dtos(), self.get_trans(), self.__feet.get()) if not self.__result: showerror('Error', self.__message) return False return True
class Frame_load_dir(FormatableFrame): ''' classdocs ''' def __init__(self, parent=None, dtos=None, trans=None, **configs): ''' Constructor ''' #initialize self.__filelists = {} #file list backup FormatableFrame.__init__(self, parent.get_mainframe(), dtos, trans, **configs) #overwrite create_widges def create_widges(self): #frame self.__frame1 = FormatableFrame(self) self.__frame1.pack(side=TOP) #title self.__label01 = Label(self.__frame1, text="Open the financial webui project", width=45) self.__label01.pack(side=TOP, fill=X, ipady=10) #---- panel 01 ---------- canv1 = Canvas(self, height=100, width=550) #label01 self.__label01 = Label(canv1, text='Select the project dir:') self.__label01.place(height=20, width=180, relx=0.01, rely=0.1) #input self.__input01 = StringVar() self.__dicinput = Entry(canv1, textvariable=self.__input01, borderwidth=3, bg='black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__dicinput.place(height=20, width=430, relx=0.05, rely=0.4) #button self.__dirloadbutton = Button_select_folder(canv1, self.__select_folder, height=1) self.__dirloadbutton.place(height=20, width=20, relx=0.85, rely=0.4) self.__appbutton = Button(canv1, height=1, text='Apply') self.__appbutton.bind( '<Button-1>', self.__apply_click_event) #bind button click event self.__appbutton.place(height=20, width=40, relx=0.89, rely=0.4) #focus self.__dicinput.focus() #label02 self.__label02 = Label( canv1, text='( Example : D:/workspace/erp-fin/dev/erp-financials-webui/ )', fg='blue') self.__label02.place(height=20, width=400, relx=0.1, rely=0.7) canv1.pack() #---- panel 02 ----------- canv2 = Canvas(self, height=200, width=550) #label01 self.__label01 = Label(canv2, text='Select the entity metadata:') self.__label01.place(height=20, width=180, relx=0.01, rely=0.05) #left listbox and scrollbar self.__listboxleft = Listbox(canv2, width=30) self.__scrollleft = Scrollbar(canv2) self.__listboxleft.config(yscrollcommand=self.__scrollleft.set) self.__listboxleft.place(height=150, width=220, relx=0.02, rely=0.18) self.__scrollleft.place(height=150, width=20, relx=0.42, rely=0.18) self.__scrollleft.config(command=self.__listboxleft.yview) #middle buttons self.__button01 = Button(canv2, text='>>', relief=RAISED, cursor='hand2') self.__button01.bind( '<Button-1>', self.__to_right_click_event) #bind button click event self.__button01.place(height=35, width=25, relx=0.465, rely=0.3) self.__button02 = Button(canv2, text='<<', relief=RAISED, cursor='hand2') self.__button02.bind( '<Button-1>', self.__to_left_click_event) #bind button click event self.__button02.place(height=35, width=25, relx=0.465, rely=0.6) #right listbox and scrollbar self.__listboxright = Listbox(canv2, width=30) self.__scrollright = Scrollbar(canv2) self.__listboxright.config(yscrollcommand=self.__scrollright.set) self.__listboxright.place(height=150, width=220, relx=0.52, rely=0.18) self.__scrollright.place(height=150, width=20, relx=0.92, rely=0.18) self.__scrollright.config(command=self.__listboxright.yview) canv2.pack() #load default info self.load_user_default() #overwrite create_widges def add_bottom(self, parent): #bottom frame exFuncs = { 'Next': { 'process': self.get_nextframe(), 'before': self.before_next }, 'Prev': { 'process': self.get_prevframe(), 'before': self.before_prev } } self.__buttom = Frame_bottom(parent, ['Next', 'Prev'], exFuncs) self.__buttom.pack(side=BOTTOM, fill=X, ipady=10) def __select_folder(self, proj_dir): if proj_dir and proj_dir != "": self.__dicinput.delete(0, END) self.__dicinput.insert(END, proj_dir) def get_dicinput(self): return self.__dicinput.get() def __apply_click_event(self, event): ''' get the entities according to the input project path ''' fileconstant = File_constant() proj_dir = self.__input01.get() #verify the input directory if not File_processor.verify_dir_existing(proj_dir): showerror('Error', 'Please select a valid directory.') if not File_processor.verify_dir_format(proj_dir): showerror('Error', 'Please select a valid forlder, not a file.') return if not File_processor.verify_file(proj_dir + fileconstant.POM_PATH): showerror( 'Error', 'Please select a valid project directory\n(the directory of pom.xml in webui).' ) return #read the entity metadatas result, metas, err_message = Xmlfile_processor.read_proj_dir(proj_dir) if result: #clear the list box first self.__listboxleft.delete(0, END) #backup the list self.__filelists = metas #add items into list box for name in metas.keys(): self.__listboxleft.insert(END, name) else: showerror('Error', err_message) def __to_right_click_event(self, event): ''' move the selection to the right list box ''' if not self.__listboxleft or self.__listboxleft.size() == 0: return if self.__listboxright and self.__listboxright.size() > 0: showerror('Error', 'Multiple entity is not supported for now!') return select_item = None if len(self.__listboxleft.curselection()) > 0: selection = self.__listboxleft.selection_get() #the dict.items() will convert to tuple for tup in self.__filelists.items(): if tup[0] == selection: select_item = tup break if select_item: #add into right self.__listboxright.insert(END, select_item[0]) select_idx = self.__listboxleft.curselection() #remove from left self.__listboxleft.delete(select_idx[0]) def __to_left_click_event(self, event): ''' move the selection to the left list box ''' if not self.__listboxright or self.__listboxright.size() == 0: return if len(self.__listboxright.curselection()) > 0: selection = self.__listboxright.selection_get() #the dict.items() will convert to tuple idx = 0 for tup in self.__filelists.items(): if tup[0] == selection: select_item = tup break idx = idx + 1 if select_item: #add into left self.__listboxleft.insert(idx, select_item[0]) select_idx = self.__listboxright.curselection() #remove from right self.__listboxright.delete(select_idx[0]) def before_next(self): ''' overwrite the function in super class verify the input directory ''' if self.__listboxright.size() > 0: #the dict.items() will convert to tuple for index in range(self.__listboxright.size()): for tup in self.__filelists.items(): if tup[0] == self.__listboxright.get(index): #save the entity info self.get_dtos().set_entityname(tup[0]) self.get_dtos().set_viewfullpath(tup[1]) if self.get_dtos().get_entityname() and self.get_dtos( ).get_viewfullpath(): #--- save the project path self.get_trans().set_projectpath(self.__input01.get()) #--- update default file fileconstant = File_constant() userdefault = File_processor.get_home_dir() userdefault = userdefault + fileconstant.USER_DEFAULT User_default_file_processor.update_default_file( userdefault, 'project', self.__input01.get()) return True else: showerror('Error', 'You must select an existing entity!') return False def load_user_default(self): ''' load the local user default ''' fileconstant = File_constant() userdefault = File_processor.get_home_dir() userdefault = userdefault + fileconstant.USER_DEFAULT #create default file if not existing if not File_processor.verify_dir_existing(userdefault): User_default_file_processor.create_default_file(userdefault) #read default file default_info = User_default_file_processor.read_default_file( userdefault) if default_info['project'] and default_info['project'] != "": self.get_trans().set_projectpath(default_info['project']) self.__dicinput.delete(0, END) self.__dicinput.insert(END, default_info['project'])
class Frame_ts_observable_obj(FormatableFrame): ''' classdocs ''' def __init__(self, parent=None, dtos=None, trans=None, **configs): ''' Constructor ''' self.__result = True self.__error = None FormatableFrame.__init__(self, parent.get_mainframe(), dtos, trans, **configs) #overwrite create_widges def create_widges(self): fileconstant = File_constant() #frame self.__frame1 = FormatableFrame(self) self.__frame1.pack(side=TOP) #Title self.__label01 = Label(self.__frame1, text="Observable Obj generator options", width=45) self.__label01.pack(side=TOP, fill=X, ipady=10) #---- panel 01 ---------- canv1 = Canvas(self, height=30, width=550) #label self.__label01 = Label(canv1, text='Observable Obj name :') self.__label01.place(height=20, width=130, relx=0.03, rely=0.2) #input self.__feet = StringVar() self.__dicinput = Entry(canv1, textvariable=self.__feet, borderwidth=3, bg='black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__dicinput.place(height=20, width=250, relx=0.3, rely=0.2) canv1.pack() #---- panel 02 ---------- canv2 = Canvas(self, height=100, width=550) #label label1 = Label(canv2, text='Options:') label1.place(height=20, width=60, relx=0, rely=0) #radio box self.__vari1 = IntVar() self.__rad1 = Radiobutton(canv2, text='Re-write the previous file', variable=self.__vari1, value=1) self.__rad1.place(height=20, width=170, relx=0.1, rely=0.2) self.__rad1.select() self.__rad2 = Radiobutton(canv2, text='Attach new functions to the file', variable=self.__vari1, value=2) self.__rad2.place(height=20, width=210, relx=0.1, rely=0.45) self.__rad2.deselect() self.__rad3 = Radiobutton(canv2, text='Save the previous file as backup', variable=self.__vari1, value=3) self.__rad3.place(height=20, width=220, relx=0.1, rely=0.7) self.__rad3.deselect() canv2.pack() if self.get_dtos().get_businessentityname(): temp_name = self.get_dtos().get_businessentityname( ) + fileconstant.TS_OBSERVABLE_OBJECT_SUFFIX + fileconstant.TS_SUFFIX self.__feet.set(temp_name) #overwrite create_widges def add_bottom(self, parent): #bottom frame exFuncs = { 'Next': { 'process': self.get_nextframe(), 'before': self.before_next }, 'Prev': None } self.__buttom = Frame_bottom(parent, ['Next', 'Prev'], exFuncs) self.__buttom.pack(fill=X, ipady=10, side=BOTTOM) def before_next(self): ''' overwrite the function in super class verify the input directory ''' if not self.__result: showwarning( 'Warning', 'There are error existing, the ObservableObj cannot be generated.' ) return False # analysis the dataController if not self.get_dtos().get_dataControllerDTO(): pass # create the observable object self.__result, self.__message = TS_processor.create_TS_ObserObj( self.get_dtos(), self.get_trans(), self.__feet.get()) if not self.__result: showerror('Error', self.__message) return False return True def __pack_errorpanel(self): ''' pack the error panel ''' canv2 = Canvas(self, height=50, width=550) #label01 self.__label01 = Label(canv2, text=self.__error, fg='red') self.__label01.place(height=40, width=500, relx=0.01, rely=0.05) canv2.pack()
class Frame_gene_selection(FormatableFrame): ''' classdocs ''' def __init__(self, parent=None, dtos=None, trans=None, **configs): ''' Constructor ''' #initialize self.__result = None self.__error = None self.__classlist = [ ] # 0:service interface, 1:factory interface, 2:qra service class, 3:qra factory class # 4:entity container interface, 5:entity container impl, 6:main table interface, FormatableFrame.__init__(self, parent.get_mainframe(), dtos, trans, **configs) #overwrite create_widges def create_widges(self): #frame self.__frame1 = FormatableFrame(self) self.__frame1.pack(side=TOP) #Title self.__label01 = Label(self.__frame1, text="Select the generated file", width=45) self.__label01.pack(side=TOP, fill=X, ipady=10) frame_constant = Frame_constant() # get the Generator Status from transDTO java_flag = True gene_status = self.get_trans().get_generatorstatus() for key, value in gene_status.items(): # disable the java generator if key == 'ImplJAR' and value[1].get() == 0: java_flag = False elif key == 'ApiJAR' and value[1].get() == 0: java_flag = False # load the jar and java first if not self.__load_jar_and_java(): return #check buttons checkbut_frame1 = UnFormatableFrame(self) checkbut_frame1.pack(fill=X) Label(checkbut_frame1, text='Xml:', width=10).pack(side=LEFT) self.__checkvalues01 = { frame_constant.ENTITY_MAP_AND_BEAN_APP: IntVar() } for chkv in self.__checkvalues01.keys(): chk1 = Checkbutton(checkbut_frame1, text=chkv, variable=self.__checkvalues01[chkv], onvalue=1, offvalue=0) chk1.pack(side=LEFT) checkbut_frame2 = UnFormatableFrame(self) checkbut_frame2.pack(fill=X) Label(checkbut_frame2, text='Java:', width=10).pack(side=LEFT) self.__checkvalues02 = { frame_constant.SERVICE_IMPL: IntVar(), frame_constant.DATA_CONTROLLER: IntVar() } for chkv in self.__checkvalues02.keys(): if java_flag: chk1 = Checkbutton(checkbut_frame2, text=chkv, variable=self.__checkvalues02[chkv], onvalue=1, offvalue=0) else: chk1 = Checkbutton(checkbut_frame2, text=chkv, variable=self.__checkvalues02[chkv], onvalue=1, offvalue=0, state=DISABLED) chk1.pack(side=LEFT) checkbut_frame3 = UnFormatableFrame(self) checkbut_frame3.pack(fill=X) Label(checkbut_frame3, text='TsHandler:', width=10).pack(side=LEFT) self.__checkvalues03 = { frame_constant.TS_CONSTANTS: IntVar(), frame_constant.MOCK_DTO: IntVar(), frame_constant.OBSERVABLE_OBJ: IntVar(), frame_constant.TS_HANDLER: IntVar() } for chkv in self.__checkvalues03.keys(): chk1 = Checkbutton(checkbut_frame3, text=chkv, variable=self.__checkvalues03[chkv], onvalue=1, offvalue=0) chk1.pack(side=LEFT) #overwrite before_next def add_bottom(self, parent): #bottom frame exFuncs = { 'Next': { 'process': self.get_nextframe(), 'before': self.before_next }, 'Prev': { 'process': self.get_prevframe(), 'before': self.before_prev } } self.__buttom = Frame_bottom(parent, ['Next', 'Prev'], exFuncs) self.__buttom.pack(fill=X, ipady=10, side=BOTTOM) def before_next(self): ''' overwrite the function in super class generating the next frames according to the selections ''' #check box flag frame_constant = Frame_constant() checkFlag = False selections = dict(self.__checkvalues01, **self.__checkvalues02, **self.__checkvalues03) for val in selections.values(): if val.get() == 1: checkFlag = True break if checkFlag: #merge the selections into process flow self.get_trans().update_process_flow_by_gene_selection(selections) # --------- analysis the serviceImpl and datacontroller class if needed fileconstant = File_constant() tempstr01, tempstr02, parent_pack, tempstr03 = Java_processor.analysis_jar_package_name( self.get_dtos().get_serviceInterDTO().get_class_package()) self.__result, self.__error, business_entity_name, self.__classlist = Java_processor.validate_lib_javas( self.get_trans(), self.get_dtos()) proc = self.get_trans().get_processflow() if self.__checkvalues02[frame_constant.DATA_CONTROLLER].get( ) == 1 and self.__checkvalues02[ frame_constant.SERVICE_IMPL].get() != 1 in proc: if not self.get_dtos().get_serviceImplPath(): serviceImpl_path = self.get_trans().get_projectpath( ) + fileconstant.JAVA_SERVICEIMPL_PATH % ( parent_pack, business_entity_name + fileconstant.SERVICEIMPL_SUFFIX + fileconstant.JAVA_SUFFIX) self.__result, self.__error, dcJavaDTO = Java_processor.analysis_serviceImpl( business_entity_name + fileconstant.SERVICEIMPL_SUFFIX, serviceImpl_path, self.get_dtos()) if not self.__result: #---- panel 02 ---------- self.__pack_errorpanel() return else: self.get_dtos().set_serviceImplInfo( business_entity_name + fileconstant.SERVICEIMPL_SUFFIX + fileconstant.JAVA_SUFFIX, serviceImpl_path, dcJavaDTO) if (self.__checkvalues03[frame_constant.TS_HANDLER].get() == 1 or self.__checkvalues03[frame_constant.OBSERVABLE_OBJ].get() == 1) and \ self.__checkvalues02[frame_constant.DATA_CONTROLLER].get() != 1: if not self.get_dtos().get_dataControllerPath(): dataController_path = self.get_trans().get_projectpath( ) + fileconstant.JAVA_DATACONTROLLER_PATH % ( parent_pack, business_entity_name + fileconstant.DATACONTROLLER_SUFFIX + fileconstant.JAVA_SUFFIX) self.__result, self.__error, dcJavaDTO = Java_processor.analysis_dataController( business_entity_name + fileconstant.DATACONTROLLER_SUFFIX, dataController_path, self.get_dtos()) if not self.__result: #---- panel 02 ---------- self.__pack_errorpanel() return else: self.get_dtos().set_dataControllerInfo( business_entity_name + fileconstant.DATACONTROLLER_SUFFIX + fileconstant.JAVA_SUFFIX, dataController_path, dcJavaDTO) return True else: showerror('Error', 'You must select at least one generation file!') return False def __load_jar_and_java(self): ''' this method will load the info from imp & api jar, and will also load the serviceImpl and dataController java files ''' #analysis the serviceImpl self.__result, self.__error, business_entity_name, self.__classlist = Java_processor.validate_lib_javas( self.get_trans(), self.get_dtos()) # ---- set serviceImpl name if business_entity_name: self.get_dtos().set_businessentityname(business_entity_name) if not self.__result: #---- panel 02 ---------- self.__pack_errorpanel() return False # --------- analysis the api service if not self.get_dtos().get_serviceInterDTO().get_class_name(): self.__result, self.__error, serviceInterDTO = Java_processor.read_java_interface( self.__classlist[0]) if not self.__result: #---- panel 02 ---------- self.__pack_errorpanel() return False else: self.get_dtos().set_serviceInterDTO(serviceInterDTO) if not self.get_dtos().get_serviceQraDTO().get_class_name(): self.__result, self.__error, serviceQraDTO = Java_processor.read_java_class( self.__classlist[2]) if not self.__result: #---- panel 02 ---------- self.__pack_errorpanel() return False else: self.get_dtos().set_serviceQraDTO(serviceQraDTO) # --------- analysis the factory if not self.get_dtos().get_factoryInterDTO().get_class_name(): self.__result, self.__error, factoryInterDTO = Java_processor.read_java_interface( self.__classlist[1]) if not self.__result: #---- panel 02 ---------- self.__pack_errorpanel() return False else: self.get_dtos().set_factoryInterDTO(factoryInterDTO) if not self.get_dtos().get_factoryQraDTO().get_class_name(): self.__result, self.__error, factoryQraDTO = Java_processor.read_java_class( self.__classlist[3]) if not self.__result: #---- panel 02 ---------- self.__pack_errorpanel() return False else: self.get_dtos().set_factoryQraDTO(factoryQraDTO) # --------- analysis the container if not self.get_dtos().get_entContInterDTO().get_class_name(): self.__result, self.__error, containerInterDTO = Java_processor.read_java_interface( self.__classlist[4]) if not self.__result: #---- panel 02 ---------- self.__pack_errorpanel() return False else: self.get_dtos().set_entContInterDTO(containerInterDTO) if not self.get_dtos().get_entContQraDTO().get_class_name(): self.__result, self.__error, containerQraDTO = Java_processor.read_java_class( self.__classlist[5]) if not self.__result: #---- panel 02 ---------- self.__pack_errorpanel() return False else: self.get_dtos().set_entContQraDTO(containerQraDTO) # --------- analysis the main table interface if not self.get_dtos().get_maintableInterDTO().get_class_name(): self.__result, self.__error, maintableInterDTO = Java_processor.read_java_interface( self.__classlist[6]) if not self.__result: #---- panel 02 ---------- self.__pack_errorpanel() return False else: self.get_dtos().set_maintableInterDTO(maintableInterDTO) return True def __pack_errorpanel(self): ''' pack the error panel ''' canv2 = Canvas(self, height=50, width=550) #label01 self.__label01 = Label(canv2, text=self.__error, fg='red') self.__label01.place(height=40, width=500, relx=0.01, rely=0.05) canv2.pack()
class Frame_database_startup(FormatableFrame): ''' classdocs ''' def __init__(self, parent=None, dtos=None, trans=None, **configs): ''' Constructor ''' FormatableFrame.__init__(self, parent.get_mainframe(), dtos, trans, **configs) #overwrite create_widges def create_widges(self): #frame self.__frame1 = FormatableFrame(self) self.__frame1.pack(side=TOP) #Title self.__label01 = Label(self.__frame1, text="Database client", width=45) self.__label01.pack(side=TOP, fill=X, ipady=10) #---- panel 01 ---------- canv1 = Canvas(self, height=150, width=550) #label label1 = Label(canv1, text='Please select a database client:') label1.place(height=20, width=200, relx=0.01, rely=0.05) #radio box self.__vari1 = IntVar() self.__rad1 = Radiobutton(canv1, text='Cassandra', variable=self.__vari1, value=11) self.__rad1.place(height=20, width=100, x=100, y=45) self.__rad1.select() self.__rad2 = Radiobutton(canv1, text='Mongodb', variable=self.__vari1, value=12) self.__rad2.place(height=20, width=100, x=100, y=75) self.__rad2.deselect() canv1.pack() #---- panel 02 ---------- canv2 = Canvas(self, height=100, width=550) #label label2 = Label(canv2, text='Please select a workspace folder:') label2.place(height=20, width=200, relx=0.01, rely=0.05) #input self.__feet = StringVar() self.__dicinput = Entry(canv2, textvariable=self.__feet, borderwidth=3, bg='black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__dicinput.place(height=20, width=430, relx=0.1, rely=0.4) #button self.__dicload = Button_select_folder(canv2, self.reset_dicinput, height=1) self.__dicload.place(height=20, width=20, relx=0.9, rely=0.4) #label label3 = Label( canv2, text='(This folder will be used for storing the backup files)', fg='blue') label3.place(height=20, width=310, relx=0.1, rely=0.6) canv2.pack() #load the user default self.load_user_default() #overwrite before_next def add_bottom(self, parent): #bottom frame exFuncs = { 'Next': { 'process': self.get_nextframe(), 'cancel': self.remove_subsequent_frame_exclude_current(), 'before': self.before_next } } self.__buttom = Frame_bottom(parent, ['Next'], exFuncs) self.__buttom.pack(fill=X, ipady=10, side=BOTTOM) def before_next(self): ''' overwrite the function in super class verify the input directory generating the next frames according to the selections ''' tempdir = None #--- verify the input value if self.__dicinput.get(): if not Xmlfile_processor.verify_dir_format(self.__dicinput.get()): showerror('Error', 'The directory format is incorrect!') return False if not Xmlfile_processor.verify_dir_existing( self.__dicinput.get()): Xmlfile_processor.create_folder(self.__dicinput.get()) showinfo( 'Note', 'A new folder has been created in your workspace path.') #--- set the workspace path into transaction dto self.get_trans().set_workspacepath(self.__dicinput.get()) tempdir = self.__dicinput.get() else: tempdir = os.path.join(os.path.expanduser('~'), "Desktop") + '\\PyWorkspace' #--- desktop temp folder already existing self.__feet.set(tempdir) if Xmlfile_processor.verify_dir_existing(tempdir): showinfo( 'Note', 'The temp folder(PyWorkspace) on your desktop has been set as the default workspace.' ) else: Xmlfile_processor.create_folder(tempdir) showinfo( 'Note', 'A temp folder(PyWorkspace) has been created on your desktop.' ) #--- set the workspace path into transaction dto self.get_trans().set_workspacepath(tempdir) #--- update default file fileconstant = File_constant() userdefault = File_processor.get_home_dir() userdefault = userdefault + fileconstant.USER_DEFAULT User_default_file_processor.update_default_file( userdefault, 'workspace', tempdir) #--- set the process flow according to the selection self.get_trans().remove_subsequent_process_flows_exclude_current() self.get_trans().update_process_flow_by_start_selection( self.__vari1.get()) return True def reset_dicinput(self, dicname): ''' update the workspace directory @param dicname: the workspace directory ''' print(dicname) if dicname and dicname != "": self.__dicinput.delete(0, END) self.__dicinput.insert(END, dicname) def load_user_default(self): ''' load the local user default ''' fileconstant = File_constant() userdefault = File_processor.get_home_dir() userdefault = userdefault + fileconstant.USER_DEFAULT #create default file if not existing if not File_processor.verify_dir_existing(userdefault): User_default_file_processor.create_default_file(userdefault) #read default file default_info = User_default_file_processor.read_default_file( userdefault) if default_info['workspace'] and default_info['workspace'] != "": self.get_trans().set_workspacepath(default_info['workspace']) self.__dicinput.delete(0, END) self.__dicinput.insert(END, default_info['workspace']) if default_info['project'] and default_info['project'] != "": self.get_trans().set_projectpath(default_info['project'])
class Frame_ts_handler_option(FormatableFrame): ''' classdocs ''' def __init__(self, parent=None, dtos=None, trans=None, **configs): ''' Constructor ''' self.__result = True self.__error = None FormatableFrame.__init__(self, parent.get_mainframe(), dtos, trans, **configs) #overwrite create_widges def create_widges(self): frame_constant = Frame_constant() #frame self.__frame1 = FormatableFrame(self) self.__frame1.pack(side=TOP) #Title self.__label01 = Label(self.__frame1, text="TS Handler generator options", width=45) self.__label01.pack(side=TOP, fill=X, ipady=10) #---- panel 01 ---------- canv1 = Canvas(self, height=200, width=550) self.__label01 = Label(canv1, text='Please select the generated TS:', width=30) self.__label01.place(height=30, width=200, relx=0.05, rely=0.02) # common service self.__checkvalues01 = {frame_constant.TS_HANDLER_COMMON: IntVar()} for chkv in self.__checkvalues01.keys(): self.__checkvalues01[chkv].set(1) chk1 = Checkbutton(canv1, text=chkv, variable=self.__checkvalues01[chkv], onvalue=1, offvalue=0, state=DISABLED) chk1.place(height=20, width=150, relx=0.1, rely=0.2) # info label lbl1 = Label(canv1, text='The CommonService is mandatory.', fg='blue') lbl1.place(height=20, width=250, relx=0.5, rely=0.2) # other ts handlers self.__checkvalues02 = { frame_constant.TS_HANDLER_MAINT: IntVar(), frame_constant.TS_HANDLER_VIEWFORM: IntVar(), frame_constant.TS_HANDLER_GRID: IntVar(), frame_constant.TS_HANDLER_BROWSE: IntVar() } idx = 1 for chkv in self.__checkvalues02.keys(): chk1 = Checkbutton(canv1, text=chkv, variable=self.__checkvalues02[chkv], onvalue=1, offvalue=0) chk1.place(height=20, width=100, relx=0.1, rely=0.2 + idx * 0.13) idx = idx + 1 canv1.pack() #overwrite create_widges def add_bottom(self, parent): #bottom frame exFuncs = { 'Next': { 'process': self.get_nextframe(), 'before': self.before_next }, 'Prev': None } self.__buttom = Frame_bottom(parent, ['Next', 'Prev'], exFuncs) self.__buttom.pack(fill=X, ipady=10, side=BOTTOM) def before_next(self): ''' overwrite the function in super class generating the next frames according to the selections ''' #check box flag frame_constant = Frame_constant() checkFlag = False selections = dict(self.__checkvalues01, **self.__checkvalues02) for val in selections.values(): if val.get() == 1: checkFlag = True break if checkFlag: #merge the selections into process flow self.get_trans().update_process_flow_by_gene_selection(selections) self.get_trans().print_processflow() return True else: showerror('Error', 'You must select at least one generation file!') return False
class Frame_xml_option(FormatableFrame): ''' classdocs ''' def __init__(self, parent=None, dtos=None, trans=None, **configs): ''' Constructor ''' FormatableFrame.__init__(self, parent.get_mainframe(), dtos, trans, **configs) #overwrite create_widges def create_widges(self): #frame self.__frame1 = FormatableFrame(self) self.__frame1.pack(side=TOP) #Title self.__label01 = Label(self.__frame1, text="Xml generator options", width= 45) self.__label01.pack(side=TOP, fill=X, ipady=10) canv1 = Canvas(self, height=70, width=550) #label label1 = Label(canv1, text='EntityMap:') label1.place(height=20, width=60, relx= 0, rely=0) #radio box self.__vari1 = IntVar() self.__rad1 = Radiobutton(canv1, text='Save the backup', variable=self.__vari1, value=1) self.__rad1.place(height=20, width=150, relx= 0.1, rely=0.3) self.__rad1.select() self.__rad2 = Radiobutton(canv1, text='Clean the backup', variable=self.__vari1, value=2) self.__rad2.place(height=20, width=150, relx= 0.4, rely=0.3) self.__rad2.deselect() canv1.pack() canv2 = Canvas(self, height=130, width=550) #label label2 = Label(canv2, text='BeanAppContext:') label2.place(height=20, width=100, relx= 0, rely=0) #radio box self.__vari2 = IntVar() self.__rad3 = Radiobutton(canv2, text='Save the backup', variable=self.__vari2, value=1) self.__rad3.place(height=20, width=150, relx= 0.1, rely=0.17) self.__rad3.select() self.__rad4 = Radiobutton(canv2, text='Clean the backup', variable=self.__vari2, value=2) self.__rad4.place(height=20, width=150, relx= 0.4, rely=0.17) self.__rad4.deselect() #label label3 = Label(canv2, text='Type:') label3.place(height=20, width=40, relx= 0.1, rely=0.45) #combo box self.__varc3 = StringVar() self.__cob1 = ttk.Combobox(canv2, textvariable=self.__varc3) self.__cob1["values"] = ('blf', 'mfg') self.__cob1["state"] = "readonly" self.__cob1.current(0) self.__cob1.place(height=20, width=110, relx= 0.17, rely=0.45) #label label4 = Label(canv2, text='panDomain:') label4.place(height=20, width=80, relx= 0.4, rely=0.45) #combo box self.__varc4 = StringVar() self.__cob2 = ttk.Combobox(canv2, textvariable=self.__varc4) self.__cob2["values"] = ('true', 'false') self.__cob2["state"] = "readonly" self.__cob2.current(0) self.__cob2.place(height=20, width=70, relx= 0.55, rely=0.45) #label label4 = Label(canv2, text='objectName:') label4.place(height=20, width=80, relx= 0.1, rely=0.65) #input self.__varc5 = StringVar() self.__varc5.set('xxx') self.__dicinput = Entry(canv2, textvariable=self.__varc5, borderwidth=3, bg='black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__dicinput.place(height=20, width=120, relx= 0.25, rely=0.65) canv2.pack() def show_msg(self): print(self.__cob1.get()) #overwrite create_widges def add_bottom(self, parent): #bottom frame exFuncs = {'Next':{'process':self.get_nextframe(), 'before':self.before_next}, 'Prev':{'process':self.get_prevframe(), 'before':self.before_prev}} self.__buttom = Frame_bottom(parent, ['Next','Prev'], exFuncs) self.__buttom.pack(fill=X, ipady=10,side=BOTTOM) #overwrite before_next def before_next(self): fileconstant = File_constant() curDtos = self.get_dtos() curTrans = self.get_trans() const = Frame_constant() #--- update the process options in transaction dto ---- result, message = curTrans.update_options( {'Xml':{'EntityMap':self.__vari1.get(), 'BeanAppContext':self.__vari2.get()}}, const.ACTION_UPDATE) if not result: showerror('Error', message) return False #--- read the resource metadata resDTO = curDtos.get_resourceDTO() #--- process beans-app-context.xml bean_path = curTrans.get_projectpath() + fileconstant.BEAN_APP_CONTEXT_PATH status01, beanDTO, message01 = Xmlfile_processor.read_beans_app_context(bean_path) if status01: #--- verify if the target entity uri is existing in the beans-app-context if resDTO.get_primary_secure_uri() in beanDTO.get_entity_uri_mapstring(): showwarning('Note', 'The entity uri had been added in the beans-app-context.xml.') else: #--- backup beans-app-context Xmlfile_processor.copy_file(bean_path, curTrans.get_workspacepath() + beanDTO.get_filename() + fileconstant.BACKUP_SUFFIX) #--- format the new uri value = resDTO.get_primary_secure_uri() + ',' + resDTO.get_meta_uri() #--- update beans-app-context status01, message01 = Xmlfile_processor.write_beans_app_context(bean_path, value) #--- clean the backup if needed if self.__vari1.get() == 2: status01, message01 = Xmlfile_processor.remove_file(curTrans.get_workspacepath() + beanDTO.get_filename() + fileconstant.BACKUP_SUFFIX) if not status01: showerror('Error', message01) return False #--- process entityMap.xml entmap_path = curTrans.get_projectpath() + fileconstant.ENTITY_MAP_PATH status02, entMapDTO, message02 = Xmlfile_processor.read_entity_map(entmap_path) if status02: #--- verify if the target entity uri is existing in the entityMap if resDTO.get_primary_secure_uri() in entMapDTO.get_entitymap_uris(): showwarning('Note', 'The entity uri had been added in the entityMap.xml.') else: #--- backup entityMap Xmlfile_processor.copy_file(entmap_path, curTrans.get_workspacepath() + entMapDTO.get_filename() + fileconstant.BACKUP_SUFFIX) #--- write entityMap status02, message02 = Xmlfile_processor.write_entity_map(entmap_path, resDTO.get_primary_secure_uri(), self.__varc3.get(), self.__varc5.get(), self.__varc4.get()) #--- clean the backup if needed if self.__vari2.get() == 2: status02, message02 = Xmlfile_processor.remove_file(curTrans.get_workspacepath() + entMapDTO.get_filename() + fileconstant.BACKUP_SUFFIX) if not status02: showerror('Error', message02) return False # --- Info message showinfo('Note', 'The xml files are processed, please verify them later.') return True
class Frame_cassandra_maint_connection(FormatableFrame): ''' classdocs ''' global BUTTON_TEXT_LOAD global BUTTON_TEXT_NEW global MATAIN_MODE_LOAD global MATAIN_MODE_NEW BUTTON_TEXT_LOAD = 'Load existing' BUTTON_TEXT_NEW = 'New connection' MATAIN_MODE_LOAD = 'LOAD' MATAIN_MODE_NEW = 'NEW' def __init__(self, parent=None, dtos=None, trans=None, **configs): ''' Constructor ''' FormatableFrame.__init__(self, parent.get_mainframe(), dtos, trans, **configs) #overwrite create_widges def create_widges(self): # initialize the maintain mode self.__maintain_mode = None self.set_maintain_mode() #frame self.__frame1 = FormatableFrame(self) self.__frame1.pack(side=TOP) #Title self.__label01 = Label(self.__frame1, text="Cassandra maint connection", width=45) self.__label01.pack(side=TOP, fill=X, ipady=10) #---- panel 01 ---------- canv2 = Canvas(self, height=300, width=550) #label label1 = Label(canv2, text='Please choose the database connection:') label1.place(height=20, width=250, relx=0.01, rely=0.06) #label self.__label01 = Label(canv2, text='Name:') self.__label01.place(height=20, width=80, relx=0.05, rely=0.2) #combox name self.__comvalue = StringVar() self.__comboxlist = Combobox(canv2, textvariable=self.__comvalue) self.__comboxlist.place(height=20, width=100, relx=0.2, rely=0.2) self.__comboxlist.bind("<<ComboboxSelected>>", self.load_connection_parameters) self.__comboxlist["state"] = "readonly" #input name self.__feet = StringVar() self.__input01 = Entry(canv2, textvariable=self.__feet, borderwidth=3, bg='black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__input01.place(height=20, width=100, relx=0.2, rely=0.2) #button button_text = '' if self.__maintain_mode == MATAIN_MODE_LOAD: self.__input01.place_forget() button_text = BUTTON_TEXT_NEW else: self.__comboxlist.place_forget() button_text = BUTTON_TEXT_LOAD self.__modebtn = Button_selfdesign(canv2, self.change_maintain_mode, button_text, height=2) self.__modebtn.place(height=20, width=100, relx=0.4, rely=0.2) #label self.__label02 = Label(canv2, text='Host:') self.__label02.place(height=20, width=80, relx=0.05, rely=0.4) #input self.__feet = StringVar() self.__input02 = Entry(canv2, textvariable=self.__feet, borderwidth=3, bg='black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__input02.place(height=20, width=100, relx=0.2, rely=0.4) #label self.__label03 = Label(canv2, text='Port:') self.__label03.place(height=20, width=80, relx=0.5, rely=0.4) #input self.__feet = StringVar() self.__input03 = Entry(canv2, textvariable=self.__feet, borderwidth=3, bg='black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__input03.place(height=20, width=100, relx=0.65, rely=0.4) #label label2 = Label( canv2, text= '(yab config | grep cassandra.default.node.main.native_transport_port)', fg='blue') label2.place(height=20, width=410, relx=0.1, rely=0.47) #label self.__label04 = Label(canv2, text='User:'******'black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__input04.place(height=20, width=100, relx=0.2, rely=0.6) #label self.__label05 = Label(canv2, text='Password:'******'black', foreground='yellow', highlightcolor='red', insertbackground='red') self.__input05.place(height=20, width=100, relx=0.65, rely=0.6) #label label3 = Label( canv2, text='(the default user and password for cassandra both are "qad")', fg='blue') label3.place(height=20, width=400, relx=0.1, rely=0.67) canv2.pack() # load saved connections if self.__maintain_mode == MATAIN_MODE_LOAD: self.load_connection_names() #overwrite before_next def add_bottom(self, parent): #bottom frame exFuncs = { 'Prev': { 'process': self.get_prevframe(), 'before': self.before_prev }, 'Self': { 'process': self.test_connection, 'title': 'Test' }, 'Next': { 'process': self.get_nextframe(), 'before': self.before_next } } self.__buttom = Frame_bottom(parent, ['Prev', 'Next', 'Self'], exFuncs) self.__buttom.pack(fill=X, ipady=10, side=BOTTOM) def before_next(self): ''' overwrite the function in super class verify the input directory generating the next frames according to the selections ''' # verify the connection name if not self.__input01.get( ) and self.__maintain_mode == MATAIN_MODE_NEW: showerror('Error', 'Please provide the connection name!') return False # verify the input value if not self.__input02.get() or not self.__input03.get( ) or not self.__input04.get() or not self.__input05.get(): showerror('Error', 'Please provide the complete info!') return False # setup the connection file path into workspace folder fileconstant = File_constant() workspacepath = self.get_trans().get_workspacepath() cassandra_conection_folder = workspacepath + fileconstant.CASSANDRA_CONFIG_FOLDER if not File_processor.verify_dir_existing(cassandra_conection_folder): File_processor.create_folder(cassandra_conection_folder) cassandra_conection_file = cassandra_conection_folder + fileconstant.CASSANDRA_CONNECTION_FILE # combine the connection parameter # TODO: this should be implemented as toString() in Cassandra_connection_dto if self.__maintain_mode == MATAIN_MODE_NEW: connection_name = self.__input01.get() connection_param = self.__input01.get( ) + ':' + 'host=' + self.__input02.get( ) + ',port=' + self.__input03.get( ) + ',username='******',password='******':' + 'host=' + self.__input02.get( ) + ',port=' + self.__input03.get( ) + ',username='******',password='******'Warning', 'The connection name is existing, do you confirm to overwrite?' ): return False Database_connection_file_processor.update_connection_file( cassandra_conection_file, connection_name, connection_param) return True def get_nextframe(self): ''' overwrite the super class FtdFrame, set the next frame as database maint popup ''' func = self.open_popup_table_maint return func def set_maintain_mode(self): ''' verify the initial maintain mode (create or load) ''' self.__maintain_mode = MATAIN_MODE_LOAD # setup the connection file path into workspace folder fileconstant = File_constant() workspacepath = self.get_trans().get_workspacepath() cassandra_conection_folder = workspacepath + fileconstant.CASSANDRA_CONFIG_FOLDER if not File_processor.verify_dir_existing(cassandra_conection_folder): self.__maintain_mode = MATAIN_MODE_NEW return cassandra_conection_file = cassandra_conection_folder + fileconstant.CASSANDRA_CONNECTION_FILE # verify the connection file if not File_processor.verify_file(cassandra_conection_file): self.__maintain_mode = MATAIN_MODE_NEW return # load connection names connection_names = Database_connection_file_processor.read_connection_names( cassandra_conection_file) # set tuple to combox list templist = tuple(connection_names) if len(templist) == 0: self.__maintain_mode = MATAIN_MODE_NEW return def change_maintain_mode(self): ''' change the maintain mode ''' # change to NEW if self.__maintain_mode == MATAIN_MODE_LOAD: self.__maintain_mode = MATAIN_MODE_NEW self.__comboxlist.place_forget() self.__input01.place(height=20, width=100, relx=0.2, rely=0.2) self.__modebtn.config(text=BUTTON_TEXT_LOAD) self.__input02.delete(0, END) self.__input03.delete(0, END) self.__input04.delete(0, END) self.__input05.delete(0, END) # change to LOAD else: # load connections if self.load_connection_names() > 0: self.__maintain_mode = MATAIN_MODE_LOAD self.__input01.place_forget() self.__comboxlist.place(height=20, width=100, relx=0.2, rely=0.2) self.__modebtn.config(text=BUTTON_TEXT_NEW) def load_connection_names(self): ''' load all connection names from workspace @return: count of connections ''' # setup the connection file path into workspace folder fileconstant = File_constant() workspacepath = self.get_trans().get_workspacepath() cassandra_conection_folder = workspacepath + fileconstant.CASSANDRA_CONFIG_FOLDER if not File_processor.verify_dir_existing(cassandra_conection_folder): File_processor.create_folder(cassandra_conection_folder) cassandra_conection_file = cassandra_conection_folder + fileconstant.CASSANDRA_CONNECTION_FILE # verify connection file existing if not File_processor.verify_file(cassandra_conection_file): showerror('Error', 'Cassandra connection file does not exist!') return 0 # load connection names connection_names = Database_connection_file_processor.read_connection_names( cassandra_conection_file) # set tuple to combox list self.__comboxlist["values"] = tuple(connection_names) if len(self.__comboxlist["values"]) == 0: showerror('Error', 'No valid connection, please add one first!') return 0 # default the first one self.__comboxlist.current(0) # load connection parameters connection_params = Database_connection_file_processor.read_connection_params( cassandra_conection_file, self.__comboxlist.get()) # set parameters self.__input02.delete(0, END) self.__input02.insert(END, connection_params['host']) self.__input03.delete(0, END) self.__input03.insert(END, connection_params['port']) self.__input04.delete(0, END) self.__input04.insert(END, connection_params['username']) self.__input05.delete(0, END) self.__input05.insert(END, connection_params['password']) return len(self.__comboxlist["values"]) def load_connection_parameters(self, event): ''' load connection parameters from workspace ''' # combine the workspace path fileconstant = File_constant() workspacepath = self.get_trans().get_workspacepath() cassandra_conection_file = workspacepath + fileconstant.CASSANDRA_CONFIG_FOLDER + fileconstant.CASSANDRA_CONNECTION_FILE # verify connection file existing if not File_processor.verify_file(cassandra_conection_file): showerror('Error', 'Cassandra connection file does not exist!') return # load connection parameters connection_params = Database_connection_file_processor.read_connection_params( cassandra_conection_file, self.__comboxlist.get()) # set parameters self.__input02.delete(0, END) self.__input02.insert(END, connection_params['host']) self.__input03.delete(0, END) self.__input03.insert(END, connection_params['port']) self.__input04.delete(0, END) self.__input04.insert(END, connection_params['username']) self.__input05.delete(0, END) self.__input05.insert(END, connection_params['password']) def test_connection(self, is_show_success=True): ''' test the connection ''' cassandra_connection_result = False #--- verify the input value if not self.__input02.get() or not self.__input03.get( ) or not self.__input04.get() or not self.__input05.get(): showerror('Error', 'Please provide the complete info!') return connectionParams = Database_parameters() connectionParams.set_contact_points(self.__input02.get()) connectionParams.set_port(self.__input03.get()) connectionParams.set_username(self.__input04.get()) connectionParams.set_password(self.__input05.get()) try: cassandra_connection = Cassandra_driver(connectionParams) cassandra_connection_result = cassandra_connection.test_connection( ) except TypeError as te: showerror('Error', te) except ValueError: message = 'Incorrect port number!' showerror('Error', message) except NoHostAvailable as ne: message = ne.args[0] showerror('Error', message) except Exception as e: message = f'Connect failed:{e}' showerror('Error', message) if cassandra_connection_result and is_show_success: message = 'Connect successfully' showinfo('Info', message) return cassandra_connection_result def open_popup_table_maint(self): ''' open the table maint popup ''' connectionParams = Database_parameters() connectionParams.set_contact_points(self.__input02.get()) connectionParams.set_port(self.__input03.get()) connectionParams.set_username(self.__input04.get()) connectionParams.set_password(self.__input05.get()) cassandra_connection = Cassandra_driver(connectionParams) # Validation for database driver if not cassandra_connection or not isinstance(cassandra_connection, IDatabase_driver): showerror('Error', 'Incorrect database parameters, please check!') return ''' popup = Popup_table_maint(cassandra_connection) popup.grab_set() popup.focus_set() popup.wait_window() ''' Database_maint_frame(cassandra_connection)
class Frame_projfile_check(FormatableFrame): ''' classdocs ''' def __init__(self, parent=None, dtos=None, trans=None, **configs): ''' Constructor ''' self.__checkstatus = { } # the generator status, the same structure as TransactionDTO.GeneratorStatus (e.g. {'Metadata':1}) self.__message = None FormatableFrame.__init__(self, parent.get_mainframe(), dtos, trans, **configs) #overwrite create_widges def create_widges(self): #frame self.__frame1 = FormatableFrame(self) self.__frame1.pack(side=TOP) #Title self.__label01 = Label(self.__frame1, text="Important files checking", width=45) self.__label01.pack(side=TOP, fill=X, ipady=10) #---- panel 01 ---------- canv1 = Canvas(self, height=120, width=550) #label self.__label02 = Label(canv1, text='Project file checking:') self.__label02.place(height=20, width=150, relx=0.01, rely=0.02) #selected details self.__checkval03 = IntVar() self.__checkbox03 = Checkbutton(canv1, text="Pom", variable=self.__checkval03, onvalue=1, offvalue=0, state=DISABLED) self.__checkbox03.place(height=20, width=50, relx=0.1, rely=0.2) self.__label07 = Label(canv1, text='Status :') self.__label07.place(height=20, width=60, relx=0.4, rely=0.2) self.__label08 = Label(canv1, text='< no need >') self.__label08.place(height=20, width=120, relx=0.5, rely=0.2) self.__button03 = Button(canv1, text="Detail") self.__button03.place(height=20, width=50, relx=0.8, rely=0.2) self.__checkval04 = IntVar() self.__checkbox04 = Checkbutton(canv1, text="beans-app-context", variable=self.__checkval04, onvalue=1, offvalue=0, state=DISABLED) self.__checkbox04.place(height=20, width=125, relx=0.1, rely=0.4) self.__label09 = Label(canv1, text='Status :') self.__label09.place(height=20, width=60, relx=0.4, rely=0.4) self.__label10 = Label(canv1, text='< no need >') self.__label10.place(height=20, width=120, relx=0.5, rely=0.4) self.__button04 = Button(canv1, text="Detail") self.__button04.place(height=20, width=50, relx=0.8, rely=0.4) self.__checkval05 = IntVar() self.__checkbox05 = Checkbutton(canv1, text="entityMap", variable=self.__checkval05, onvalue=1, offvalue=0, state=DISABLED) self.__checkbox05.place(height=20, width=80, relx=0.1, rely=0.6) self.__label11 = Label(canv1, text='Status :') self.__label11.place(height=20, width=60, relx=0.4, rely=0.6) self.__label12 = Label(canv1, text='< no need >') self.__label12.place(height=20, width=120, relx=0.5, rely=0.6) self.__button05 = Button(canv1, text="Detail") self.__button05.place(height=20, width=50, relx=0.8, rely=0.6) #warning message in xml panel self.__label99 = Label( canv1, text= 'Warning : Please run svn revert/update if something in project is incorrect.', fg='red') self.__label99.place(height=20, width=400, relx=0.1, rely=0.8) canv1.pack() #---- panel 02 ---------- canv2 = Canvas(self, height=80, width=550) #labe2 label2 = Label(canv2, text='Metadata checking:') label2.place(height=20, width=120, relx=0.01, rely=0.05) self.__checkval01 = IntVar() self.__checkbox01 = Checkbutton(canv2, text="View metadata", variable=self.__checkval01, onvalue=1, offvalue=0, state=DISABLED) self.__checkbox01.place(height=20, width=110, relx=0.1, rely=0.3) self.__label03 = Label(canv2, text='Status :') self.__label03.place(height=20, width=60, relx=0.4, rely=0.3) self.__label04 = Label(canv2, text='< no need >') self.__label04.place(height=20, width=120, relx=0.5, rely=0.3) self.__button01 = Button(canv2, text="Detail") self.__button01.place(height=20, width=50, relx=0.8, rely=0.3) self.__checkval02 = IntVar() self.__checkbox02 = Checkbutton(canv2, text="Resource metadata", variable=self.__checkval02, onvalue=1, offvalue=0, state=DISABLED) self.__checkbox02.place(height=20, width=130, relx=0.1, rely=0.6) self.__label05 = Label(canv2, text='Status :') self.__label05.place(height=20, width=60, relx=0.4, rely=0.6) self.__label06 = Label(canv2, text='< no need >') self.__label06.place(height=20, width=120, relx=0.5, rely=0.6) self.__button02 = Button(canv2, text="Detail") self.__button02.place(height=20, width=50, relx=0.8, rely=0.6) canv2.pack() #---- panel 03 ---------- canv3 = Canvas(self, height=80, width=550) #labe3 label3 = Label(canv3, text='Jar checking:') label3.place(height=20, width=100, relx=0.01, rely=0.05) self.__chkint91 = IntVar() self.__checkval91 = self.__chkint91 self.__checkbox91 = Checkbutton(canv3, text="financials-impl", variable=self.__checkval91, onvalue=1, offvalue=0) self.__checkbox91.place(height=20, width=110, relx=0.1, rely=0.3) self.__label91 = Label(canv3, text='Status :') self.__label91.place(height=20, width=60, relx=0.4, rely=0.3) self.__label92 = Label(canv3, text='< no need >') self.__label92.place(height=20, width=120, relx=0.5, rely=0.3) self.__button91 = Button(canv3, text="Detail") self.__button91.place(height=20, width=50, relx=0.8, rely=0.3) self.__checkval92 = self.__chkint91 self.__checkbox92 = Checkbutton(canv3, text="financials-api", variable=self.__checkval92, onvalue=1, offvalue=0) self.__checkbox92.place(height=20, width=100, relx=0.1, rely=0.6) self.__label93 = Label(canv3, text='Status :') self.__label93.place(height=20, width=60, relx=0.4, rely=0.6) self.__label94 = Label(canv3, text='< no need >') self.__label94.place(height=20, width=120, relx=0.5, rely=0.6) self.__button92 = Button(canv3, text="Detail") self.__button92.place(height=20, width=50, relx=0.8, rely=0.6) canv3.pack() #--- initialize self.verify_proj_files() #overwrite create_widges def add_bottom(self, parent): #bottom frame exFuncs = { 'Next': { 'process': self.get_nextframe(), 'before': self.before_next }, 'Prev': { 'process': self.get_prevframe(), 'before': self.before_prev } } self.__buttom = Frame_bottom(parent, ['Next', 'Prev'], exFuncs) self.__buttom.pack(fill=X, ipady=10, side=BOTTOM) def verify_proj_files(self): ''' verify the project fiels ''' #path constant fileconstant = File_constant() entity_name = self.get_dtos().get_entityname() proj_path = self.get_trans().get_projectpath() #verify view metadata view_exist = False viewfullpath = self.get_dtos().get_viewfullpath() if not viewfullpath and entity_name: viewfullpath = proj_path + fileconstant.VIEW_METADATA_PATH + entity_name + fileconstant.XML_SUFFIX view_exist, self.__message = Xmlfile_processor.veriy_view_metadata( viewfullpath) elif viewfullpath: view_exist = True if view_exist: newlabel01 = "< passed >" self.__label04.config(text=newlabel01, fg='blue') self.get_dtos().set_viewfullpath(viewfullpath) self.__checkstatus['ViewMetadata'] = [True, self.__checkval01] else: newlabel01 = "< failed >" self.__label04.config(text=newlabel01, fg='red') btnlabel = 'Correct' self.__button01.config(text=btnlabel) self.__checkstatus['ViewMetadata'] = [False, self.__checkval01] self.__checkval01.set(1) #bind button click event self.__button01.bind( '<Button-1>', self.event_adapter(self.detal_button_click, iscorrect=self.__checkstatus['ViewMetadata'][0], filename=entity_name + fileconstant.XML_SUFFIX, filetype='ViewMetadata', filepath=viewfullpath)) #verify source metadata resource_exist = False resourcefullpath = self.get_dtos().get_resourcefullpath() if not resourcefullpath and entity_name: resourcefullpath = proj_path + fileconstant.RESOURCE_METADATA_PATH + entity_name + fileconstant.RESOURCE_METADATA_SUFFIX resource_exist, self.__message = Xmlfile_processor.veriy_resource_metadata( resourcefullpath) if resource_exist: newlabel = "< passed >" self.__label06.config(text=newlabel, fg='blue') self.get_dtos().set_resourcefullpath(resourcefullpath) self.__checkstatus['ResourceMetadata'] = [True, self.__checkval02] else: newlabel = "< failed >" self.__label06.config(text=newlabel, fg='red') btnlabel = 'Correct' self.__button02.config(text=btnlabel) self.__checkstatus['ResourceMetadata'] = [False, self.__checkval02] self.__checkval02.set(1) self.__button02.bind( '<Button-1>', self.event_adapter( self.detal_button_click, iscorrect=self.__checkstatus['ResourceMetadata'][0], filename=entity_name + fileconstant.RESOURCE_METADATA_SUFFIX, filetype='ResourceMetadata', filepath=resourcefullpath)) #verify pom result, self.__message = Xmlfile_processor.verify_pom( proj_path + fileconstant.POM_PATH) if result: #read the pom result, pomDto, self.__message = Xmlfile_processor.read_pom( proj_path + fileconstant.POM_PATH) newlabel = "< passed >" self.__label08.config(text=newlabel, fg='blue') self.get_trans().set_pomDto(pomDto) self.__checkstatus['Pom'] = [True, self.__checkval03] else: newlabel = "< failed >" self.__label08.config(text=newlabel, fg='red') btnlabel = 'Correct' self.__button03.config(text=btnlabel) self.__checkstatus['Pom'] = [False, self.__checkval03] self.__checkval03.set(1) self.__button03.bind( '<Button-1>', self.event_adapter(self.detal_button_click, iscorrect=self.__checkstatus['Pom'][0], filename='pom.xml', filetype='POM', filepath=proj_path + fileconstant.POM_PATH)) #verify beans-app-context result, self.__message = Xmlfile_processor.verify_beans_app_context( proj_path + fileconstant.BEAN_APP_CONTEXT_PATH) if result: newlabel = "< passed >" self.__label10.config(text=newlabel, fg='blue') self.get_trans().set_pomDto(pomDto) self.__checkstatus['beans-app-context'] = [True, self.__checkval04] else: newlabel = "< failed >" self.__label10.config(text=newlabel, fg='red') btnlabel = 'Correct' self.__button04.config(text=btnlabel) self.__checkstatus['beans-app-context'] = [ False, self.__checkval04 ] self.__checkval04.set(1) self.__button04.bind( '<Button-1>', self.event_adapter( self.detal_button_click, iscorrect=self.__checkstatus['beans-app-context'][0], filename='beans-app-server.xml', filetype='beans', filepath=proj_path + fileconstant.BEAN_APP_CONTEXT_PATH)) #verify entityMap result, self.__message = Xmlfile_processor.verify_entity_map( proj_path + fileconstant.ENTITY_MAP_PATH) if result: newlabel = "< passed >" self.__label12.config(text=newlabel, fg='blue') self.get_trans().set_pomDto(pomDto) self.__checkstatus['entityMap'] = [True, self.__checkval05] else: newlabel = "< failed >" self.__label12.config(text=newlabel, fg='red') btnlabel = 'Correct' self.__button05.config(text=btnlabel) self.__checkstatus['entityMap'] = [False, self.__checkval05] self.__checkval05.set(1) self.__button05.bind( '<Button-1>', self.event_adapter(self.detal_button_click, iscorrect=self.__checkstatus['entityMap'][0], filename='entityMap.xml', filetype='entityMap', filepath=proj_path + fileconstant.ENTITY_MAP_PATH)) #verify jar result = False jarname = None implJarfullpath = self.get_trans().get_finImplJarPath() apiJarfullpath = self.get_trans().get_finApiJarPath() #verify if jar is existing at the Maven's default repository #impl jar if not implJarfullpath: userhomepath = File_processor.get_user_home( ) + fileconstant.IMPL_JAR_LIB_PATH #jar name and full path implJarfullpath = userhomepath + pomDto.get_financials_api_version( ) + '\\' + fileconstant.FIN_IMPL_JAR_PREFIX + pomDto.get_financials_api_version( ) + fileconstant.JAR_SUFFIX jarname = fileconstant.FIN_IMPL_JAR_PREFIX + pomDto.get_financials_api_version( ) + fileconstant.JAR_SUFFIX result, self.__message = Java_processor.verify_jar_type( implJarfullpath) if result: newlabel = "< passed >" self.__label92.config(text=newlabel, fg='blue') self.get_trans().set_finImplJarPath(implJarfullpath) self.__checkstatus['ImplJAR'] = [True, self.__checkval91] else: newlabel = "< failed >" self.__label92.config(text=newlabel, fg='red') btnlabel = 'Correct' self.__button91.config(text=btnlabel) self.__checkstatus['ImplJAR'] = [False, self.__checkval91] else: newlabel = "< passed >" self.__label92.config(text=newlabel, fg='blue') self.__checkstatus['ImplJAR'] = [True, self.__checkval91] #jar name jarname = File_processor.get_file_name( self.get_trans().get_finImplJarPath()) self.__checkval91.set(1) self.__button91.bind( '<Button-1>', self.event_adapter(self.detal_button_click, iscorrect=self.__checkstatus['ImplJAR'][0], filename=jarname, filetype='ImplJAR', filepath=implJarfullpath)) # api jar if not apiJarfullpath: userhomepath = File_processor.get_user_home( ) + fileconstant.API_JAR_LIB_PATH #jar name and full path apiJarfullpath = userhomepath + pomDto.get_financials_api_version( ) + '\\' + fileconstant.FIN_API_JAR_PREFIX + pomDto.get_financials_api_version( ) + fileconstant.JAR_SUFFIX jarname = fileconstant.FIN_IMPL_JAR_PREFIX + pomDto.get_financials_api_version( ) + fileconstant.JAR_SUFFIX result, self.__message = Java_processor.verify_jar_type( apiJarfullpath) if result: newlabel = "< passed >" self.__label94.config(text=newlabel, fg='blue') self.get_trans().set_finApiJarPath(apiJarfullpath) self.__checkstatus['ApiJAR'] = [True, self.__checkval92] else: newlabel = "< failed >" self.__label94.config(text=newlabel, fg='red') btnlabel = 'Correct' self.__button92.config(text=btnlabel) self.__checkstatus['ApiJAR'] = [False, self.__checkval92] else: newlabel = "< passed >" self.__label94.config(text=newlabel, fg='blue') self.__checkstatus['ApiJAR'] = [True, self.__checkval92] #jar name jarname = File_processor.get_file_name( self.get_trans().get_finImplJarPath()) self.__checkval92.set(1) self.__button92.bind( '<Button-1>', self.event_adapter(self.detal_button_click, iscorrect=self.__checkstatus['ApiJAR'][0], filename=jarname, filetype='ApiJAR', filepath=apiJarfullpath)) def event_adapter(self, fun, **kwds): ''' event adapter, to transfer the input parameters into event @param fun: the event function @param kwds: event input parameters ''' return lambda event, fun=fun, kwds=kwds: fun(event, **kwds) def detal_button_click(self, event, iscorrect, filename, filetype, filepath): ''' detail button click event ''' fileinfo = { 'filename': filename, 'filetype': filetype, 'filepath': filepath, 'iscorrect': iscorrect } popup = Popup_projfile_details(fileinfo) popup.grab_set() popup.focus_set() popup.wait_window() if not iscorrect: result_dto = popup.return_selection() if result_dto['iscorrect']: if result_dto['filetype'] == 'ImplJAR': #update the global parameters self.__checkstatus['ImplJAR'][0] = True #set new jara path into transaction self.get_trans().set_finImplJarPath(result_dto['filepath']) #update labels newlabel = "< passed >" self.__label92.config(text=newlabel, fg='blue') btnlabel = 'Detail' self.__button91.config(text=btnlabel) #update event parameters self.__button91.bind( '<Button-1>', self.event_adapter( self.detal_button_click, iscorrect=self.__checkstatus['ImplJAR'][0], filename=result_dto['filename'], filetype='ImplJAR', filepath=result_dto['filepath'])) elif result_dto['filetype'] == 'ApiJAR': #update the global parameters self.__checkstatus['ApiJAR'][0] = True #set new jara path into transaction self.get_trans().set_finImplJarPath(result_dto['filepath']) #update labels newlabel = "< passed >" self.__label94.config(text=newlabel, fg='blue') btnlabel = 'Detail' self.__button92.config(text=btnlabel) #update event parameters self.__button92.bind( '<Button-1>', self.event_adapter( self.detal_button_click, iscorrect=self.__checkstatus['ApiJAR'][0], filename=result_dto['filename'], filetype='ApiJAR', filepath=result_dto['filepath'])) def before_next(self): ''' overwrite the function in super class verify the input directory ''' #--- read the resource metadata and load the data into ResourceMetadataDTO curDtos = self.get_dtos() resourcepath = curDtos.get_resourcefullpath() result, message = Xmlfile_processor.read_resource_metadata( resourcepath, self.get_dtos()) if not result: showerror('Error', message) return False #--- verify generator options warning_flag = False for flag in self.__checkstatus.items(): if not flag[1][0] and flag[1][1].get() == 1: showerror('Error', 'There are errors existing, please correct it!') return False elif flag[1][1].get() == 0: if not warning_flag: showwarning( 'Warning', 'Some generators could not work because the related file validations are skipped.' ) warning_flag = True # save the generator status into TransDto self.get_trans().set_generatorstatus(self.__checkstatus) #jar processing if self.__chkint91.get() == 1: Multiple_processor.multiprocessing_service(self.get_trans()) return True