def do_show(self, line): # Get all instructions# This function enable to create dictionary option # to respective commands and the system find matches # to the respective option to show individual map / view # # Written By: Patel # args = list(arg.lower() for arg in str(line).split()) # Those commands are required single arguments # single_commands = ["-a"] # Those commands are required two arguments # Show data table if args[0] == "-t": if len(self._shw.data) == 0 and len(self._shw.new_data) == 0: View.info("No data to display.") if not len(self._shw.data) == 0: View.display("ORIGINAL DATA:") View.display_data(self._shw.data, ind=True) if not len(self._shw.new_data) == 0: View.display("\nNEW DATA:") View.display_data(self._shw.new_data, ind=True) View.display("\n(Input command \"save\" to save the new data)") else: View.info("Invalid command line.\n") View.help_show()
def do_graph_show(self, line): _graph = None graph_director = GraphDirector(None) plot_commands = ["-p", "-b", "-c"] if args[0] in plot_commands: try: if len(args) == 1: raise IndexError("Incomplete command line.") if args[0] == "-p": graph_builder = self._graph.show_pie(self._data_list) graph_director.set_builder(graph_builder) if args[0] == "-b": graph_builder = self._graph.show_bar(self._data_list) graph_director.set_builder(graph_builder) if args[0] == "-c": graph_builder = self._graph.show_scatter(self._data_list) graph_director.set_builder(graph_builder) except IndexError as e: View.error(str(e) + "\n") View.help_show() else: View.info("Invalid command line.\n") View.help_show() graph_director.construct() _graph = graph_builder.get_graph() return _graph
def do_show(self, line): # Get all instructions# This function enable to create dictionary option # to respective commands and the system find matches # to the respective option to show individual map / view # # Written By: Patel # args = list(arg.lower() for arg in str(line).split()) # Those commands are required single arguments # single_commands = ["-a"] # Those commands are required two arguments plot_commands = ["-p", "-b", "-c"] # Show data table if args[0] == "-t": if len(self._shw.data) == 0 and len(self._shw.new_data) == 0: View.info("No data to display.") if not len(self._shw.data) == 0: View.display("ORIGINAL DATA:") View.display_data(self._shw.data, ind=True) if not len(self._shw.new_data) == 0: View.display("\nNEW DATA:") View.display_data(self._shw.new_data, ind=True) View.display("\n(Input command \"save\" to save the new data)") elif args[0] in plot_commands: try: if len(args) == 1: raise IndexError("Incomplete command line.") if args[0] == "-p": self.show_pie(args[1]) if args[0] == "-b": self.show_bar(args[1]) if args[0] == "-c": self.show_scatter(args[1]) except IndexError as e: View.error(str(e) + "\n") View.help_show() else: View.info("Invalid command line.\n") View.help_show()
def help_show(): View.help_show()