Esempio n. 1
0
    def __init__(self, parent_name='', curve_type=None, x1=None, x2=None, y1=None, y2=None, s=''):

        self.id = AnnotationObject.newid()

        # information to be saved in annotation file
        self.__parent_name = parent_name
        self.__curve_type = curve_type
        self.x_from = x1
        self.x_to = x2
        self.yval1 = y1
        self.yval2 = y2
        self.valid = True  # if a curve is valid and should be plotted
        self.text = Qwt.QwtText(self.text_wrap(str(s)))

        self.__too_small_limit = 0

        self.font_app = QtGui.QFont()

        # QPen settings
        self.pen_def = Qt.QPen()
        self.pen_symbol = Qt.QPen()
        self.symbol = Qwt.QwtSymbol()

        self.__default_pen = Qt.QPen()
        self.color_highlight = Qt.Qt.darkMagenta
Esempio n. 2
0
    def label(self, axisValue):
        # print str(axisValue)

        if not self._plot._bPlotDatesXAxis:
            return Qwt.QwtText(str(int(axisValue)))
        else:
            remaindermsecs = axisValue/self._fs - int(axisValue) / self._fs
            qtime = self._timeFirst.addSecs(int(axisValue) / self._fs)
            qtime = qtime.addMSecs(1000*remaindermsecs+1)
            # print "value {0}, qtime {1}".format(int(axisValue),qTime)

            return Qwt.QwtText(qtime.toString("hh:mm"))
Esempio n. 3
0
 def get_symbol_highlight(self):
     symbol = Qwt.QwtSymbol(self.symbol)
     pen = Qt.QPen(self.pen_symbol)
     pen.setColor(self.color_highlight)
     symbol.setPen(pen)
     symbol.setBrush(Qt.QBrush(self.color_highlight))  # new 2016-07-14
     return symbol
Esempio n. 4
0
 def ylabel(self, text=""):
     """ set the y axis label. The font is based on application font """
     font = self._font_app
     font.setBold(True)
     qtext = Qwt.QwtText(text)
     qtext.setFont(font)
     self.setAxisTitle(Qwt.QwtPlot.yLeft, qtext)
Esempio n. 5
0
    def __init__(self, parent=None):
        super(IVSweepDaqWidget, self).__init__(parent)
        self.setupUi(self)

        self.aoDeviceCombo.currentIndexChanged.connect(
            self.updateDaqChannelsAo)
        self.aiDeviceCombo.currentIndexChanged.connect(
            self.updateDaqChannelsAi)
        self.populateDaqCombos()
        self.restoreSettings()
        self.msmThread = None
        self.startPb.clicked.connect(self.startPbClicked)
        self.hkSub = HousekeepingSubscriber(self)
        self.hkSub.adrTemperatureReceived.connect(self.temperatureSb.setValue)
        self.hkSub.start()
        self.rawPlot.setAxisTitle(QwtPlot.yLeft, 'Vmeas')
        self.rawPlot.setAxisTitle(QwtPlot.xBottom, 'Vdrive')
        self.rawCurve = QwtPlotCurve('')
        self.rawCurve.attach(self.rawPlot)
        self.criticalCurve1 = QwtPlotCurve('+')
        self.criticalCurve1.setSymbol(
            Qwt.QwtSymbol(Qwt.QwtSymbol.Cross, Qt.QBrush(), Qt.QPen(Qt.Qt.red),
                          Qt.QSize(5, 5)))
        self.criticalCurve1.attach(self.criticalPlot)
        self.criticalCurve2 = QwtPlotCurve('-')
        self.criticalCurve2.setSymbol(
            Qwt.QwtSymbol(Qwt.QwtSymbol.Cross, Qt.QBrush(),
                          Qt.QPen(Qt.Qt.blue), Qt.QSize(5, 5)))
        self.criticalCurve2.attach(self.criticalPlot)
        self.criticalPlot.setAxisTitle(QwtPlot.yLeft, 'Vcrit')
        self.clearData()
        self.clearCriticalData()
        self.clearPb.clicked.connect(self.clearData)
        self.coilSweepCb.toggled.connect(self.toggleCoilSweep)
        self.clearCriticalPb.clicked.connect(self.clearCriticalData)
        self.samplesPerPointSb.valueChanged.connect(
            lambda value: self.discardSamplesSb.setMaximum(value - 1))
        self.coilEnableCb.toggled.connect(self.toggleCoil)
        self.coilVoltageSb.valueChanged.connect(self.updateCoilVoltage)
        self.toggleCoil(self.coilEnableCb.isChecked())
        self.coilDriverCombo.currentIndexChanged.connect(
            self.coilDriverChanged)
        self.Vcoil = np.nan
Esempio n. 6
0
    def __init__( self, parent=None ):

        # Initialize program and extract dial GUI
        QtGui.QWidget.__init__( self, parent )
        self.ui = Ui_MainWindow()
        self.ui.setupUi( self )
        self.thread = Worker( self )

        # Close rfObject socket on exit
        self.ui.pushButtonQuit.clicked.connect( self.cleanUp )

        # Setup gauge-needle dimensions
        self.ui.Dial.setOrigin( 90.0 )
        self.ui.Dial.setScaleArc( 0.0, 340.0 )
        self.ui.Dial.update()
        self.ui.Dial.setNeedle( Qwt.QwtDialSimpleNeedle(
                                                        Qwt.QwtDialSimpleNeedle.Arrow,
                                                        True, Qt.QColor(Qt.Qt.red),
                                                        Qt.QColor(Qt.Qt.gray).light(130)
                                                        )
                                )

        self.ui.Dial.setScaleOptions( Qwt.QwtDial.ScaleTicks |
                                      Qwt.QwtDial.ScaleLabel | Qwt.QwtDial.ScaleBackbone )

        # Small ticks are length 5, medium are 15, large are 20
        self.ui.Dial.setScaleTicks( 5, 15, 20 )
        
        # Large ticks show every 20, put 10 small ticks between
        # each large tick and every 5 small ticks make a medium tick
        self.ui.Dial.setScale( 10.0, 10.0, 20.0 )
        self.ui.Dial.setRange( 0.0, 300.0 )
        self.ui.Dial.setValue( 0 )

        # Unpack argumnet parser parameters as attributes
        self.directory = args["directory"]
        self.destination = args["destination"]
        self.address = args["stethoscope"]
        self.mode = args["mode"]

        # Boolean to control recording function
        self.init_rec = True

        # List all available BT devices
        self.ui.Dial.setEnabled( True )
        self.ui.pushButtonPair.setEnabled( False )
        self.ui.pushButtonPair.setText(QtGui.QApplication.translate("MainWindow", "Paired", None, QtGui.QApplication.UnicodeUTF8))
        
        # set timeout function for updates
        self.ctimer = QtCore.QTimer()
        self.ctimer.start( 10 )
        QtCore.QObject.connect( self.ctimer, QtCore.SIGNAL( "timeout()" ), self.UpdateDisplay )

        # Create logfile
        self.setup_log()
Esempio n. 7
0
    def text_wrap_evaluations(self, evals):
        """
        This is inverse function to get_text()

        The input is 1 line string: initial_ctg:abnormal__neurology:brain injury
        The output is left aligned:
        initial_ctg: abnormal    .
        neurology: brain injury  .

        :param evals: string of evaluation separated by __
        :return:
        """
        # compute value for text padding (to be align on right)
        n = 0
        for r in evals.split(self.sep):
            r = r.strip('\n')
            r = Qwt.QwtText(r)
            if n < r.textSize().width():
                n = r.textSize().width()

        eval_list = list()
        for r in evals.split(self.sep):

            if r == '':
                continue

            r = r.strip('\n')
            s = r.split(self.sep_type_and_value)
            s = '{0}{1} {2}'.format(s[0], self.sep_type_and_value, s[1])

            r = Qwt.QwtText(s)
            while r.textSize().width() < n:
                s += ' '
                r = Qwt.QwtText(s)

            # to have correct alignment
            s += '.'
            eval_list.append(s)

        s = '\n'.join(eval_list)
        return s
Esempio n. 8
0
    def label(self, axis_value):

        s = QtCore.QString(str(int(axis_value)))

        # doplnuji string podle pozadovane sirky
        while self._fontMetrics.width(s) <= self._max_w:
            s = ' '+s

        # s = '{:>8}'.format(axis_value) # tohle nefunguje protoze mezera ma jinou sirku nez cislo
        # print self._fontMetrics.width(s)

        return Qwt.QwtText(s)
Esempio n. 9
0
    def plot_second_stage_line(self, stage2pos_samp):
        """
        Plot the second stage of labour

        :param stage2pos_samp:
        :return:
        """
        meanline = Qwt.QwtPlotMarker()
        meanline.setLineStyle(Qwt.QwtPlotMarker.VLine)
        meanline.setLinePen(Qt.QPen(Qt.Qt.darkBlue, 4))

        meanline.setXValue(stage2pos_samp)
        meanline.attach(self)
Esempio n. 10
0
    def plot_first_stage_line(self, stage1pos_samp):
        """
        Plot the first stage of labour

        :param stage1pos_samp:
        :return:
        """
        meanline2 = Qwt.QwtPlotMarker()
        meanline2.setLineStyle(Qwt.QwtPlotMarker.VLine)
        meanline2.setLinePen(Qt.QPen(Qt.Qt.darkCyan, 4))

        meanline2.setXValue(stage1pos_samp)
        meanline2.attach(self)
    def rysuj_wykres(self, tablica_cash_flow, tablica_wolumenow, cf_laczone):
        try:
            _fromUtf8 = QtCore.QString.fromUtf8
        except AttributeError:
            _fromUtf8 = lambda s: s
        self.qwtPlot.hide()
        self.qwtPlot.destroy()

        self.qwtPlot = Qwt.QwtPlot(self.tab_3)
        self.qwtPlot.setGeometry(QtCore.QRect(0, 0, 891, 256))
        self.qwtPlot.setObjectName(_fromUtf8("qwtPlot"))
        self.qwtPlot.setAxisScale(Qwt.QwtPlot.xBottom, 0.0,
                                  len(tablica_cash_flow))
        self.qwtPlot.setAxisScale(
            Qwt.QwtPlot.yLeft, min(cf_laczone),
            max(max(tablica_cash_flow), max(tablica_wolumenow)))

        grid = Qwt.QwtPlotGrid()
        grid.enableXMin(True)
        grid.enableYMin(True)
        grid.setMajPen(QtGui.QPen(QtGui.QColor(0, 0, 0), 1))
        grid.setMinPen(QtGui.QPen(QtGui.QColor(100, 100, 100), 1))

        grid.attach(self.qwtPlot)

        #histogram = HistogramItem()
        #histogram.setColor(QtGui.QColor(170,170,100))

        numValues = len(tablica_cash_flow)
        intervals = []
        values = Qwt.QwtArrayDouble(numValues)

        argumenty = range(len(values))
        argumenty2 = []
        for arg in argumenty:
            argumenty2.append(float(arg))
        #argumenty2 = Qwt.QwtArrayDouble()
        i = 0
        #for args in argumenty:
        curve = Qwt.QwtPlotCurve("Curve " + str(i))
        curve.setPen(QtGui.QPen(QtGui.QBrush(QtGui.QColor(0, 255, 0)),
                                2))  # cash flow zielone
        curve.setData(argumenty2, tablica_cash_flow)
        curve.attach(self.qwtPlot)
        i = 1
        curve2 = Qwt.QwtPlotCurve("Curve " + str(i))
        curve2.setPen(QtGui.QPen(QtGui.QBrush(QtGui.QColor(255, 0, 0)),
                                 2))  # wolumen czerwony
        curve2.setData(argumenty2, tablica_wolumenow)
        curve2.attach(self.qwtPlot)
        i = 3
        curve3 = Qwt.QwtPlotCurve("Curve " + str(i))
        curve3.setPen(QtGui.QPen(QtGui.QBrush(QtGui.QColor(0, 0, 255)),
                                 2))  # suma niebieska
        curve3.setData(argumenty2, cf_laczone)
        curve3.attach(self.qwtPlot)

        self.qwtPlot.replot()
        self.qwtPlot.show()
Esempio n. 12
0
    def plot_bith_line(self, pos_samp):
        """
        Plot line indicating birth time

        :param pos_samp:
        :return:
        """
        meanline = Qwt.QwtPlotMarker()
        meanline.setLineStyle(Qwt.QwtPlotMarker.VLine)
        meanline.setLinePen(Qt.QPen(Qt.Qt.green, 4))

        meanline.setXValue(pos_samp)
        meanline.attach(self)
Esempio n. 13
0
    def __init__(self, parent):
        Plot.__init__(self, parent)

        # the plot and its data
        self._raster_data = RasterData(self)
        self._plot_item = Qwt.QwtPlotSpectrogram()
        self._plot_item.setData(self._raster_data)
        self._plot_item.attach(self)

        # enable colormap and -bar
        self._cbar = self.axisWidget(Qwt.QwtPlot.yRight)
        self._cbar.setColorBarEnabled(True)
        self.enableAxis(Qwt.QwtPlot.yRight)
        self.set_cbar()
Esempio n. 14
0
    def __init__(self, parent=None):

        # Initialize program and extract dial GUI
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.thread = Worker(self)

        # Close rfObject socket on exit
        self.ui.pushButtonQuit.clicked.connect(self.cleanUp)

        # Setup gauge-needle dimensions
        self.ui.Dial.setOrigin(90.0)
        self.ui.Dial.setScaleArc(0.0, 340.0)
        self.ui.Dial.update()
        self.ui.Dial.setNeedle(
            Qwt.QwtDialSimpleNeedle(Qwt.QwtDialSimpleNeedle.Arrow, True,
                                    Qt.QColor(Qt.Qt.red),
                                    Qt.QColor(Qt.Qt.gray).light(130)))

        self.ui.Dial.setScaleOptions(Qwt.QwtDial.ScaleTicks
                                     | Qwt.QwtDial.ScaleLabel
                                     | Qwt.QwtDial.ScaleBackbone)

        # Small ticks are length 5, medium are 15, large are 20
        self.ui.Dial.setScaleTicks(5, 15, 20)

        # Large ticks show every 20, put 10 small ticks between
        # each large tick and every 5 small ticks make a medium tick
        self.ui.Dial.setScale(10.0, 10.0, 20.0)
        self.ui.Dial.setRange(0.0, 300.0)
        self.ui.Dial.setValue(0)

        # List all available BT devices
        address = deviceBTAddress[0]
        self.ui.pushButtonPair.setEnabled(True)
        self.ui.pushButtonPair.setText(
            QtGui.QApplication.translate("MainWindow", "Click to Connect",
                                         None, QtGui.QApplication.UnicodeUTF8))
        self.ui.pushButtonPair.clicked.connect(
            lambda: self.connectStethoscope(address))
Esempio n. 15
0
    def __init__(self, parent_name='', curve_type=None, x1=None, x2=None, y1=None, y2=None, s=''):
        super(AnnotationObject, self).__init__()
        AnnotationObject.__init__(self, parent_name, curve_type, x1, x2, y1, y2, s)
        Qwt.QwtPlotCurve.__init__(self)

        # self.text.text()  - contains points for floating baseline
        # in the following format: x1-y1, x2-y2, x3-y3, etc.

        self._fbaseline_x = []
        self._fbaseline_y = []

        if curve_type == EnumAnnType.floating_baseline:

            c = Qt.QColor(Qt.Qt.blue)
            c.setAlpha(100)

            cb = Qt.QColor(Qt.Qt.blue)
            cb.setAlpha(0)

            self.define_pen(color=c, width=3, line=Qt.Qt.SolidLine)
            self.define_pen_symbol(c, 3)
            self.define_symbol(Qwt.QwtSymbol.Rect, cb, Qt.QSize(12, 12))
            self.set_too_small_limit(0)

            self.setStyle(Qwt.QwtPlotCurve.Lines)
            self.setCurveAttribute(Qwt.QwtPlotCurve.Fitted, True)

            self.fitter = Qwt.QwtSplineCurveFitter()
            self.fitter.setFitMode(Qwt.QwtSplineCurveFitter.ParametricSpline)
            self.fitter.setSplineSize(500)
            self.setCurveFitter(self.fitter)

            self.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased)

        else:
            raise Exception('Do not use PyQwtPlotFloatingBaseline for this type of curve')

        self.set_default_pen()
        self.setPen(self.pen_def)
        self.setSymbol(self.symbol)
Esempio n. 16
0
    def changePlotWidget(self, library, frame_for_plot):
        if library == "Qwt5" and has_qwt:
            plotWdg = QwtPlot(frame_for_plot)
            sizePolicy = QSizePolicy(QSizePolicy.Expanding,
                                     QSizePolicy.Expanding)
            sizePolicy.setHorizontalStretch(0)
            sizePolicy.setVerticalStretch(0)
            sizePolicy.setHeightForWidth(
                plotWdg.sizePolicy().hasHeightForWidth())
            plotWdg.setSizePolicy(sizePolicy)
            plotWdg.setMinimumSize(QSize(0, 0))
            plotWdg.setAutoFillBackground(False)
            #Decoration
            plotWdg.setCanvasBackground(Qt.white)
            plotWdg.plotLayout().setAlignCanvasToScales(True)
            zoomer = QwtPlotZoomer(QwtPlot.xBottom, QwtPlot.yLeft,
                                   QwtPicker.DragSelection,
                                   QwtPicker.AlwaysOff, plotWdg.canvas())
            zoomer.setRubberBandPen(QPen(Qt.blue))
            if platform.system() != "Windows":
                # disable picker in Windows due to crashes
                picker = QwtPlotPicker(QwtPlot.xBottom, QwtPlot.yLeft,
                                       QwtPicker.NoSelection,
                                       QwtPlotPicker.CrossRubberBand,
                                       QwtPicker.AlwaysOn, plotWdg.canvas())
                picker.setTrackerPen(QPen(Qt.green))
            #self.dockwidget.qwtPlot.insertLegend(QwtLegend(), QwtPlot.BottomLegend);
            grid = Qwt.QwtPlotGrid()
            grid.setPen(QPen(QColor('grey'), 0, Qt.DotLine))
            grid.attach(plotWdg)
            return plotWdg
        elif library == "Matplotlib" and has_mpl:
            from matplotlib.figure import Figure
            from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg

            fig = Figure((1.0, 1.0),
                         linewidth=0.0,
                         subplotpars=matplotlib.figure.SubplotParams(left=0,
                                                                     bottom=0,
                                                                     right=1,
                                                                     top=1,
                                                                     wspace=0,
                                                                     hspace=0))

            font = {'family': 'arial', 'weight': 'normal', 'size': 12}
            matplotlib.rc('font', **font)

            rect = fig.patch
            rect.set_facecolor((0.9, 0.9, 0.9))

            self.subplot = fig.add_axes((0.07, 0.15, 0.92, 0.82))
            self.subplot.set_xbound(0, 1000)
            self.subplot.set_ybound(0, 1000)
            self.manageMatplotlibAxe(self.subplot)
            canvas = FigureCanvasQTAgg(fig)
            sizePolicy = QSizePolicy(QSizePolicy.Expanding,
                                     QSizePolicy.Expanding)
            sizePolicy.setHorizontalStretch(0)
            sizePolicy.setVerticalStretch(0)
            canvas.setSizePolicy(sizePolicy)
            return canvas
Esempio n. 17
0
 def define_symbol(self, s=Qwt.QwtSymbol.VLine, c=Qt.Qt.black, qsize=Qt.QSize(15, 15)):
     self.symbol = Qwt.QwtSymbol(s, Qt.QBrush(c), self.pen_symbol, qsize)
Esempio n. 18
0
    def __init__(self, parent=None, name=''):
        Qwt.QwtPlot.__init__(self, parent)

        self._log = logging.getLogger(ConfigStatic.logger_name)
        self._log.info('passed')

        self.__name = name
        self._font_app = QtGui.QFont()

        dpi = 96
        # TODO test physicalDpi (funguje v MainWindow.py)
        self._dpi2px = dpi*(1/2.54)
        self._plotSpeed = EnumPlotSpeed.oneCmMin
        self._plotBpm = EnumPlotBpm.twentyBpmCm
        self._plotBpmMajorTick = self._plotBpm

        #: Doc comment for instance attribute qux.
        self._minView = 0
        self._maxView = 240
        self._min_view_paper_lim = 0
        self._max_view_paper_lim = 240
        self._paper_format = EnumPaperFormat.EU
        self._minTime = 0
        self._maxTime = 0
        self._centerPoint = 0
        self.__sampling_freq = 4

        self._x = np.zeros(1)
        self._y = np.zeros(1)
        self._timeString = list()

        self._define_paper()

        # self.__canvasXMap = self.canvasMap(Qwt.QwtPlot.xBottom)
        # self.__canvasYMap = self.canvasMap(Qwt.QwtPlot.yLeft)

        self.setCanvasBackground(Qt.Qt.white)
        self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time [min]")
        self.setAxisTitle(Qwt.QwtPlot.yLeft, "")

        # curves
        self.curve1 = Qwt.QwtPlotCurve('signal')
        # #self.curve1.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased)
        # self.curve1.setPen(QPen(Qt.Qt.black,0, Qt.Qt.SolidLine))
        # self.curve1.setYAxis(Qwt.QwtPlot.yLeft)
        # self.curve1.attach(self)
        self._baseline = Qwt.QwtPlotMarker()

        ''' annotations '''
        self.__d_ann_all_curves = dict()
        self.d_ann_all_curves_navplot = dict()
        self.__ann_action = 0
        self.caliper = Caliper(self, EnumAnnType.plot_fhr, EnumAnnType.caliper)
        # self.caliper.plot()

        # time scale - for string time scale
        self.timeScale = TimeScaleDraw(self)
        self.setAxisScaleDraw(Qwt.QwtPlot.xBottom, self.timeScale)

        # time scale - for Y axis
        self.yAxisScale = AxisYScaleDraw(self)
        self.setAxisScaleDraw(Qwt.QwtPlot.yLeft, self.yAxisScale)

        self._bPlotDatesXAxis = False
        self._time_tics_located = list()
        self._locator_min = 5
        self._locator_hour = 0

        # grid
        self.grid = Qwt.QwtPlotGrid()
        self.grid.enableYMin(True)
        self.grid.enableXMin(True)
        self.grid.setMajPen(QtGui.QPen(Qt.Qt.lightGray, 0, Qt.Qt.SolidLine))
        self.grid.setMinPen(QtGui.QPen(Qt.Qt.lightGray, 0, Qt.Qt.DotLine))
        self.grid.attach(self)

        self.__set_axis_app_font()
Esempio n. 19
0
    def __init__(self):
        try:
            rostopic.get_topic_class('/rosout')  # is_rosmaster_running = True
        except rostopic.ROSTopicIOException as e:
            roscore = subprocess.Popen('roscore')  # then start roscore yourself
            time.sleep(1)  # wait a bit to be sure the roscore is really launched

        app = QApplication(sys.argv)
        window = QMainWindow()
        ui = Ui_RhagGUI()
        ui.setupUi(window)

        # functions for several buttons
        # applying and loading settings, closing etc.

        okBtn = ui.buttonBox.button(QtGui.QDialogButtonBox.Ok)  # todo: Ok needs a function
        okBtn.clicked.connect(lambda: saveSettings(window, jsonVR))
        # okBtn.clicked.connect(ui.statusbar.showMessage('Ok has no function yet'))

        cancelBtn = ui.buttonBox.button(QtGui.QDialogButtonBox.Cancel)
        cancelBtn.clicked.connect(lambda: saveClose(window))  # save to recent and close
        # app.aboutToQuit.connect(lambda :saveClose(window))
        # todo: is closing the window smart?
        # todo: is saving last known config on cancel smart?

        defaultBtn = ui.buttonBox.button(QtGui.QDialogButtonBox.RestoreDefaults)
        defaultBtn.clicked.connect(lambda: loadSettings(window, jsonDefault))

        saveBtn = ui.buttonBox.button(QtGui.QDialogButtonBox.Save)
        saveBtn.clicked.connect(lambda: saveSettings(window, jsonCurrent))

        saveAsBtn = ui.buttonBox.button(QtGui.QDialogButtonBox.SaveAll)
        saveAsBtn.setText("Save as")
        saveAsBtn.clicked.connect(lambda: openSave(window))

        loadBtn = ui.buttonBox.button(QtGui.QDialogButtonBox.Open)
        loadBtn.setText("Load")  # because it is actually open button
        # loadBtn.clicked.connect(lambda: loadSettings(window, filePath + jsonFile))
        loadBtn.clicked.connect(lambda: openLoad(window))

        resetBtn = ui.buttonBox.button(QtGui.QDialogButtonBox.Reset)
        resetBtn.clicked.connect(lambda: loadSettings(window, jsonCurrent))

        # recordPathBtn = ui.buttonBox.button(ui.frameRecordPathBtn)
        # file = str(QFileDialog.getExistingDirectory(self, "Select Directory"))
        ui.frameRecordPathBtn.clicked.connect(lambda: showSaveDialog(window, ui.frameRecordPath))
        # 'frameRecordPath': [ui.frameRecordPathBtn,showSaveDialog,ui.frameRecordPath],


        # todo. open the last tab on close


        ui.startVRBtn.clicked.connect(lambda: startVR())
        ui.stopVRBtn.clicked.connect(lambda: stopVR())
        ui.camParamBtn.clicked.connect(lambda: startCameraParam())
        ui.wbadBtn.clicked.connect(lambda: startWbad())
        ui.rqtBtn.clicked.connect(lambda: startRqt())
        ui.resetView.clicked.connect(lambda: resetView())
        ui.clearPlot.clicked.connect(lambda: clearPlot())

        ui.compassServo.setNeedle(Qwt.QwtDialSimpleNeedle(Qwt.QwtDialSimpleNeedle.Arrow))
        ui.compassServo.setOrigin(270)
        # to set north as north
        # always start rosnode inside main else imports end in loop

        ui.compassHeading.setNeedle(Qwt.QwtDialSimpleNeedle(Qwt.QwtDialSimpleNeedle.Arrow))
        ui.compassHeading.setOrigin(270)  # to set north as north

        RosSubscriber('GUI', '/trajectory', MsgTrajectory, clbk)
        my_plot = pg.PlotWidget()
        ui.trajectoryLayout.addWidget(my_plot)
        s1 = pg.ScatterPlotItem(size=2, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 120))
        # resetView()

        timer = QTimer()
        timer.timeout.connect(tick)
        timer.start(100)

        myDict = {
            'greenTexPath': [ui.greenTexPathBtn, showFileDialog, ui.greenTexPath],
            'redTexPath': [ui.redTexPathBtn, showFileDialog, ui.redTexPath],
            'object1': [ui.obj1PathBtn, showFileDialog, ui.object1],
            'object2': [ui.obj2PathBtn, showFileDialog, ui.object2],
            'treeTexPath': [ui.treeTexPathBtn, showFileDialog, ui.treeTexPath],
            'skyMapBtn': [ui.skyMapBtn, showFileDialog, ui.skyMap],
            'skyMapNullBtn': [ui.skyMapNullBtn, showFileDialog, ui.skyMapNull],
            'modelHeightMap': [ui.modelHeightMapBtn, showFileDialog, ui.modelHeightMap],
            'modelTextureMap': [ui.modelTextureMapBtn, showFileDialog, ui.modelTextureMap],
            'modelTextureMapNull': [ui.modelTextureMapNullBtn, showFileDialog, ui.modelTextureMapNull],

            'odour1': [ui.odourBtn1, showFileDialog, ui.odour1],
            'odour2': [ui.odourBtn2, showFileDialog, ui.odour2],
            'odour3': [ui.odourBtn3, showFileDialog, ui.odour3],
            'odour4': [ui.odourBtn4, showFileDialog, ui.odour4],
            'odour1Mask': [ui.odour1MaskBtn, showFileDialog, ui.odour1Mask],
            'odour2Mask': [ui.odour2MaskBtn, showFileDialog, ui.odour2Mask],
            'odour3Mask': [ui.odour3MaskBtn, showFileDialog, ui.odour3Mask],
            'odour4Mask': [ui.odour4MaskBtn, showFileDialog, ui.odour4Mask],
            'beepPath': [ui.beepPathBtn, showFileDialog, ui.beepPath],

        }
        callLooper(myDict)

        try:
            loadSettings(window, jsonCurrent)  # load the last run config
        except ValueError:
            pass

        window.show()

        try:
            (app.exec_())
        except KeyboardInterrupt:
            sys.exit()
Esempio n. 20
0

    ui.startVRBtn.clicked.connect(lambda: startVR())
    ui.stopVRBtn.clicked.connect(lambda: stopVR())
    ui.camParamBtn.clicked.connect(lambda: startCameraParam())
    ui.wbadBtn.clicked.connect(lambda: startWbad())
    ui.rqtBtn.clicked.connect(lambda: startRqt())
    ui.resetView.clicked.connect(lambda :resetView())
    ui.clearPlot.clicked.connect(lambda :clearPlot())
    ui.clearPlot_2.clicked.connect(lambda :clearPlot())

    ui.replayPathBtn.clicked.connect(lambda :showFileDialog(window, ui.replayPath, pathModel,local=False))

# ui.greenTexPathBtn, showFileDialog, ui.greenTexPath

    ui.compassServo.setNeedle(Qwt.QwtDialSimpleNeedle(Qwt.QwtDialSimpleNeedle.Arrow))
    ui.compassServo.setOrigin(270)
    ui.compassServo_2.setNeedle(Qwt.QwtDialSimpleNeedle(Qwt.QwtDialSimpleNeedle.Arrow))
    ui.compassServo_2.setOrigin(270)
    # to set north as north
    # always start rosnode inside main else imports end in loop

    ui.compassHeading.setNeedle(Qwt.QwtDialSimpleNeedle(Qwt.QwtDialSimpleNeedle.Arrow))
    ui.compassHeading.setOrigin(270)# to set north as north

    ui.compassSlip.setNeedle(Qwt.QwtDialSimpleNeedle(Qwt.QwtDialSimpleNeedle.Arrow))
    ui.compassSlip.setOrigin(270)# to set north as north



Esempio n. 21
0
 def range(self):
     if self.limits == None:
         return (Qwt.QwtDoubleInterval(self._data.min(), self._data.max()))
     else:
         return (Qwt.QwtDoubleInterval(self.limits[0], self.limits[1]))