X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Fovsdbmonitor%2FOVEFlowWindow.py;h=e5a29a9f05d87928eac0128b725e6c8cab4c2cd7;hb=bba1e6f3ac53ecb810f07b26fb312ee503f5e121;hp=ebcf466e878ea2881b4b5e76091eda4288259db0;hpb=436f27dd880bd4e1e1d06ca2744c875b01b9e1c1;p=openvswitch diff --git a/ovsdb/ovsdbmonitor/OVEFlowWindow.py b/ovsdb/ovsdbmonitor/OVEFlowWindow.py index ebcf466e..e5a29a9f 100644 --- a/ovsdb/ovsdbmonitor/OVEFlowWindow.py +++ b/ovsdb/ovsdbmonitor/OVEFlowWindow.py @@ -1,3 +1,4 @@ +# Copyright (c) 2011 Nicira Networks. # Copyright (c) 2010 Citrix Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,6 +23,8 @@ from OVECommonWindow import * from Ui_FlowWindow import * +import re + class OVEFlowWindow(QtGui.QMainWindow, OVECommonWindow): LOAD_KEY = 'FlowWindow/window' COMMAND_OVS_DPCTL='/usr/bin/ovs-dpctl' @@ -231,7 +234,6 @@ class OVEFlowWindow(QtGui.QMainWindow, OVECommonWindow): colour = Qt.black for colNum, data in enumerate(flow): - item = None try: item = table.takeItem(rowNum, colNum) @@ -245,7 +247,7 @@ class OVEFlowWindow(QtGui.QMainWindow, OVECommonWindow): 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: