MCPcopy
hub / github.com/evilsocket/opensnitch / run

Method run

ui/opensnitch/plugins/highlight/highlight.py:176–292  ·  view source on GitHub ↗

Highlight cells or rows based on patterns. Return if the cell was modified. Keyword arguments: args -- tuple of options.

(self, parent, args)

Source from the content-addressed store, hash-verified

174 return self._config
175
176 def run(self, parent, args):
177 """Highlight cells or rows based on patterns.
178
179 Return if the cell was modified.
180
181 Keyword arguments:
182 args -- tuple of options.
183 """
184 #parent == ColorizedDelegate
185 painter = args[0]
186 option = args[1]
187 index = args[2]
188 style = args[3]
189 modelColumns = args[4]
190 curRow = args[5]
191 curColumn = args[6]
192 defaultPen = args[7]
193 defaultBrush = args[8]
194 cellAlignment = args[9]
195 cellRect = args[10]
196 cellValue = args[11]
197 #print(type(self), ">", type(parent), ">", type(option.widget))
198
199 # signal that this cell has been modified
200 modified = False
201
202 cells = self._config.get(Highlight.CELLS)
203 rows = self._config.get(Highlight.ROWS)
204
205 if cells:
206 for cell in cells:
207 if curColumn not in cell[Highlight.COLS]:
208 continue
209 if cellValue not in cell[Highlight.TEXT]:
210 continue
211# TODO
212# if cell['operator'] == 'simple' and cellValue != cell['text']:
213# continue
214# elif cell['text'] not in cellValue:
215# continue
216
217 cellColor = cell.get(Highlight.COLOR)
218 cellBgColor = cell.get(Highlight.BGCOLOR)
219 if cell.get(Highlight.ALIGNMENT) != None:
220 cellAlignment = cell[Highlight.ALIGNMENT]
221 if cell.get(Highlight.MARGINS) != None:
222 cellRect.adjust(
223 int(cell[Highlight.MARGINS][self.HMARGIN]),
224 int(cell[Highlight.MARGINS][self.VMARGIN]),
225 -defaultPen.width(),
226 -defaultPen.width()
227 )
228
229 modified=True
230 self.paintCell(
231 style,
232 painter,
233 option,

Callers

nothing calls this directly

Calls 3

paintCellMethod · 0.95
getMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected