예제 #1
0
    def contextMenuEvent(self, event):
        action_display_current = Qt.QAction(self)
        action_display_current.setText('Display Current')
        action_display_current.setCheckable(True)
        action_display_current.setChecked(
            self.taurusValueBuddy().getDisplayAttr() == 'current')
        slot = partial(self.taurusValueBuddy().setDisplayAttr, 'current')
        self.connect(action_display_current, Qt.SIGNAL('toggled(bool)'), slot)

        action_display_pressure = Qt.QAction(self)
        action_display_pressure.setText('Display Pressure')
        action_display_pressure.setCheckable(True)
        action_display_pressure.setChecked(
            self.taurusValueBuddy().getDisplayAttr() == 'pressure')
        slot = partial(self.taurusValueBuddy().setDisplayAttr, 'pressure')
        self.connect(action_display_pressure, Qt.SIGNAL('toggled(bool)'), slot)

        action_display_voltage = Qt.QAction(self)
        action_display_voltage.setText('Display Voltage')
        action_display_voltage.setCheckable(True)
        action_display_voltage.setChecked(
            self.taurusValueBuddy().getDisplayAttr() == 'voltage')
        slot = partial(self.taurusValueBuddy().setDisplayAttr, 'voltage')
        self.connect(action_display_voltage, Qt.SIGNAL('toggled(bool)'), slot)

        action_device_panel = Qt.QAction(self)
        action_device_panel.setText('Show Device Panel')
        self.connect(action_device_panel, Qt.SIGNAL('triggered()'),
                     self.taurusValueBuddy().showDevicePanel)

        action_start = Qt.QAction(self)
        action_start.setText('Start')
        self.connect(action_start, Qt.SIGNAL('triggered()'),
                     self.taurusValueBuddy().start)

        action_stop = Qt.QAction(self)
        action_stop.setText('Stop')
        self.connect(action_stop, Qt.SIGNAL('triggered()'),
                     self.taurusValueBuddy().stop)

        action_reconnect = Qt.QAction(self)
        action_reconnect.setText('Reconnect')
        self.connect(action_reconnect, Qt.SIGNAL('triggered()'),
                     self.taurusValueBuddy().reconnect)

        menu = Qt.QMenu(self)
        menu.addAction(action_device_panel)
        menu.addSeparator()
        menu.addAction(action_display_pressure)
        menu.addAction(action_display_current)
        menu.addAction(action_display_voltage)
        menu.addSeparator()
        menu.addAction(action_start)
        menu.addAction(action_stop)
        menu.addSeparator()
        menu.addAction(action_reconnect)
        menu.exec_(event.globalPos())
        event.accept()
예제 #2
0
    def contextMenuEvent(self, event):
        action_device_panel = Qt.QAction(self)
        action_device_panel.setText('Show Device Panel')
        self.connect(action_device_panel, Qt.SIGNAL('triggered()'),
                     self.taurusValueBuddy().showDevicePanel)

        action_move_in = Qt.QAction(self)
        action_move_in.setText('Move In')
        self.connect(action_move_in, Qt.SIGNAL('triggered()'),
                     self.taurusValueBuddy().moveIn)

        action_move_out = Qt.QAction(self)
        action_move_out.setText('Move Out')
        self.connect(action_move_out, Qt.SIGNAL('triggered()'),
                     self.taurusValueBuddy().moveOut)

        menu = Qt.QMenu(self)
        menu.addAction(action_device_panel)
        menu.addSeparator()
        menu.addAction(action_move_in)
        menu.addAction(action_move_out)
        menu.exec_(event.globalPos())
        event.accept()