def on_select_app(self, event): self.value_param = None self.text_file.delete('1.0', END) self.btn_go.config(state=DISABLED) w = event.widget print(w) index = int(self.apps.curselection()[0]) self.value_app = self.apps.get(index) print('You selected item %d: "%s"' % (index, self.value_app)) ConsoleUiLogger.submit_message( 'DEBUG', 'You selected item %d: "%s"' % (index, self.value_app)) if self.value_app in self.APP_PARAMETERS and len( self.APP_PARAMETERS[self.value_app]) > 0: self.parameters.config(state=NORMAL) self.parameters.delete('0', END) # self.parameters.insert('end', *self.APP_PARAMETERS[self.value_app]) for param in self.APP_PARAMETERS[self.value_app]: self.parameters.insert('end', param['name']) # self.enable_item(0) else: self.parameters.config(state=NORMAL) self.parameters.delete('0', END) self.text_file.insert('1.0', "No parameters") self.parameters.insert(END, "No parameters") self.parameters.config(state=DISABLED)
def delete_pods(self): self.text_file.delete('1.0', END) for pod in self.value_pods: if kubernetes.delete_pod(pod, "test") is False: ConsoleUiLogger.submit_message('WARNING', "pod " + pod + " not found") else: ConsoleUiLogger.submit_message('INFO', " --> " + pod) idx = self.pods.get(0, END).index(pod) self.pods.delete(idx)
def on_select_pods(self, event): pods_event = event.widget print(pods_event) index_pods = int(self.pods.curselection()[0]) self.value_pods.append(self.pods.get(index_pods)) print('You selected item %d: "%s"' % (index_pods, self.value_pods)) ConsoleUiLogger.submit_message( 'DEBUG', 'You selected item %d: "%s"' % (index_pods, self.value_pods)) self.btn_delete_pod.config(state="normal")
def browse_file(self): self.file = askopenfile(mode='rb', title='Choose a Json file') if self.file != None: data = self.file.read() self.text_file.insert('1.0', self.file.name) ConsoleUiLogger.submit_message('INFO', "File chosen: " + self.file.name) self.file.close() # print("I got %d bytes from this file." % len(data)) self.btn_go.config(state="normal") else: ConsoleUiLogger.submit_message('ERROR', "Error to load file!")
def on_select_param(self, event): self.text_file.delete('1.0', END) param_event = event.widget print(param_event) index_param = int(self.parameters.curselection()[0]) self.value_param = self.parameters.get(index_param) print('You selected item %d: "%s"' % (index_param, self.value_param)) ConsoleUiLogger.submit_message( 'DEBUG', 'You selected item %d: "%s"' % (index_param, self.value_param)) self.btn_go.config(state="normal") self.text_file.insert('1.0', self.value_app + " " + self.value_param)
def run(self): self.text_file.delete('1.0', END) pods_info = runKube(self, self.file, self.value_app, self.value_param, self.PathVideo[self.value_param][0]) if pods_info is False: self.text_file.delete('1.0', END) messagebox.showwarning("Warn", "Pod is already present") ConsoleUiLogger.submit_message('WARNING', "Pod is already present") return else: self.podsRun.append(pods_info) self.pods.insert('end', *self.podsRun) if self.podsRun is None: self.text_file.delete('1.0', END) messagebox.showerror("Error", "No request to send!!!") ConsoleUiLogger.submit_message('ERROR', "No request to send!!!") else: messagebox.showinfo("Info", "Request send...") if self.file is not None: ConsoleUiLogger.submit_message( 'INFO', "Send request for application describe in file: " + self.file.name) else: if self.value_app and self.value_param is not None: ConsoleUiLogger.submit_message( 'INFO', "Request for " + self.value_app + " " + self.value_param + " send...") self.btn_close.config(state=NORMAL)
def close(self): self.text_file.delete('1.0', END) ConsoleUiLogger.submit_message('INFO', "I'm deleting pod with name:") for pod in self.podsRun: if pod is False: ConsoleUiLogger.submit_message('WARNING', "pod not found") else: if kubernetes.delete_pod(pod, "test") is False: ConsoleUiLogger.submit_message('WARNING', "pod " + pod + " not found") else: ConsoleUiLogger.submit_message('INFO', " --> " + pod)
def run(self): self.text_file.delete('1.0', END) pods_info = None # =send_add_message_to_rabbit_or_runALL(self, self.file, self.value_app, self.value_param, self.PathVideo[self.value_param][0]) if pods_info is False: self.text_file.delete('1.0', END) messagebox.showwarning("Warn", "Pod is already present") ConsoleUiLogger.submit_message('WARNING', "Pod is already present") return else: self.podsRun.append(pods_info) self.pods.insert('end', *self.podsRun) if self.podsRun is None: self.text_file.delete('1.0', END) messagebox.showerror("Error", "No request to send!!!") ConsoleUiLogger.submit_message('ERROR', "No request to send!!!") else: messagebox.showinfo("Info", "Request send...") self.btn_close.config(state=NORMAL)
def close(self): self.text_file.delete('1.0', END) ConsoleUiLogger.submit_message('INFO', "I'm deleting pod with name:") result = None #send_del_message_to_rabbit(self, self.file, self.value_app, self.value_param) if result is False: ConsoleUiLogger.submit_message('WARNING', "Pod not found") else: ConsoleUiLogger.submit_message('INFO', "Cancellation message sent... ")