Exemplo n.º 1
0
    def onFileRead(self, filePath):
        if filePath:
            try:
                lines = DailyDataDAL.readAll(filePath)
                dailyData = DailyDataDAL.parse(lines, TimeUtil.getToday())
                DailyDataDAL.persistAll(dailyData)

                newDailyData = DailyDataDAL.fetchAllByDate(TimeUtil.getToday())
                self.buyerPanel.updateGrid(newDailyData.toStringList())

                wx.MessageBox("导入数据成功", "导入数据", style=wx.OK | wx.ICON_EXCLAMATION)
            except:
                wx.MessageBox("导入数据失败,请检测数据格式", "导入数据", style=wx.OK | wx.ICON_EXCLAMATION)
Exemplo n.º 2
0
    def onSearchDate(self, evt):
        dailyData = DailyDataDAL.fetchAllByDate(self.dateInput.GetValue())

        scoreSum = 0
        for (userName, scores) in dailyData.dailyScore.items():
            scoreSum -= ScoreCalculation.calculateTotal(scores)
        self.score.SetLabel(str(scoreSum))
Exemplo n.º 3
0
    def displayTodayData(self):
        sizer = wx.GridBagSizer(4, 4)
        today = TimeUtil.getToday()
        # Load buyer data
        dailyData = DailyDataDAL.fetchAllByDate(today)

        # set data into data grid
        self.data = UserGridData()
        self.data.InsertRows(dailyData.toStringList())
        self.grid = wx.grid.Grid(self, size=(500, 300))
        self.grid.SetTable(self.data)
        self.grid.AutoSize()
        sizer.Add(self.grid, pos=(1, 1), span=(3, 3), flag=wx.EXPAND | wx.TOP, border=5)

        searchText = wx.StaticText(self, label='名称')
        sizer.Add(searchText, pos=(4, 1), flag=wx.EXPAND, border=5)

        self.searchInput = wx.TextCtrl(self, style=wx.TE_PROCESS_ENTER)
        self.Bind(wx.EVT_TEXT_ENTER, self.onSearchName, self.searchInput)
        sizer.Add(self.searchInput, pos=(4, 2),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)


        self.searchBtn = wx.Button(self, label='查找', size=(100, 20))
        sizer.Add(self.searchBtn, pos=(4, 3))
        self.searchBtn.Enable(True)
        self.Bind(wx.EVT_BUTTON, self.onSearchName, self.searchBtn)

        sizer.AddGrowableRow(1)
        self.vBox.Add(sizer, wx.ALIGN_BOTTOM, 10)
Exemplo n.º 4
0
 def onSearchDate(self, evt):
     dailyData = DailyDataDAL.fetchAllByDate(self.dateInput.GetValue())
     self.updateGrid(dailyData.toStringList())
Exemplo n.º 5
0
 def onSearchName(self, evt):
     dailyData = DailyDataDAL.fetchByNameDate(self.dateInput.GetValue(), self.searchInput.GetValue())
     self.updateGrid(dailyData.toStringList())