+# Copyright (c) 2011 Nicira, Inc.
# Copyright (c) 2010 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
from Ui_FlowWindow import *
+import re
+
class OVEFlowWindow(QtGui.QMainWindow, OVECommonWindow):
LOAD_KEY = 'FlowWindow/window'
COMMAND_OVS_DPCTL='/usr/bin/ovs-dpctl'
colour = Qt.black
for colNum, data in enumerate(flow):
-
item = None
try:
item = table.takeItem(rowNum, colNum)
elif colNum == srcMacColumn or colNum == destMacColumn:
cols = [int(x, 16) for x in data.split(':')]
item.setBackground(QtGui.QColor(255-cols[2]*cols[3] % 192, 255-cols[3]*cols[4] % 192, 255-cols[4]*cols[5] % 192))
- elif colNum == srcIPColumn or colNum == destIPColumn:
+ elif re.match(r'[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', str(data)):
cols = [int(x) for x in data.split('.')]
item.setBackground(QtGui.QColor(255-cols[1]*cols[2] % 192, 255-cols[2]*cols[3] % 192, 255-cols[3]*cols[0] % 192))
else: