當前位置: 首頁>>代碼示例>>Python>>正文


Python Data.loadProject方法代碼示例

本文整理匯總了Python中Data.loadProject方法的典型用法代碼示例。如果您正苦於以下問題:Python Data.loadProject方法的具體用法?Python Data.loadProject怎麽用?Python Data.loadProject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Data的用法示例。


在下文中一共展示了Data.loadProject方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Controller

# 需要導入模塊: import Data [as 別名]
# 或者: from Data import loadProject [as 別名]
class Controller(cmd.Cmd):
    def __init__(self):
        cmd.Cmd.__init__(self)
        self.intro = 'Welcome to Siggy\'s Data Presentation Program - SDPP \n'
        self.prompt = '>'
        self.data = Data()

    def do_load_data(self, importString):
        """
Load data from the specified file and location: load_data ./data/data4.csv
Will ask for name of new table.
        """
        if not self.checkSingleParam(importString):
            return
        print('load_data')
        tableName = input("Input table name>")
        l = tableName.split()
        if len(l) != 1:
            print("Table name can't be blank and must not contain spaces.")
            return
        self.data.importData(importString, tableName)

    def do_save_project(self, saveString):
        """
Save project to the specified file and location: save_project myproject.dat
        """
        if not self.checkSingleParam(saveString):
            return
        print('save_project')
        self.data.saveProject(saveString)

    def do_load_project(self, loadString):
        """
Load project from the specified file and location: load_project myproject.dat
        """
        if not self.checkSingleParam(loadString):
            return
        print('load_project')
        self.data.loadProject(loadString)

    def do_show(self, tableName):
        """
Show the current loaded data tables: show
        """
        l = tableName.split()
        if len(l) < 2:
            print('show')
            self.data.printData(tableName)

    def do_make_piechart(self, line):
        """
Will create Pie Chart.
        """
        pieChartTemplate = PieChartCreator()
        if (pieChartTemplate.setupChart(self.data)):
            myChart = pieChartTemplate.returnChart()
            if (isinstance(myChart, PieChart)):
                myChart.drawChart()

    def do_make_barchart(self, line):
        """
Will create Pie Chart.
        """
        barChartTemplate = BarChartCreator()
        if (barChartTemplate.setupChart(self.data)):
            myChart = barChartTemplate.returnChart()
            if (isinstance(myChart, BarChart)):
                myChart.drawChart()

    def do_exit(self, line):
        'Exit the program'
        return True

    def checkSingleParam(self, string):
        l = string.split()
        if len(l) != 1:
            print("Invalid number of arguments")
            return False
        return True
開發者ID:SiggyPony,項目名稱:SiggyAssignmentThree,代碼行數:81,代碼來源:Main.py


注:本文中的Data.loadProject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。