コード例 #1
0
 def respond_linked_view_state_change(self):
     s = not (self.linkedView().autoRangeEnabled()[self.axis()] is False)
     self.auto_range_enabled = s
     path = os.path.dirname(os.path.abspath(__file__))
     self.enable_auto_range_btn.setPixmap(
         QtGui.QPixmap(
             os.path.join(
                 path,
                 'autorange_toggle_' + ('on' if s else 'off') + '.png')))
コード例 #2
0
 def __init__(self,
              orientation,
              pen=None,
              linkView=None,
              parent=None,
              maxTickLength=-5,
              showValues=True):
     # Note - development branch of pyqtgraph adds extra argument textPen here.
     pg.AxisItem.__init__(self, orientation, pen, None, linkView, parent,
                          maxTickLength, showValues)
     self.set_lmt_btns = []
     self.aset_lmt_btns = []
     path = os.path.dirname(os.path.abspath(__file__))
     self.autorange_toggle_off_pixmap = QtGui.QPixmap(
         os.path.join(path, 'autorange_toggle_off.png'))
     self.autorange_toggle_on_pixmap = QtGui.QPixmap(
         os.path.join(path, 'autorange_toggle_on.png'))
     for type in range(2):
         # set limit button
         btn = pg.ButtonItem(
             QtGui.QPixmap(os.path.join(path, 'ellipsis.png')), 14, self)
         btn.setZValue(-1000)
         btn.setFlag(btn.ItemNegativeZStacksBehindParent)
         btn.clicked.connect(partial(self.set_lmt_btn_clicked,
                                     type))  # late binding if function used
         self.set_lmt_btns.append(btn)
         # autoset limit button
         btn = pg.ButtonItem(pg.pixmaps.getPixmap('auto'), 14, self)
         btn.setZValue(-1000)
         btn.setFlag(btn.ItemNegativeZStacksBehindParent)
         btn.clicked.connect(partial(self.aset_lmt_btn_clicked,
                                     type))  # late binding if function used
         self.aset_lmt_btns.append(btn)
     # enable autorange button
     btn = pg.ButtonItem(self.autorange_toggle_off_pixmap, 14, self)
     btn.setZValue(-1000)
     btn.setFlag(btn.ItemNegativeZStacksBehindParent)
     btn.clicked.connect(self.enable_auto_range_btn_clicked
                         )  # late binding if function used
     self.enable_auto_range_btn = btn
     self.mouseHovering = False
     self.buttons_enabled = True
     self.updateButtons()
コード例 #3
0
ファイル: display_graph.py プロジェクト: wuyou33/riaps-apps
    def __init__(self, image, parent=None):
        super(SystemState, self).__init__(parent=parent)
        self.layout = QtGui.QHBoxLayout(self)

        self.image = QtGui.QPixmap(image).scaledToHeight(120)
        self.imageLabel = QtGui.QLabel(self)
        self.imageLabel.setPixmap(self.image)
        self.bbinfo = BBInfo()

        self.layout.addWidget(self.imageLabel)
        self.layout.addWidget(self.bbinfo)
コード例 #4
0
ファイル: display_graph.py プロジェクト: wuyou33/riaps-apps
    def __init__(self, parent = None):
        super(StaticInfo, self).__init__(parent = parent)

        self.layout = QtGui.QHBoxLayout(self)

        self.logoPixmap = QtGui.QPixmap(WSU_LOGO)
        self.logoLabel = QtGui.QLabel(self)
        self.logoLabel.setPixmap(self.logoPixmap.scaledToWidth(900))

        #self.graphPixmap = QtGui.QPixmap(GRAPH_IMAGE)
        #self.graphLabel = QtGui.QLabel(self)
        #self.graphLabel.setPixmap(self.graphPixmap.scaledToWidth(550))

        self.layout.addWidget(self.logoLabel)
コード例 #5
0
ファイル: display_graph.py プロジェクト: gopshyam/RAS_GUI
    def __init__(self, parent=None):
        super(DemoWindow, self).__init__(parent=parent)
        self.showMaximized()

        self.graph = GraphWidget(self)

        self.verticalLayout = QtGui.QVBoxLayout(self)
        self.verticalLayout.addWidget(self.graph)

        self.logoPixmap = QtGui.QPixmap(WSU_LOGO)
        self.logoLabel = QtGui.QLabel(self)
        self.logoLabel.setPixmap(
            self.logoPixmap.scaledToWidth(self.frameGeometry().width() * 1.6))
        self.verticalLayout.addWidget(self.logoLabel)
コード例 #6
0
ファイル: display_graph.py プロジェクト: wuyou33/riaps-apps
    def __init__(self, parent = None):
        super(LineDiagram, self).__init__(parent = parent)

        self.layout = QtGui.QVBoxLayout(self)

        self.lineLabel = QtGui.QLabel(self)
        self.linePixmap = QtGui.QPixmap(LINE_DIAGRAM)
        self.lineLabel.setPixmap(self.linePixmap.scaledToHeight(400))

#        self.graphLabel = QtGui.QLabel(self)
#        self.graphPixmap = QtGui.QPixmap(GRAPH_IMAGE)
#        self.graphLabel.setPixmap(self.graphPixmap.scaledToHeight(300))

        self.layout.addWidget(self.parent().demoWindow.graph.w1)
        self.layout.addWidget(self.lineLabel)
コード例 #7
0
ファイル: RasGui.py プロジェクト: gopshyam/RAS_GUI
    def __init__(self, image, node_id=0, parent=None):
        super(SystemState, self).__init__(parent=parent)
        self.node_id = node_id

        self.layout = QtGui.QHBoxLayout(self)

        self.image = QtGui.QPixmap(image).scaledToHeight(150)
        self.imageLabel = QtGui.QLabel(self)
        self.imageLabel.setPixmap(self.image)
        self.bbinfo = BBInfo()

        self.failureButton = QtGui.QPushButton(self)
        self.failureButton.setText("Shut Down")

        self.layout.addWidget(self.failureButton)
        self.layout.addWidget(self.imageLabel)
        self.layout.addWidget(self.bbinfo)
コード例 #8
0
ファイル: RasGui.py プロジェクト: gopshyam/RAS_GUI
    def __init__(self, parent=None):
        super(GraphWidget, self).__init__(parent=parent)

        self.speed = 1
        self.index = 0

        self.plotSize = 500

        self.isZoomed = True

        self.state = NORMAL_STATE

        self.horizontalLayout = QtGui.QHBoxLayout(self)

        self.dataGenerator = DataGenerator()
        self.w1 = SpeedButton(self.dataGenerator)
        self.w1.fullPlotButton.clicked.connect(self.showFullPlot)
        self.w1.zoomButton.clicked.connect(self.toggleZoom)
        #self.w1.stopButton.clicked.connect(self.reset)

        #        self.w2 = Slider(-1, 1)
        #        self.horizontalLayout.addWidget(self.w2)

        #        self.w3 = Slider(-10, 10)
        #        self.horizontalLayout.addWidget(self.w3)

        #        self.w4 = Slider(-10, 10)
        #        self.horizontalLayout.addWidget(self.w4)

        self.pg_win = pg.GraphicsWindow(title="Power Generation")
        self.lf_win = pg.GraphicsWindow(title="Line Flow")
        self.heartbeat_win = pg.GraphicsWindow(title="Heartbeat messages")
        #self.update()

        #self.w1.slider.valueChanged.connect(self.setInterval)

        self.normalReadings = [60.0 for _ in range(PLOT_SIZE)]
        self.rasReadings = [30.0 for _ in range(PLOT_SIZE)]
        self.node1hb = [1 for _ in range(PLOT_SIZE)]
        self.node2hb = [2 for _ in range(PLOT_SIZE)]
        self.node3hb = [3 for _ in range(PLOT_SIZE)]

        #Print the difference between times and see if there's any hope, or else take the average of times

        #time_list = [(self.normalTimes[i+1] - self.normalTimes[i]).microseconds for i in range(len(self.normalTimes) - 1) ]
        #print float(sum(time_list)/1000)/float(len(time_list))

        #self.win.resize(1000, 600)

        pg.setConfigOptions(antialias=True)

        self.graphLayout = QtGui.QVBoxLayout()
        self.graphLayout.addWidget(self.pg_win)
        self.graphLayout.addWidget(self.lf_win)
        self.graphLayout.addWidget(self.heartbeat_win)

        self.horizontalLayout.addLayout(self.graphLayout)

        self.rangeStart = 0
        self.rangeEnd = 500
        self.rangeCount = 1

        self.tickList = [(x, x) for x in range(0, 500, 200)]

        self.normalPlot = self.pg_win.addPlot(title="Wind Power Generation")
        self.normalCurve = self.normalPlot.plot(pen=pg.mkPen('y', width=3))
        self.normalPlot.setYRange(50, 120, padding=0, update=False)
        self.normalPlot.setLabel("left", "Power Generation", units="MW")
        self.normalPlot.setLabel("bottom", "Time", units="ms")

        self.rasPlot = self.lf_win.addPlot(title="Line Flow")

        self.rasPlot.getAxis('bottom').setTicks([self.tickList])

        self.rasCurve = self.rasPlot.plot(pen=pg.mkPen('y', width=3))
        self.rasPlot.setYRange(0, 50, padding=0.1, update=False)
        self.rasPlot.setLabel("left", "Line Flow", units="MW")
        self.rasPlot.setLabel("bottom", "Time", units="ms")

        self.overloadCurve = pg.PlotCurveItem(
            [OVERLOAD_LIMIT for x in range(self.plotSize)])
        self.overloadCurve.setPen(
            pg.mkPen('r', style=QtCore.Qt.DashLine, width=4))
        self.rasPlot.addItem(self.overloadCurve)

        self.heartbeatPlot = self.heartbeat_win.addPlot(
            title="Heartbeat Messages")
        self.heartbeatPlot.setYRange(0, 4)
        self.heartbeatPlot.setLabel("bottom", "Time", units="ms")

        self.node1Curve = self.heartbeatPlot.plot(pen=pg.mkPen('r', width=3))
        self.node2Curve = self.heartbeatPlot.plot(pen=pg.mkPen('g', width=3))
        self.node3Curve = self.heartbeatPlot.plot(pen=pg.mkPen('b', width=3))

        self.horizontalLayout.addWidget(self.w1)

        self.systemStateLayout = SystemStateWidget(self)

        self.horizontalLayout.addWidget(self.systemStateLayout)

        self.lineDiagramLabel = QtGui.QLabel(self)
        self.lineDiagramPixmap = QtGui.QPixmap(LINE_DIAGRAM)
        self.lineDiagramLabel.setPixmap(
            self.lineDiagramPixmap.scaledToHeight(300))

        self.horizontalLayout.addWidget(self.lineDiagramLabel)

        self.timer = pg.QtCore.QTimer()
        self.timer.timeout.connect(self.update)
        self.timer.start(TIMEOUT)
コード例 #9
0
ファイル: RasGui.py プロジェクト: gopshyam/RAS_GUI
 def setImage(self, image):
     self.image = QtGui.QPixmap(image).scaledToHeight(150)
     self.imageLabel.setPixmap(self.image)
コード例 #10
0
ファイル: display_graph.py プロジェクト: gopshyam/RAS_GUI
    def __init__(self, parent=None):
        super(GraphWidget, self).__init__(parent=parent)

        self.speed = 1
        self.index = 0

        self.plotSize = 500

        self.isZoomed = True

        self.state = NORMAL_STATE

        self.horizontalLayout = QtGui.QHBoxLayout(self)

        self.dataGenerator = DataGenerator()
        self.w1 = SpeedButton(self.dataGenerator)
        self.w1.fullPlotButton.clicked.connect(self.showFullPlot)
        self.w1.zoomButton.clicked.connect(self.toggleZoom)
        self.w1.stopButton.clicked.connect(self.reset)

        #        self.w2 = Slider(-1, 1)
        #        self.horizontalLayout.addWidget(self.w2)

        #        self.w3 = Slider(-10, 10)
        #        self.horizontalLayout.addWidget(self.w3)

        #        self.w4 = Slider(-10, 10)
        #        self.horizontalLayout.addWidget(self.w4)

        self.win = pg.GraphicsWindow(title="UFLS Demo")
        #self.update()

        #self.w1.slider.valueChanged.connect(self.setInterval)

        self.normalReadings = [60.0 for _ in range(PLOT_SIZE)]
        self.rasReadings = [60.0 for _ in range(PLOT_SIZE)]

        #Print the difference between times and see if there's any hope, or else take the average of times

        #time_list = [(self.normalTimes[i+1] - self.normalTimes[i]).microseconds for i in range(len(self.normalTimes) - 1) ]
        #print float(sum(time_list)/1000)/float(len(time_list))

        self.win.resize(1000, 600)

        pg.setConfigOptions(antialias=True)

        self.horizontalLayout.addWidget(self.win)

        self.rangeStart = 0
        self.rangeEnd = 500
        self.rangeCount = 1

        self.tickList = [(x, x) for x in range(0, 500, 200)]

        self.normalPlot = self.win.addPlot(title="Without RAS")
        self.normalCurve = self.normalPlot.plot(pen=pg.mkPen('r', width=3))
        self.normalPlot.setYRange(49, 60, padding=0.1, update=False)
        self.normalPlot.setLabel("left", "Frequency", units="Hz")
        self.normalPlot.setLabel("bottom", "Time", units="ms")

        self.rasPlot = self.win.addPlot(title="With RAS")

        self.rasPlot.getAxis('bottom').setTicks([self.tickList])

        self.rasCurve = self.rasPlot.plot(pen=pg.mkPen('b', width=3))
        self.rasPlot.setYRange(58.1, 60, padding=0.1, update=False)
        self.rasPlot.setLabel("left", "Frequency", units="Hz")
        self.rasPlot.setLabel("bottom", "Time", units="ms")

        self.horizontalLayout.addWidget(self.w1)

        self.systemStateLayout = SystemStateWidget(self)

        self.horizontalLayout.addWidget(self.systemStateLayout)

        self.lineDiagramLabel = QtGui.QLabel(self)
        self.lineDiagramPixmap = QtGui.QPixmap(LINE_DIAGRAM)
        self.lineDiagramLabel.setPixmap(
            self.lineDiagramPixmap.scaledToHeight(300))

        self.horizontalLayout.addWidget(self.lineDiagramLabel)

        self.timer = pg.QtCore.QTimer()
        self.timer.timeout.connect(self.update)
        self.timer.start(TIMEOUT)