コード例 #1
0
ファイル: frames.py プロジェクト: littlezz/IslandCollection
    def init_list(self):
        """
        show database records
        :return:None
        """

        tasks = Tasks.get_all()

        # if there is no tasks in database , show one line
        if not tasks.exists():
            self.add_content_row()
            return

        for t in tasks:
            # TODO:fix this
            t.pop('create_time')
            self.add_content_row(**t)
コード例 #2
0
ファイル: frames.py プロジェクト: littlezz/IslandCollection
 def save(self):
     """
     save content info
     :return:
     """
     for index, row in enumerate(self.children.values()):
         task = row.get_as_dict()
         if self.validate_task(row, task):
             is_success = Tasks.create_or_update_data(task)
             # TODO: resolve not success
             if not is_success:
                 info = 'fail'
             else:
                 info='successful!'
             self.set_info(info)
             if not is_success:
                 break
         else:
             print(index)
             break
コード例 #3
0
ファイル: frames.py プロジェクト: littlezz/IslandCollection
 def delete(self):
     Tasks.delete_by_id(self.database_id)
     self.destroy()