from pub_dbi import pubdb_conn_info # catch ctrl+C to terminate the program import signal # DB interface: global dbi dbi = ds_reader(pubdb_conn_info.reader_info()) #Establish a connection to the database through the DBI try: dbi.connect() except: print "Unable to connect to database... womp womp :(" #suppress warnings temporarily: QtCore.qInstallMsgHandler(lambda *args: None) #Initialize the GUI to show plots from each project #Initialize Qt (only once per application) qapp = QtGui.QApplication([]) view = pg.GraphicsView() #l is a GraphicsLayoutWidget l = pg.GraphicsLayout() #border=(100,100,100)) view.setCentralItem(l) view.setWindowTitle('PUBS Monitoring GUI') view.resize(600, 600) view.show() #Get a list of all projects from the DBI projects = dbi.list_all_projects( ) # [project, command, server, sleepafter .... , enabled, resource]
from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg from custom_piechart_class import PieChartItem from custom_qgraphicsscene import CustomQGraphicsScene import signal #suppress warnings temporarily: QtCore.qInstallMsgHandler(lambda *args: None) #Always start with this app = QtGui.QApplication([]) #These don't seem to change anything, so I'll leave them at zero scene_xmin = 0 scene_ymin = 0 scene_width = 200 scene_height = 200 scene = CustomQGraphicsScene(scene_xmin,scene_ymin,scene_width,scene_height) p1 = PieChartItem(('first_piechart',scene_xmin+scene_width*0.5, scene_ymin+scene_height*0.5, 50, [ (0.5, 'b'), (0.25, 'r'), (0.25, 'g') ])) p1.setDescript('this is a test string that should be a description of the project. in fact let\'s make it really long so we can test if text wraps around or not when we draw it.') p2 = PieChartItem(('second_piechart',scene_xmin+scene_width*0.75, scene_ymin+scene_height*0.75, 10, [ (1., 'r') ])) p2.setDescript('this is the red pie chart!!!!!!1!!!11!!!!one') scene.addItem(p1) scene.addItem(p2) view = QtGui.QGraphicsView(scene) #Enforce the view to align with upper-left corner