summaryrefslogtreecommitdiffstats
path: root/src/Gui/CCDump.py
blob: 6993598e2fe5ed61a3dc45caae4b7c43f43728d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
from datetime import datetime

TYPE = 0
EDITABLE = 1
CONTENT = 2

class Dump():
    """Class for mapping the debug dump to python object"""
    def __init__(self):
        self.UUID = None
        self.UID = None
        self.Count = None
        self.Executable = None
        self.Package = None
        self.Time = None
        self.Description = None
        self.Message = None
        self.Reported = None

    def getUUID(self):
        return self.UUID[CONTENT]

    def getUID(self):
        return self.UID[CONTENT]

    def getCount(self):
        return self.Count[CONTENT]

    def getExecutable(self):
        return self.Executable[CONTENT]

    def getPackage(self):
        return self.Package[CONTENT]

    def isReported(self):
        return self.Reported[CONTENT] == "1"
        
    def getMessage(self):
        if not self.Message:
            return []
        #return self.Message[CONTENT].split('\n')
        return self.Message[CONTENT]

    def getTime(self,format):
        #print format
        if format:
            try:
                return datetime.fromtimestamp(int(self.Time[CONTENT])).strftime(format)
            except Exception, e:
                print e
        return int(self.Time[CONTENT])

    def getPackageName(self):
        return self.Package[CONTENT][:self.Package[CONTENT].find("-")]

    def getDescription(self):
        return self.Description[CONTENT]