def on_client_not_found(path_list = ".,..,../client", client_name = "gst-ipcam-client"): ''' this function will be called in the case that our program can not search any client in default path ''' print "Can not find the client, please give me something to search:" new_path_list = raw_input("Directories to search: [" + path_list + "]). If ok, input Y, else, give me new paths:") if new_path_list == "Y" or new_path_list == "y": pass else: path_list = new_path_list new_client_name = raw_input("Name of the client is " + client_name + ". If ok, input Y, else give me new name:") if new_client_name == "Y" or new_client_name == "y": pass else: client_name = new_client_name client_paths = find_file(client_name, path_list) if len(client_paths) <= 0: on_client_not_found(path_list, client_name) else: gisMcClient.set_client_path(client_paths[0])
def on_client_not_found(path_list=".,..,../client", client_name="gst-ipcam-client"): ''' this function will be called in the case that our program can not search any client in default path ''' print "Can not find the client, please give me something to search:" new_path_list = raw_input("Directories to search: [" + path_list + "]). If ok, input Y, else, give me new paths:") if new_path_list == "Y" or new_path_list == "y": pass else: path_list = new_path_list new_client_name = raw_input("Name of the client is " + client_name + ". If ok, input Y, else give me new name:") if new_client_name == "Y" or new_client_name == "y": pass else: client_name = new_client_name client_paths = find_file(client_name, path_list) if len(client_paths) <= 0: on_client_not_found(path_list, client_name) else: gisMcClient.set_client_path(client_paths[0])
if new_path_list == "Y" or new_path_list == "y": pass else: path_list = new_path_list new_client_name = raw_input("Name of the client is " + client_name + ". If ok, input Y, else give me new name:") if new_client_name == "Y" or new_client_name == "y": pass else: client_name = new_client_name client_paths = find_file(client_name, path_list) if len(client_paths) <= 0: on_client_not_found(path_list, client_name) else: gisMcClient.set_client_path(client_paths[0]) if __name__ == "__main__": if gisMcClient.validate_client_path() == False: dirs_to_search = str.join(",", [".", "..", "../client"]) client_name = "gst-ipcam-client" client_paths = find_file(client_name, dirs_to_search) if len(client_paths) > 0: gisMcClient.set_client_path(client_paths[0]) else: on_client_not_found(dirs_to_search, client_name) show_intro() while (1): command = raw_input("Give me a command:\n") process_input(command) if command == "exit": sys.exit(0)
else: path_list = new_path_list new_client_name = raw_input("Name of the client is " + client_name + ". If ok, input Y, else give me new name:") if new_client_name == "Y" or new_client_name == "y": pass else: client_name = new_client_name client_paths = find_file(client_name, path_list) if len(client_paths) <= 0: on_client_not_found(path_list, client_name) else: gisMcClient.set_client_path(client_paths[0]) if __name__ == "__main__": if gisMcClient.validate_client_path() == False: dirs_to_search = str.join(",", [".", "..", "../client"]) client_name = "gst-ipcam-client" client_paths = find_file(client_name, dirs_to_search) if len(client_paths) > 0: gisMcClient.set_client_path(client_paths[0]) else: on_client_not_found(dirs_to_search, client_name) show_intro() while (1): command = raw_input("Give me a command:\n") process_input(command) if command == "exit": sys.exit(0)