def get_direct_sync_status_from_indicator(self, direct_sync_indicator): retVal = False if direct_sync_indicator is not None: try: retVal = utils.str_to_bool_int(config_vars.resolve_str(direct_sync_indicator)) except: pass return retVal
def get_direct_sync_status_from_indicator(self, direct_sync_indicator): retVal = False if direct_sync_indicator is not None: try: retVal = utils.str_to_bool_int(var_stack.ResolveStrToStr(direct_sync_indicator)) except: pass return retVal
def do_command(self): self.curr_progress = int(var_stack.ResolveVarToStr("__START_DYNAMIC_PROGRESS__")) self.total_progress = int(var_stack.ResolveVarToStr("__TOTAL_DYNAMIC_PROGRESS__")) # if var does not exist default is 0, meaning not to display dynamic progress self.progress_staccato_period = int(var_stack.ResolveVarToStr("PROGRESS_STACCATO_PERIOD")) self.progress_staccato_count = 0 do_command_func = getattr(self, "do_" + self.fixed_command) before_time = time.clock() do_command_func() after_time = time.clock() if utils.str_to_bool_int(var_stack.unresolved_var("PRINT_COMMAND_TIME")): print(self.the_command, "time:", round(after_time - before_time, 2), "sec.")
def create_client_frame(self, master): client_frame = Frame(master) client_frame.grid(row=0, column=0) curr_row = 0 command_label = Label(client_frame, text="Command:") command_label.grid(row=curr_row, column=0, sticky=W) # instl command selection client_command_list = var_stack.ResolveVarToList("__CLIENT_GUI_CMD_LIST__") self.client_command_name_var.set(var_stack.unresolved_var("CLIENT_GUI_CMD")) OptionMenu(client_frame, self.client_command_name_var, self.client_command_name_var.get(), *client_command_list, command=self.update_client_state).grid(row=curr_row, column=1, sticky=W) self.run_client_batch_file_var.set(utils.str_to_bool_int(var_stack.unresolved_var("CLIENT_GUI_RUN_BATCH"))) self.client_run_batch_file_checkbox = Checkbutton(client_frame, text="Run batch file", variable=self.run_client_batch_file_var, command=self.update_client_state) self.client_run_batch_file_checkbox.grid(row=curr_row, column=2, sticky=E) # path to input file curr_row += 1 Label(client_frame, text="Input file:").grid(row=curr_row, column=0) self.client_input_path_var.set(var_stack.unresolved_var("CLIENT_GUI_IN_FILE")) self.client_input_combobox = Combobox(client_frame, textvariable=self.client_input_path_var) self.client_input_combobox.grid(row=curr_row, column=1, columnspan=2, sticky=W + E) self.client_input_path_var.trace('w', self.update_client_state) Button(client_frame, width=2, text="...", command=self.get_client_input_file).grid(row=curr_row, column=3, sticky=W) Button(client_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.ResolveVarToStr("CLIENT_GUI_IN_FILE"))).grid(row=curr_row, column=4, sticky=W) Button(client_frame, width=3, text="Chk", command=lambda: self.check_yaml(var_stack.ResolveVarToStr("CLIENT_GUI_IN_FILE"))).grid(row=curr_row, column=5, sticky=W) # path to output file curr_row += 1 Label(client_frame, text="Batch file:").grid(row=curr_row, column=0) self.client_output_path_var.set(var_stack.unresolved_var("CLIENT_GUI_OUT_FILE")) Entry(client_frame, textvariable=self.client_output_path_var).grid(row=curr_row, column=1, columnspan=2, sticky=W+E) self.client_output_path_var.trace('w', self.update_client_state) Button(client_frame, width=2, text="...", command=self.get_client_output_file).grid(row=curr_row, column=3, sticky=W) Button(client_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.ResolveVarToStr("CLIENT_GUI_OUT_FILE"))).grid(row=curr_row, column=4, sticky=W) # s3 user credentials curr_row += 1 Label(client_frame, text="Credentials:").grid(row=curr_row, column=0, sticky=E) self.client_credentials_var.set(var_stack.unresolved_var("CLIENT_GUI_CREDENTIALS")) Entry(client_frame, textvariable=self.client_credentials_var).grid(row=curr_row, column=1, columnspan=2, sticky=W+E) self.client_credentials_var.trace('w', self.update_client_state) self.client_credentials_on_var.set(var_stack.unresolved_var("CLIENT_GUI_CREDENTIALS_ON")) Checkbutton(client_frame, text="", variable=self.client_credentials_on_var).grid(row=curr_row, column=3, sticky=W) self.client_credentials_on_var.trace('w', self.update_client_state) # the combined command line text curr_row += 1 Button(client_frame, width=6, text="run:", command=self.run_client).grid(row=curr_row, column=0, sticky=W) self.client_command_line_var = StringVar() Label(client_frame, textvariable=self.client_command_line_var, wraplength=400, anchor=W).grid(row=curr_row, column=1, columnspan=4, sticky=W) client_frame.grid_columnconfigure(0, minsize=80) client_frame.grid_columnconfigure(1, minsize=300) client_frame.grid_columnconfigure(2, minsize=80) return client_frame
def create_admin_frame(self, master): admin_frame = Frame(master) admin_frame.grid(row=0, column=1) curr_row = 0 Label(admin_frame, text="Command:").grid(row=curr_row, column=0, sticky=E) # instl command selection self.admin_command_name_var.set(var_stack.unresolved_var("ADMIN_GUI_CMD")) admin_command_list = var_stack.ResolveVarToList("__ADMIN_GUI_CMD_LIST__") commandNameMenu = OptionMenu(admin_frame, self.admin_command_name_var, self.admin_command_name_var.get(), *admin_command_list, command=self.update_admin_state) commandNameMenu.grid(row=curr_row, column=1, sticky=W) ToolTip(commandNameMenu, msg="instl admin command") self.run_admin_batch_file_var.set(utils.str_to_bool_int(var_stack.unresolved_var("ADMIN_GUI_RUN_BATCH"))) self.admin_run_batch_file_checkbox = Checkbutton(admin_frame, text="Run batch file", variable=self.run_admin_batch_file_var, command=self.update_admin_state) self.admin_run_batch_file_checkbox.grid(row=curr_row, column=2, columnspan=2, sticky=E) # path to config file curr_row += 1 Label(admin_frame, text="Config file:").grid(row=curr_row, column=0, sticky=E) self.admin_config_path_var.set(var_stack.unresolved_var("ADMIN_GUI_CONFIG_FILE")) configFilePathEntry = Entry(admin_frame, textvariable=self.admin_config_path_var) configFilePathEntry.grid(row=curr_row, column=1, columnspan=2, sticky=W + E) ToolTip(configFilePathEntry, msg="path instl repository config file") self.admin_config_path_var.trace('w', self.update_admin_state) openConfigButt = Button(admin_frame, width=2, text="...", command=self.get_admin_config_file) openConfigButt.grid(row=curr_row, column=3, sticky=W) ToolTip(openConfigButt, msg="open admin config file") editConfigButt = Button(admin_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.ResolveVarToStr("ADMIN_GUI_CONFIG_FILE"))) editConfigButt.grid(row=curr_row, column=4, sticky=W) ToolTip(editConfigButt, msg="edit admin config file") checkConfigButt = Button(admin_frame, width=3, text="Chk", command=lambda: self.check_yaml(var_stack.ResolveVarToStr("ADMIN_GUI_CONFIG_FILE"))) checkConfigButt.grid(row=curr_row, column=5, sticky=W) ToolTip(checkConfigButt, msg="read admin config file to check it's structure") # path to stage index file curr_row += 1 Label(admin_frame, text="Stage index:").grid(row=curr_row, column=0, sticky=E) Label(admin_frame, text="---", textvariable=self.admin_stage_index_var).grid(row=curr_row, column=1, columnspan=2, sticky=W) editIndexButt = Button(admin_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.ResolveVarToStr("__STAGING_INDEX_FILE__"))) editIndexButt.grid(row=curr_row, column=4, sticky=W) ToolTip(editIndexButt, msg="edit repository index") checkIndexButt = Button(admin_frame, width=3, text="Chk", command=lambda: self.check_yaml(var_stack.ResolveVarToStr("__STAGING_INDEX_FILE__"))) checkIndexButt.grid(row=curr_row, column=5, sticky=W) ToolTip(checkIndexButt, msg="read repository index to check it's structure") # path to svn repository curr_row += 1 Label(admin_frame, text="Svn repo:").grid(row=curr_row, column=0, sticky=E) svnRepoLabel = Label(admin_frame, text="---", textvariable=self.admin_svn_repo_var) svnRepoLabel.grid(row=curr_row, column=1, columnspan=2, sticky=W) ToolTip(svnRepoLabel, msg="URL of the SVN repository with current repo-rev") # sync URL curr_row += 1 Label(admin_frame, text="Sync URL:").grid(row=curr_row, column=0, sticky=E) syncURLLabel = Label(admin_frame, text="---", textvariable=self.admin_sync_url_var) syncURLLabel.grid(row=curr_row, column=1, columnspan=2, sticky=W) ToolTip(syncURLLabel, msg="Top URL for uploading to the repository") # path to output file curr_row += 1 Label(admin_frame, text="Batch file:").grid(row=curr_row, column=0, sticky=E) self.admin_output_path_var.set(var_stack.unresolved_var("ADMIN_GUI_OUT_BATCH_FILE")) Entry(admin_frame, textvariable=self.admin_output_path_var).grid(row=curr_row, column=1, columnspan=2, sticky=W+E) self.admin_output_path_var.trace('w', self.update_admin_state) Button(admin_frame, width=2, text="...", command=self.get_admin_output_file).grid(row=curr_row, column=3, sticky=W) Button(admin_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.ResolveVarToStr("ADMIN_GUI_OUT_BATCH_FILE"))).grid(row=curr_row, column=4, sticky=W) # relative path to limit folder curr_row += 1 Label(admin_frame, text="Limit to:").grid(row=curr_row, column=0, sticky=E) self.admin_limit_var.set(var_stack.unresolved_var("ADMIN_GUI_LIMIT")) self.limit_path_entry_widget = Entry(admin_frame, textvariable=self.admin_limit_var) self.limit_path_entry_widget.grid(row=curr_row, column=1, columnspan=2, sticky=W + E) self.admin_limit_var.trace('w', self.update_admin_state) # the combined command line text curr_row += 1 Button(admin_frame, width=6, text="run:", command=self.run_admin).grid(row=curr_row, column=0, sticky=W) self.admin_command_line_var = StringVar() Label(admin_frame, textvariable=self.admin_command_line_var, wraplength=400, anchor=W).grid(row=curr_row, column=1, columnspan=2, sticky=W) return admin_frame