Add ovsdbmonitor GUI tool by Andy Southgate, contributed by Citrix.
[sliver-openvswitch.git] / ovsdb / ovsdbmonitor / OVEStandard.py
1 # Copyright (c) 2010 Citrix Systems, Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import os, re, struct, sys, time, types, uuid
16 from copy import deepcopy
17 from pprint import pprint
18
19 # Set globalForcePySide to True to use PySide instead of PyQt if both are installed
20 globalForcePySide = False
21
22 try:
23     import json
24 except Exception, e:
25     print('+++ Python JSON module is required\n')
26     raise
27
28 try:
29     if globalForcePySide:
30         print('Forcing use of PySide')
31         raise Exception()
32     from PyQt4.QtCore import Qt, QVariant
33     from PyQt4 import QtCore, QtGui
34 except:
35     try:
36         from PySide.QtCore import Qt, QVariant
37         from PySide import QtCore, QtGui
38     except Exception, e:
39         print('+++ This application requires either PyQt4 or PySide\n')
40         raise
41