Пример #1
0
 def onSave(self, event):
     date = datetime.date.today()
     #start_time = time.strftime("%H:%M")
     now = datetime.datetime.now()
     for index in self.tasks:
         if index['big'] == u'1小时':
             now = now + datetime.timedelta(hours=1)
             big_or_not = False
         else:
             now = now + datetime.timedelta(hours=2)
             big_or_not = True
         ct.addRecord(**({'cat':index['cat'], 'task':index['task'],
             'date':date, 'start_time':now, 'big_or_not':big_or_not}))
Пример #2
0
    def onAdd(self):
        """
        Add the record to the database
        """
        bookDict = self.getData()
        data = ({"book": bookDict})
        controller.addRecord(data)

        # show dialog upon completion
        commonDlgs.showMessageDlg("Config value added", "Success!",
                                  wx.ICON_INFORMATION)

        # clear dialog so we can add another book
        for child in self.GetChildren():
            if isinstance(child, wx.TextCtrl):
                child.SetValue("")
Пример #3
0
 def onAdd(self):
     """
     Add the record to the database
     """
     authorDict, bookDict = self.getData()
     data = ({"author":authorDict, "book":bookDict})
     controller.addRecord(data)
     
     # show dialog upon completion
     commonDlgs.showMessageDlg("Book Added",
                               "Success!", wx.ICON_INFORMATION)
     
     # clear dialog so we can add another book
     for child in self.GetChildren():
         if isinstance(child, wx.TextCtrl):
             child.SetValue("")
Пример #4
0
 def onSave(self, event):
     date = datetime.date.today()
     #start_time = time.strftime("%H:%M")
     now = datetime.datetime.now()
     for index in self.tasks:
         if index['big'] == u'1小时':
             now = now + datetime.timedelta(hours=1)
             big_or_not = False
         else:
             now = now + datetime.timedelta(hours=2)
             big_or_not = True
         ct.addRecord(**({
             'cat': index['cat'],
             'task': index['task'],
             'date': date,
             'start_time': now,
             'big_or_not': big_or_not
         }))
    def onAdd(self):
        """ 
        Method to add a record to the database.
        """
        # Get the text input fields from the form.
        dictAuthor, dictBook = self.getData()

        # Create a dictonary of dictonaries.
        data = ({'author': dictAuthor, 'book': dictBook})
        controller.addRecord(data)

        # display a dialog to notify the end user that the record has been added.
        commonDlgs.showMessageDlg("Book Added!", "Success!",
                                  wx.ICON_INFORMATION)

        # clear the text fields to add another record.
        for child in self.GetChildren():
            if isinstance(child, wx.TextCtrl):
                child.SetValue("")
Пример #6
0
    def onAdd(self):
#        row = self.getData()
#        err_dict = {0:u"新增人员",
#                1:u"员工号重复",
#                9:u"操作失败:未知错误",}
        res = controller.addRecord(self.info_dict)
#        if  res == 0:
#            wx.MessageBox(u"操作成功:"+err_dict[res], "Success")
        for child in self.GetChildren():
            if isinstance(child, wx.TextCtrl):
                child.SetValue("")
        self.Destroy()