コード例 #1
0
ファイル: plotting_widgets.py プロジェクト: kanzy/emzed2
    def __init__(self, parent=None, rangeSelectionCallback=None):

        PlotterBase.__init__(self, "RT", "I")

        self.rangeSelectionCallback = rangeSelectionCallback

        widget = self.widget
        widget.plot.__class__ = RtPlot

        self.pm = PlotManager(widget)
        self.pm.add_plot(widget.plot)

        t = self.pm.add_tool(RtSelectionTool)
        t.activate()
        self.pm.set_default_tool(t)

        marker = Marker(label_cb=self.widget.plot.label_info,
                        constraint_cb=self.widget.plot.on_plot)
        marker.rts = [0]
        setupStyleRtMarker(marker)
        marker.attach(self.widget.plot)
        self.marker = marker

        self.cursor_info = RtCursorInfo(marker)
        label = make.info_label("T", [self.cursor_info], title=None)
        label.labelparam.label = ""
        label.labelparam.font.size = 12
        label.labelparam.border.color = "#ffffff"
        label.labelparam.update_label(label)
        self.label = label

        self.minRTRangeSelected = None
        self.maxRTRangeSelected = None
コード例 #2
0
    def __init__(self):
        super(RealtimeDemo, self).__init__()
        self.setWindowTitle(u"Realtime Demo")

        self.data = {u"t":array("d")}
        for name in sum(PLOT_DEFINE, []):
            self.data[name] = array("d")

        self.curves = {}
        self.t = 0
        vbox = QVBoxLayout()
        vbox.addWidget(self.setup_toolbar())
        self.manager = PlotManager(self)
        self.plots = []
        for i, define in enumerate(PLOT_DEFINE):
            plot = CurvePlot()
            plot.axisScaleDraw(CurvePlot.Y_LEFT).setMinimumExtent(60)
            self.manager.add_plot(plot)
            self.plots.append(plot)
            plot.plot_id = id(plot)
            for j, curve_name in enumerate(define):
                curve = self.curves[curve_name] = make.curve([0], [0], color=COLORS[j], title=curve_name)
                plot.add_item(curve)
            plot.add_item(make.legend("BL"))
            vbox.addWidget(plot)
        self.manager.register_standard_tools()
        self.manager.get_default_tool().activate()
        self.manager.synchronize_axis(CurvePlot.X_BOTTOM, self.manager.plots.keys())
        self.setLayout(vbox)
        self.startTimer(100)
コード例 #3
0
    def __init__(self, wintitle):
        super(Window, self).__init__()
        self.default_tool = None
        self.plots = []
        self.itemlist = PlotItemList(None)
        self.contrast = ContrastAdjustment(None)
        self.xcsw = XCrossSection(None)
        self.ycsw = YCrossSection(None)

        self.manager = PlotManager(self)
        self.toolbar = QToolBar(_("Tools"), self)
        self.manager.add_toolbar(self.toolbar, "default")
        self.toolbar.setMovable(True)
        self.toolbar.setFloatable(True)
        self.addToolBar(Qt.TopToolBarArea, self.toolbar)

        frame = QFrame(self)
        self.setCentralWidget(frame)
        self.layout = QGridLayout()
        layout = QVBoxLayout(frame)
        frame.setLayout(layout)
        layout.addLayout(self.layout)
        self.frame = frame

        self.setWindowTitle(wintitle)
        self.setWindowIcon(get_icon('guiqwt.svg'))
コード例 #4
0
ファイル: syncplot.py プロジェクト: PierreRaybaut/guiqwt
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle(self.__doc__)
        self.setWindowIcon(get_icon("guiqwt.svg"))

        self.manager = manager = PlotManager(None)
        manager.set_main(self)
        self.subplotwidget = spwidget = SubplotWidget(manager, parent=self)
        self.setLayout(QW.QVBoxLayout())
        toolbar = QW.QToolBar(_("Tools"))
        manager.add_toolbar(toolbar)
        self.layout().addWidget(toolbar)
        self.layout().addWidget(spwidget)

        plot1 = CurvePlot(title="TL")
        plot2 = CurvePlot(title="TR")
        plot3 = CurvePlot(title="BL")
        plot4 = CurvePlot(title="BR")
        spwidget.add_subplot(plot1, 0, 0, "1")
        spwidget.add_subplot(plot2, 0, 1, "2")
        spwidget.add_subplot(plot3, 1, 0, "3")
        spwidget.add_subplot(plot4, 1, 1, "4")
        spwidget.add_itemlist()
        manager.synchronize_axis(BasePlot.X_BOTTOM, ["1", "3"])
        manager.synchronize_axis(BasePlot.X_BOTTOM, ["2", "4"])
        manager.synchronize_axis(BasePlot.Y_LEFT, ["1", "2"])
        manager.synchronize_axis(BasePlot.Y_LEFT, ["3", "4"])

        self.manager.register_all_curve_tools()
コード例 #5
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle("Signal filtering 2 (guiqwt)")
        self.setWindowIcon(get_icon('guiqwt.svg'))

        hlayout = QHBoxLayout()
        central_widget = QWidget(self)
        central_widget.setLayout(hlayout)
        self.setCentralWidget(central_widget)
        #---guiqwt plot manager
        self.manager = PlotManager(self)
コード例 #6
0
ファイル: UI.py プロジェクト: wiegand429/tools
 def plot_init(self):
     self.manager = PlotManager(self)
     self.plots = []
     self.plot = CurvePlot(xlabel="", ylabel="")
     # self.plot.axisScaleDraw(CurvePlot.Y_LEFT).setMinimumExtent(10)
     self.manager.add_plot(self.plot)
     self.plots.append(self.plot)
     self.plot.plot_id = id(self.plot)
     self.curve = make.curve([0], [0], color="blue", title="gray value")
     self.plot.add_item(self.curve)
     self.plot.add_item(make.legend("TR"))
     self.ui_obj.line_info_display.addWidget(self.plot)
コード例 #7
0
    def _setup_plot(self):
        self.pm = PlotManager(self)
        self.pm.add_plot(self.plot)

        t = self.pm.add_tool(RtSelectionTool)
        t.activate()
        self.pm.set_default_tool(t)

        self._setup_cursor()
        self._setup_range_selector()
        self._setup_label()
        self._setup_axes()
コード例 #8
0
ファイル: GuiqwtScreen.py プロジェクト: adareau/pyfit-gui
    def __init__(self, parent=None, x=[], y=[], data=[]):
        QWidget.__init__(self, parent)

        if len(x) < 2:
            x = np.linspace(0, 1392, 1392)
            y = np.linspace(0, 1040, 1040)
            data = np.zeros((1040, 1392))

        self.x = x
        self.y = y
        self.data = data

        sx = 600
        sy = int(sx / 1.338)
        stretch_x = 3
        stretch_y = 3

        #self.setGeometry(QRect(0,0,sx,sy))
        layout = QGridLayout(self)
        layout.setMargin(0)

        self.screen = ImageScreen(self, x, y, data)
        self.cutX = CutScreen(self)
        self.cutY = CutScreen(self)

        layout.addWidget(self.screen, 1, 0)
        layout.addWidget(self.cutX, 0, 0)
        layout.addWidget(self.cutY, 1, 1)

        layout.setColumnStretch(0, stretch_x)
        layout.setColumnStretch(1, 1)
        layout.setRowStretch(0, 1)
        layout.setRowStretch(1, stretch_y)

        self.setLayout(layout)

        self.updateGeometry()

        self.manager = PlotManager(self)
        self.manager.add_plot(self.screen.plot)
        self.manager.add_plot(self.cutX.plot)
        self.manager.add_plot(self.cutY.plot)

        #roi = ROISelectTool
        #bkgnd = BKGNDSelectTool

        self.tools = [tools.SelectTool, tools.RectZoomTool, tools.ColormapTool]

        self.manager.register_all_curve_tools()
コード例 #9
0
ファイル: PlottingWidgets.py プロジェクト: swagatam11/emzed
    def __init__(self, c_callback=None):
        super(MzPlotter, self).__init__("m/z", "I")

        self.c_callback = c_callback

        widget = self.widget

        # inject mofified behaviour of wigets plot attribute:
        widget.plot.__class__ = MzPlot
        widget.plot.register_c_callback(self.handle_c_pressed)
        self.setHalfWindowWidth(0.05)
        self.centralMz = None

        # todo: refactor as helper
        a = QwtScaleDraw()
        label = lambda self, x : QwtText("%s" % x)
        a.label = new.instancemethod(label, widget.plot, QwtScaleDraw)
        widget.plot.setAxisScaleDraw(widget.plot.xBottom, a)

        self.pm = PlotManager(widget)
        self.pm.add_plot(widget.plot)
        self.curve = make.curve([], [], color='b', curvestyle="Sticks")
        # inject modified behaviour:
        self.curve.__class__ = ModifiedCurveItem

        self.widget.plot.add_item(self.curve)

        t = self.pm.add_tool(MzSelectionTool)
        self.pm.set_default_tool(t)
        t.activate()

        marker = Marker(label_cb=widget.plot.label_info,\
                        constraint_cb=widget.plot.on_plot)
        marker.attach(self.widget.plot)

        line   = make.segment(0, 0, 0, 0)
        line.__class__ = ModifiedSegment
        line.setVisible(0)

        setupCommonStyle(line, marker)

        label = make.info_label("TR", [MzCursorInfo(marker, line)], title=None)
        label.labelparam.label = ""

        self.marker = marker
        self.label = label
        self.line = line
コード例 #10
0
ファイル: 实时plot4.py プロジェクト: Nonikka/Quadcopter
 def __init__(self):
     super(SyncXAxis, self).__init__()
     
     self.data = {u"t":array("d")} 
     for name in sum(PLOT_DEFINE, []): 
         self.data[name] = array("d") 
     
     self.i = 0
     self.x = []
     self.curves = {} 
     self.t = 0
     self.sint = []
     self.get_Roll = []
     self.get_Pitch = []
     self.get_Yaw = []
     self.get_Angle1 = []
     self.get_Angle2 =[]
     self.get_Angle3 = []
     vbox = QtGui.QGridLayout()
     #工具栏
     vbox.addLayout(self.setup_toolbar(),0,0) 
     self.manager = PlotManager(self)
     self.plots = []
     #生成竖直排列图形窗口
     for i, define in enumerate(PLOT_DEFINE): 
         plot = CurvePlot() 
         plot.axisScaleDraw(CurvePlot.Y_LEFT).setMinimumExtent(60) 
         self.manager.add_plot(plot) 
         self.plots.append(plot) 
         plot.plot_id = id(plot) 
         for j, curve_name in enumerate(define): 
             curve = self.curves[curve_name] = make.curve([0], [0], color=COLORS[j], title=curve_name) 
             plot.add_item(curve) 
         plot.add_item(make.legend("BL")) 
         #vbox.addWidget(plot)
     vbox.addWidget(self.plots[0],1,0)
     vbox.addWidget(self.plots[1],1,1)
     vbox.addWidget(self.plots[2],2,0)
     vbox.addWidget(self.plots[3],2,1)
     
     self.manager.register_standard_tools()
     self.manager.get_default_tool().activate()
     self.manager.synchronize_axis(CurvePlot.X_BOTTOM, self.manager.plots.keys()) 
     self.setLayout(vbox)
     
     self.startTimer(20) 
コード例 #11
0
    def __init__(self, parent=None):
        super(MzPlottingWidget, self).__init__(parent, xlabel="mz", ylabel="I")

        patch_inner_plot_object(self, MzPlot)
        self.plot.centralMz = None

        def label(self, x):
            # label with full precision:
            return QwtText(str(x))

        a = QwtScaleDraw()
        a.label = new.instancemethod(label, self.plot, QwtScaleDraw)
        self.plot.setAxisScaleDraw(self.plot.xBottom, a)

        self.pm = PlotManager(self)
        self.pm.add_plot(self.plot)
        self.curve = make_unselectable_curve([], [],
                                             color="b",
                                             curvestyle="Sticks")

        self.plot.add_item(self.curve)

        t = self.pm.add_tool(MzSelectionTool)
        self.pm.set_default_tool(t)
        t.activate()

        marker = Marker(label_cb=self.plot.label_info,
                        constraint_cb=self.plot.on_plot)
        marker.attach(self.plot)

        line = make_measurement_line()
        line.setVisible(0)

        setupCommonStyle(line, marker)
        line.shapeparam.line.color = "#555555"
        line.shapeparam.update_shape(line)

        label = make.info_label("TR", [MzCursorInfo(marker, line)], title=None)
        label.labelparam.label = ""
        label.labelparam.font.size = 12
        label.labelparam.update_label(label)

        self.marker = marker
        self.label = label
        self.line = line
コード例 #12
0
    def __init__(self, parent=None, x=[], y=[], data=[]):
        QWidget.__init__(self, parent)

        if len(x) < 2:
            x = np.linspace(0, 1392, 1392)
            y = np.linspace(0, 1040, 1040)
            data = np.zeros((1040, 1392))

        self.x = x
        self.y = y
        self.data = data

        layout = QGridLayout(self)
        '''
        self.screen = ImageScreen(self,x,y,data,int(self.sizex*5.0/6.0),int(self.sizey*5.0/6.0))       
        self.cutX = CutScreen(self,sizex=int(self.sizex*5.0/6.0),sizey=int(self.sizey*1.0/6.0))       
        self.cutY = CutScreen(self,sizex=int(self.sizex*1.0/6.0),sizey=int(self.sizey*5.0/6.0))
        '''

        sx = 500
        sy = int(sx / 1.338)
        a = 0.2

        self.screen = ImageScreen(self, x, y, data, sizex=sx, sizey=sy)
        self.cutX = CutScreen(self, sizex=sx, sizey=int(a * sy))
        self.cutY = CutScreen(self, sizex=int(a * sx), sizey=sy)

        layout.addWidget(self.screen, 1, 0)
        layout.addWidget(self.cutX, 0, 0)
        layout.addWidget(self.cutY, 1, 1)

        self.setLayout(layout)

        self.updateGeometry()

        self.manager = PlotManager(self)
        self.manager.add_plot(self.screen.plot)
        self.manager.add_plot(self.cutX.plot)
        self.manager.add_plot(self.cutY.plot)

        roi = RegionSelectTool
        self.tools = [
            tools.SelectTool, tools.RectZoomTool, roi, tools.ColormapTool
        ]
        self.manager.register_all_curve_tools()
コード例 #13
0
 def __init__(self):
     qg.QMainWindow.__init__(self)
     self.setWindowTitle("Neuron Database")
     self.setWindowIcon(get_icon('guiqwt.png'))
     self.setAttribute(qc.Qt.WA_DeleteOnClose,True)
     
     hlayout = qg.QHBoxLayout()
     central_widget = qg.QWidget(self)
     central_widget.setLayout(hlayout)
     self.setCentralWidget(central_widget)
     #---guiqwt plot manager
     self.manager = PlotManager(self)
     #---
     self.add_plot("1")
     
     self._constructFileMenu()
     self._constructEditMenu()
     self._constructConsoleWidget(central_widget)
コード例 #14
0
ファイル: histogram.py プロジェクト: zgpglee/guiqwt
    def __init__(self, parent=None):
        super(ContrastAdjustment, self).__init__(parent)

        self.local_manager = None  # local manager for the histogram plot
        self.manager = None  # manager for the associated image plot

        # Storing min/max markers for each active image
        self.min_markers = {}
        self.max_markers = {}

        # Select point tools
        self.min_select_tool = None
        self.max_select_tool = None

        style = "<span style='color: #444444'><b>%s</b></span>"
        layout, _label = get_image_layout(self.PANEL_ICON,
                                          style % self.PANEL_TITLE,
                                          alignment=Qt.AlignCenter)
        layout.setAlignment(Qt.AlignCenter)
        vlayout = QVBoxLayout()
        vlayout.addLayout(layout)
        self.local_manager = PlotManager(self)
        self.histogram = LevelsHistogram(parent)
        vlayout.addWidget(self.histogram)
        self.local_manager.add_plot(self.histogram)
        hlayout = QHBoxLayout()
        self.setLayout(hlayout)
        hlayout.addLayout(vlayout)

        self.toolbar = toolbar = QToolBar(self)
        toolbar.setOrientation(Qt.Vertical)
        #        toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        hlayout.addWidget(toolbar)

        # Add standard plot-related tools to the local manager
        lman = self.local_manager
        lman.add_tool(SelectTool)
        lman.add_tool(BasePlotMenuTool, "item")
        lman.add_tool(BasePlotMenuTool, "axes")
        lman.add_tool(BasePlotMenuTool, "grid")
        lman.add_tool(AntiAliasingTool)
        lman.get_default_tool().activate()

        self.outliers_param = EliminateOutliersParam(self.PANEL_TITLE)
コード例 #15
0
    def create_plot(self, options):
        manager = PlotManager(None)
        self.plotwidget = CurveWidget(self, manager=manager, **options)
        manager.set_main(self.plotwidget)
        plot1 = CurvePlot(title="TL")
        plot2 = CurvePlot(title="TR")
        plot3 = CurvePlot(title="BL")
        plot4 = CurvePlot(title="BR")
        self.plotwidget.add_plot(plot1, 0, 0, "1")
        self.plotwidget.add_plot(plot2, 0, 1, "2")
        self.plotwidget.add_plot(plot3, 1, 0, "3")
        self.plotwidget.add_plot(plot4, 1, 1, "4")
        self.plotwidget.finalize()
        manager.synchronize_axis(BasePlot.X_BOTTOM, ["1", "3"])
        manager.synchronize_axis(BasePlot.X_BOTTOM, ["2", "4"])
        manager.synchronize_axis(BasePlot.Y_LEFT, ["1", "2"])
        manager.synchronize_axis(BasePlot.Y_LEFT, ["3", "4"])

        self.layout.addWidget(self.plotwidget, 0, 0)
コード例 #16
0
ファイル: cross_section.py プロジェクト: CARIBOuSystem/guiqwt
    def __init__(self, parent=None):
        super(CrossSectionWidget, self).__init__(parent)

        self.export_ac = None
        self.autoscale_ac = None
        self.refresh_ac = None
        self.autorefresh_ac = None

        self.manager = None  # manager for the associated image plot

        self.local_manager = PlotManager(self)
        self.cs_plot = self.CrossSectionPlotKlass(parent)
        self.cs_plot.SIG_CS_CURVE_CHANGED.connect(self.cs_curve_has_changed)
        self.export_tool = None
        self.setup_plot()

        self.toolbar = QToolBar(self)
        self.toolbar.setOrientation(Qt.Vertical)

        self.setup_widget()
コード例 #17
0
ファイル: manager.py プロジェクト: zgpglee/guiqwt
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        layout = QGridLayout()
        self.setLayout(layout)

        self.plot1 = ImagePlot(self)
        layout.addWidget(self.plot1, 0, 0, 1, 1)
        self.plot2 = ImagePlot(self)
        layout.addWidget(self.plot2, 1, 0, 1, 1)

        self.contrast = ContrastAdjustment(self)
        layout.addWidget(self.contrast, 2, 0, 1, 2)
        self.itemlist = PlotItemList(self)
        layout.addWidget(self.itemlist, 0, 1, 2, 1)

        self.manager = PlotManager(self)
        for plot in (self.plot1, self.plot2):
            self.manager.add_plot(plot)
        for panel in (self.itemlist, self.contrast):
            self.manager.add_panel(panel)
コード例 #18
0
ファイル: Car_Helper.py プロジェクト: Alsvr/SMART
def Plot_Start_New(widget,PLOT_DEFINE,COLORS,x1,x2,y1,y2):
    newmanager = PlotManager(widget)
    newplots = []
    newcurves = {}
    for name in PLOT_DEFINE:
            plot = CurvePlot()
            #设置图表颜色
            plot.setStyleSheet('''QWidget{   
                                                                border: 1px solid #32435E;   
                                                                border-radius: 3px;   
                                                                font-size:11pt;   
                                                                color:white;   
                                                                font-family:"Microsoft YaHei UI";  
                                                                /* padding: 0 8px; */  
                                                                background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,   
                                                                                             stop: 0 #080B10,   
                                                                                             stop: 1.0 #212C3F);   
                                                                selection-background-color: #0A246A;   
                                                            } '''  
                                         )
            plot.axisScaleDraw(CurvePlot.Y_LEFT).setMinimumExtent(20)
            newplots.append(plot)
            newmanager.add_plot(plot)
            plot.plot_id = id(plot)
            for curve_color, curve_name in map(None,COLORS,name):
                if  u"状态" in curve_name or  u"打角/100" in curve_name :
                    newcurves[curve_name] = guiqwt_make.curve([0], [0],markerfacecolor = 'black', markeredgecolor=curve_color, title=curve_name,marker = 'Diamond',linestyle = 'NoPen',markersize = 6)
                else:    
                    newcurves[curve_name] = guiqwt_make.curve([0], [0], color=curve_color, title=curve_name)
                
                plot.add_item(newcurves[curve_name])
            #设置X轴y轴
            plot.set_axis_limits(newcurves[curve_name].yAxis(),y1,y2)
            plot.set_axis_limits(newcurves[curve_name].xAxis(),x1,x2)
            plot.add_item(guiqwt_make.legend("BL"))
            
    
    newmanager.register_standard_tools()
    newmanager.get_default_tool().activate()
    return (newmanager,newplots,newcurves)
コード例 #19
0
ファイル: PlottingWidgets.py プロジェクト: swagatam11/emzed
    def __init__(self, rangeSelectionCallback = None):
        super(RtPlotter, self).__init__("RT", "I")

        self.rangeSelectionCallback = rangeSelectionCallback

        widget = self.widget
        widget.plot.__class__ = RtPlot

        # todo: refactor as helper
        a = QwtScaleDraw()
        # render tic labels in modfied format:
        label = lambda self, v: QwtText(formatSeconds(v))
        a.label = new.instancemethod(label, widget.plot, QwtScaleDraw)
        widget.plot.setAxisScaleDraw(widget.plot.xBottom, a)

        #a.label = new.instancemethod(label, widget.plot, QwtScaleDraw)

        self.pm = PlotManager(widget)
        self.pm.add_plot(widget.plot)

        t = self.pm.add_tool(RtSelectionTool)
        self.addTool(RtSelectionTool)
        self.pm.set_default_tool(t)

        marker = Marker(label_cb=self.widget.plot.label_info,\
                        constraint_cb=self.widget.plot.on_plot)
        marker.rts = [0]
        setupStyleRtMarker(marker)
        marker.attach(self.widget.plot)
        self.marker = marker

        label = make.info_label("T", [RtCursorInfo(marker)], title=None)
        label.labelparam.label = ""
        self.label=label

        self.minRTRangeSelected = None
        self.maxRTRangeSelected = None
コード例 #20
0
ファイル: realtimeGUIqwt.py プロジェクト: hihiy/danpianjiusb
    def __init__(self):
        super(RealtimeDemo, self).__init__()
        self.setWindowTitle(u"Realtime Demo")

        self.data = {u"t":array("d")}
        # for name in sum(PLOT_DEFINE, []):
        #     self.data[name] = array("d")
        for name in PLOT_DEFINE:
            self.data[name] = array("d")

        self.curves = {}
        self.t = 0
        vbox = QVBoxLayout()
        vbox.addWidget(self.setup_toolbar())

        grid = QGridLayout()
        vbox.addLayout(grid)

        self.manager = PlotManager(self)
        self.plots = []

        # for i, define in enumerate(PLOT_DEFINE):
        #     plot = CurvePlot()
        #     plot.axisScaleDraw(CurvePlot.Y_LEFT).setMinimumExtent(60)
        #     self.manager.add_plot(plot)
        #     self.plots.append(plot)
        #     plot.plot_id = id(plot)
        #     for j, curve_name in enumerate(define):
        #         curve = self.curves[curve_name] = make.curve([0], [0], color=COLORS[j], title=curve_name)
        #         plot.add_item(curve)
        #     plot.add_item(make.legend("BL"))
        #     vbox.addWidget(plot)
        # self.manager.register_standard_tools()
        # self.manager.get_default_tool().activate()
        # self.manager.synchronize_axis(CurvePlot.X_BOTTOM, self.manager.plots.keys())
        # self.setLayout(vbox)
        # self.startTimer(100)

        # buttton_names = ['Cls', 'Bck', '', 'Close',
        #                  '7', '8', '9', '/',
        #                  '4', '5', '6', '*',
        #                  '1', '2', '3', '-',
        #                  '0', '.', '=', '+']
        # main_ground = QtWidgets.QWidget()
        # self.setCentralWidget(main_ground)
        # grid = QtWidgets.QGridLayout()
        #
        for [n, (x, y)] in enumerate([(i, j) for i in range(4) for j in range(4)]):
            plot = CurvePlot()
            plot.axisScaleDraw(CurvePlot.Y_LEFT).setMinimumExtent(60)
            self.manager.add_plot(plot)
            self.plots.append(plot)
            plot.plot_id = id(plot)
            curve = self.curves[PLOT_DEFINE[n]] = make.curve([0], [0], color=COLORS[0], title=PLOT_DEFINE[n])
            plot.add_item(curve)
            plot.add_item(make.legend("BL"))
            grid.addWidget(plot, x, y)
        self.manager.register_standard_tools()
        self.manager.get_default_tool().activate()
        self.manager.synchronize_axis(CurvePlot.X_BOTTOM, self.manager.plots.keys())
        self.setLayout(vbox)
        self.startTimer(100)
コード例 #21
0
ファイル: Car_Helper.py プロジェクト: Alsvr/SMART
    def __init__(self,parent=None):
    
        QtGui.QMainWindow.__init__(self, parent)
        self.setupUi(self) # Ui_Form.setupUi
        '''
        #最小化&关闭
        self.minibutton = QtGui.QToolButton(self)
        self.minibutton.setGeometry(self.width()-45,5,20,20)
        self.closebutton = QtGui.QToolButton(self)
        self.closebutton.setGeometry(self.width()-25,5,20,20)
        '''

        #加入设置窗口
        #setting_ui  = UI_Settings()
        #self.setting = QtGui.QWidget()
        #setting_ui.setupUi(self.setting)
        
        #新建窗口
        self.ShowData = []
        self.SD_data = []
        #打开的窗体
        self.open_widget = []
        #显示文件的路径
        self.ShowDataFileName = []
        #设置lineedit
        self.lineEdit.selectAll()
        self.lineEdit.setFocus()
        #curves曲线 名字:曲线
        self.curves = {}
        #图像管理器
        self.manager = PlotManager(self)
        #data 数据 double型 t
        self.data = {u"t":array("d")}
        for name in sum(PLOT_DEFINE, []):
            self.data[name] = array("d")
        self.data['tn'] = 0
        self.data['xmax'] = 0
        self.data['xmin']  = 0
        self.progressbar = []
        
        #车辆设置数据
        
        self.data['angle_p'] =  0
        self.data['angle_i'] = 0
        self.data['angle_d'] = 0
        self.data['speed_up_p'] = 0
        self.data['speed_up_i'] = 0
        self.data['speed_up_d'] = 0
        self.data['speed_curve'] = 0
        self.data['speed_straight'] = 0
        self.data['k_ccd'] = 0
        self.data['k_different'] = 0
        self.data['light_time'] = 0
        self.data['different_len'] = 0
        self.data['different_size'] = 0
        #主图表
        self.plots = []
        #副图标
        self.plots_extra = []
        #图表设置
        (self.manager,self.plots,self.curves) = Plot_Start_New(self,PLOT_DEFINE,COLORS,0,5,-5,200)
        for plot in self.plots:
            self.left_layout1.addWidget(plot)
        #self.manager.synchronize_axis(CurvePlot.X_BOTTOM, self.manager.plots.keys())
        
        
        #添加设置窗口
        self.setting_widget = setting_widget(self)
        self.open_widget.append(self.setting_widget)
        #连接 
        self.connect(self.pushButton_collect, QtCore.SIGNAL("clicked()"), self.AddingData_Start)
        self.connect(self.action_open,QtCore.SIGNAL("triggered()"),self.OpenFile)
        self.connect(self.action_save,QtCore.SIGNAL("triggered()"),self.SaveFile)
        self.connect(self.lineEdit,QtCore.SIGNAL("returnPressed()"),lambda:self.Line2Brower(self.lineEdit))
        #self.connect(self.lineEdit_2,QtCore.SIGNAL("returnPressed()"),lambda:self.Line2Brower(self.lineEdit_2))
        self.connect(self.checkBox_x, QtCore.SIGNAL("clicked()"), self.Flx)
        self.connect(self.checkBox_y, QtCore.SIGNAL("clicked()"), self.Auto)
        #self.connect(self.pushButton_car_setting,QtCore.SIGNAL("clicked()"),self.Settings)
        self.connect(self.pushButton_com,QtCore.SIGNAL("clicked()"), self.ReScanUart)
        self.connect(self.about_qt,QtCore.SIGNAL("triggered()"), lambda:QtGui.QMessageBox.aboutQt(self))
        self.connect(self.action_car,QtCore.SIGNAL("triggered()"),self.setting_widget.show)
        self.connect(self.pushButton_cleandata, QtCore.SIGNAL("clicked()"),self.CleanData)
        #self.connect(self.pushButton_run,QtCore.SIGNAL("clicked()"),self.CarStartRun)
#------------------------------------------------------小车设置连接----------------------------------------------------------------------------
    #    self.connect(self.setting_widget.pushButton_Stop, QtCore.SIGNAL("clicked()"),lambda :self.SetAngleP(20))
        self.connect(self.setting_widget.pushButton_Stop, QtCore.SIGNAL("clicked()"),self.CarStopRun)
        self.connect(self.setting_widget.apply, QtCore.SIGNAL("clicked()"),self.SettingApply)
        self.connect(self.setting_widget.pushButton_Start, QtCore.SIGNAL("clicked()"),self.CarStartRun)       
        #进度条
        msgBox = QtGui.QMessageBox(QtGui.QMessageBox.Warning, "", "", QtGui.QMessageBox.NoButton,parent = self )
        msgBox.setStandardButtons( QtGui.QMessageBox.NoButton )
        l = msgBox.layout()
        self.progressbar.append(msgBox)
        l.itemAtPosition( l.rowCount() - 1, 0 ).widget().hide()
        progress = QtGui.QProgressBar()
        self.progressbar.append(progress)
        progress.setValue(0)
        l.addWidget(progress,l.rowCount(), 0, 1, l.columnCount(), Qt.AlignCenter )
        
#--------------------------------------------------添加图像窗口-------------------------------------------------------------------------------
        self.ccd_realshow = []
        t = 0
        t_past = 0
        ccd_realshow = show_realdata_widget()
        
        data = {}
        
        data[u't'] = 0
        data[u't_past'] = 0
        temp_d = array('d')
        for i in range(128):
                temp_d.append(0)
                
        ccd_realshow.setWindowTitle(u"图像显示")
        ccd_realshow.setGeometry(200,200,400,400)
        
        for x in range(3):
            (memger,plots,curves) = Plot_Start_New(
                                                                                ccd_realshow,
                                                                                (
                                                                                     (u'CCD图像%d'%(x+1),
                                                                                      u'CCD图像%d左'%(x+1),
                                                                                      u'CCD图像%d中'%(x+1),
                                                                                      u'CCD图像%d右'%(x+1),
                                                                                     ),
                                                                                 ),
                                                                                ('white','red','green','blue'),0,128,0,255
                                                                              )

            temp_data = data.copy()
            temp_data[u'CCD图像%d'%(x+1)] = temp_d[:]
            temp_data[u'CCD图像%d左'%(x+1)] = temp_d[:]
            temp_data[u'CCD图像%d中'%(x+1)] = temp_d[:]
            temp_data[u'CCD图像%d右'%(x+1)] = temp_d[:]
            
            self.ccd_realshow.append([u'CCD图像%d'%(x+1),ccd_realshow,plots,curves,temp_data])
            for plot in plots: 
                ccd_realshow.gridLayout.addWidget(plot)
                
        for x in self.ccd_realshow:
            for y in x[2]:     
                y.hide()
                
        
        ccd_realshow.checkBox_ccd1.setChecked(0)
        ccd_realshow.checkBox_ccd2.setChecked(0)
        ccd_realshow.checkBox_ccd3.setChecked(0)
        self.connect(ccd_realshow.checkBox_ccd1, QtCore.SIGNAL("stateChanged(int)"),lambda x: self.Ccd_Realshow_Setting(0,x))
        self.connect(ccd_realshow.checkBox_ccd2, QtCore.SIGNAL("stateChanged(int)"),lambda x: self.Ccd_Realshow_Setting(1,x))
        self.connect(ccd_realshow.checkBox_ccd3, QtCore.SIGNAL("stateChanged(int)"),lambda x: self.Ccd_Realshow_Setting(2,x))
        self.connect(self.setting_widget.checkBox_ccd1,QtCore.SIGNAL("stateChanged(int)"),ccd_realshow.checkBox_ccd1.setChecked)
        self.connect(self.setting_widget.checkBox_ccd2,QtCore.SIGNAL("stateChanged(int)"),ccd_realshow.checkBox_ccd2.setChecked)
        self.connect(self.setting_widget.checkBox_ccd3,QtCore.SIGNAL("stateChanged(int)"),ccd_realshow.checkBox_ccd3.setChecked)
        self.connect(ccd_realshow.checkBox_ccd1,QtCore.SIGNAL("stateChanged(int)"),self.setting_widget.checkBox_ccd1.setChecked)
        self.connect(ccd_realshow.checkBox_ccd2,QtCore.SIGNAL("stateChanged(int)"),self.setting_widget.checkBox_ccd2.setChecked)
        self.connect(ccd_realshow.checkBox_ccd3,QtCore.SIGNAL("stateChanged(int)"),self.setting_widget.checkBox_ccd3.setChecked)
        self.connect(self.setting_widget.checkBox_ccd3,QtCore.SIGNAL("stateChanged(int)"),ccd_realshow.checkBox_ccd3.setChecked)
        self.connect(self.setting_widget.pushButton_real_data_Show,QtCore.SIGNAL("clicked()"),ccd_realshow.show)
        self.connect(ccd_realshow.pushButton_single, QtCore.SIGNAL("clicked()"),self.SdRunSingle)
        self.connect(ccd_realshow.pushButton_back, QtCore.SIGNAL("clicked()"),self.SdRunSingleBack)
#--------------------------------------------------添加图像窗口-------------------------------------------------------------------------------
        self.connect(self.action_sd_open,QtCore.SIGNAL("triggered()"),self.OpenSDFile)
        
        #定时显示
        self.startTimer(40)