Mercurial > traipse_dev
comparison plugins/server/base_plugin.py @ 0:4385a7d0efd1 grumpy-goblin
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
author | sirebral |
---|---|
date | Tue, 14 Jul 2009 16:41:58 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4385a7d0efd1 |
---|---|
1 import sys | |
2 import os | |
3 | |
4 class BasePluginClass(object): | |
5 def __init__(self): | |
6 self.__name = "" | |
7 self.__author = "" | |
8 self.__help = "" | |
9 self.__file = __file__ | |
10 self.__activated = False | |
11 self.__inputpriority = -1 # -1 = not used; 99 = priority doesn't matter | |
12 # Any other number is priority, lowest number | |
13 # executes first | |
14 self.__outputpriority = -1# -1 = not used; 99 = priority doesn't matter | |
15 # Any other number is priority, lowest number | |
16 # executes first | |
17 self.__pollpriority = -1 # -1 = not used; 99 = priority doesn't matter | |
18 # Any other number is priority, lowest number | |
19 # executes first | |
20 | |
21 | |
22 def preParseIncoming(self, xml_dom, data): | |
23 return xml_dom, data | |
24 | |
25 def postParseIncoming(self, data): | |
26 return data | |
27 | |
28 def getPlayer(self): | |
29 return None | |
30 | |
31 def setPlayer(self, playerData): | |
32 return | |
33 | |
34 def preParseOutgoing(self): | |
35 return [] | |
36 | |
37 | |
38 def _getName(self): | |
39 return self.__name | |
40 | |
41 def _setName(self, val): | |
42 if isinstance(val, basestring): | |
43 self.__name = val | |
44 else: | |
45 self.__name = str(val) | |
46 | |
47 | |
48 def _getAuthor(self): | |
49 return self.__author | |
50 | |
51 def _setAuthor(self, val): | |
52 if isinstance(val, basestring): | |
53 self.__author = val | |
54 else: | |
55 self.__author = str(val) | |
56 | |
57 | |
58 def _getHelp(self): | |
59 return self.__help | |
60 | |
61 def _setHelp(self, val): | |
62 if isinstance(val, basestring): | |
63 self.__help = val | |
64 else: | |
65 self.__help = str(val) | |
66 | |
67 | |
68 def _getFile(self): | |
69 return self.__file | |
70 | |
71 def _setFile(self, val): | |
72 if isinstance(val, basestring): | |
73 self.__file = val | |
74 else: | |
75 self.__file = str(val) | |
76 | |
77 | |
78 def _getActivated(self): | |
79 return self.__activated | |
80 | |
81 def _setActivated(self, val): | |
82 if isinstance(val, bool): | |
83 self.__activated = val | |
84 elif isinstance(val, int): | |
85 if val <= 0: | |
86 self.__activated = False | |
87 else: | |
88 self.__activated = True | |
89 else: | |
90 self.__activated = False | |
91 | |
92 | |
93 def _getInputPriority(self): | |
94 return self.__activated | |
95 | |
96 def _setInputPriority(self, val): | |
97 if isinstance(val, int) and val in xrange(-1, 100): | |
98 self.__inputpriority = val | |
99 else: | |
100 self.__inputpriority = -1 | |
101 | |
102 | |
103 def _getOutputPriority(self): | |
104 return self.__activated | |
105 | |
106 def _setOutputPriority(self, val): | |
107 if isinstance(val, int) and val in xrange(-1, 100): | |
108 self.__outputpriority = val | |
109 else: | |
110 self.__outputpriority = -1 | |
111 | |
112 | |
113 def _getPollPriority(self): | |
114 return self.__pollpriority | |
115 | |
116 def _setPollPriority(self, val): | |
117 if isinstance(val, int) and val in xrange(-1, 100): | |
118 self.__pollpriority = val | |
119 else: | |
120 self.__pollpriority = -1 | |
121 | |
122 Name = property(_getName, _setName) | |
123 Author = property(_getAuthor, _setAuthor) | |
124 Help = property(_getHelp, _setHelp) | |
125 File = property(_getFile, _setFile) | |
126 Activated = property(_getActivated, _setActivated) | |
127 InputPriority = property(_getInputPriority, _setInputPriority) | |
128 OutputPriority = property(_getOutputPriority, _setOutputPriority) | |
129 PollPriority = property(_getPollPriority, _setPollPriority) | |
130 |