-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent.py
130 lines (101 loc) · 3 KB
/
component.py
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/python
import sys
try:
import web
except ImportError:
sys.path.append("/home/edrop/opt/python/lib/python2.4/site-packages")
import web
from web import form
components = []
class component(object):
def __init__(self):
super(component, self).__init__()
self.key = ''
self.input = None
self.data = ''
def startFilter(self, line):
if self.data == '' or self.data == None:
return True
try:
if line.find(self.data) != -1:
return True
except TypeError:
print self.key, self.data
return False
def endFilter(self, line):
return True
def layout(self):
return form.Textbox(self.key, description=self.key)
class keyFilter(component):
def __init__(self, key):
super(keyFilter, self).__init__()
self.key = key
self.data = ''
def layout(self):
return form.Textbox(self.key, description=self.key)
class srcFilter(component):
def __init__(self):
super(srcFilter, self).__init__()
self.key = 'src'
self.data = ''
def startFilter(self, line):
if self.data == 'all':
return True
if line.find(self.data) != -1:
return True
return False
def layout(self):
return form.Radio('src', ['all', 'web', 'windows', 'android', 'iphone'])
class beforeTime(component):
def __init__(self, module):
super(beforeTime, self).__init__()
self.key = 'beforeTime'
self.data = ''
self.starTime = 0
self.endTime = 0
self.type = 1
self.module = module
def startFilter(self, line):
time = self.module.logTime.findTime(line)
if time <= self.starTime:
return True
return False
def endFilter(self, line):
time = self.module.logTime.findTime(line)
if time >= self.endTime:
return True
return False
def layout(self):
return None
class afterTime(component):
def __init__(self, module):
super(afterTime, self).__init__()
self.key = 'afterTime'
self.data = ''
self.starTime = 0
self.endTime = 0
self.type = 1
self.module = module
def startFilter(self, line):
time = self.module.logTime.findTime(line)
if self.starTime <= time <=self.endTime:
return True
return False
def endFilter(self, line):
time = self.module.logTime.findTime(line)
if self.starTime <= time <=self.endTime:
return True
return False
def layout(self):
return None
class Exception(component):
def __init__(self):
super(Time, self).__init__()
self.key = 'src'
self.data = ''
def startFilter(self, line):
if line.find(self.data) != -1:
return False
return True
def layout(self):
return form.Radio('src', ['all', 'web', 'windows', 'android', 'iphone'])