コード例 #1
0
ファイル: monitor.py プロジェクト: tomriverman/flexx
    def init(self):
        self.start_time = time()

        self.status = flx.Label(text='...')
        self.cpu_plot = flx.PlotWidget(flex=1, style='width: 640px; height: 320px;',
                                       xdata=[], yrange=(0, 100),
                                       ylabel='CPU usage (%)')
        self.mem_plot = flx.PlotWidget(flex=1, style='width: 640px; height: 320px;',
                                       xdata=[], yrange=(0, 100),
                                       ylabel='Mem usage (%)')
コード例 #2
0
 def init(self):
     time = [i / 100 for i in range(100)]
     with flx.VBox():
         with flx.HBox():
             flx.Label(text='Frequency:')
             self.slider1 = flx.Slider(min=1, max=10, value=5, flex=1)
             flx.Label(text='Phase:')
             self.slider2 = flx.Slider(min=0, max=6, value=0, flex=1)
         self.plot = flx.PlotWidget(flex=1,
                                    xdata=time,
                                    xlabel='time',
                                    ylabel='amplitude',
                                    title='a sinusoid')
コード例 #3
0
    def init(self):
        self.nsamples = 200
        self.start_time = time()
        self.status = flx.Label(text='...')
        self.plot_num = 3
        self.plot = []
        self.plot_combobox = []
        self.plot_label = []
        self.plot_latest_val = []
        self.latest_params_names = {}
        self.latest_params_values = {}


        with flx.HSplit(flex=1):
            with flx.GroupWidget(flex=1, title="Plot options", minsize=(270,0)):  
                    with flx.VBox():
                        self.buttons = {}
                        button_list = list(SolarData.commands.keys())
                        for button_name in button_list:
                            with flx.HBox():    
                                self.buttons[button_name] = flx.Button(text=button_name)
                                setattr(self.buttons[button_name],'button_action', button_name)
                                self.buttons[button_name].reaction(self._on_button_pressed, 'pointer_click')
                                self.buttons[button_name].reaction(self._on_button_down, 'pointer_down')
                                self.buttons[button_name].reaction(self._on_button_up, 'pointer_up')
                                flx.Widget(flex=1)

                        for i in range(0, self.plot_num):
                            with flx.HBox():
                                self.plot_combobox[i] = flx.ComboBox(options=list(SolarData.params.keys()), editable=False, selected_index=i) 
                                self.plot_combobox[i].reaction(self.combobox_changed, 'user_selected')
                                self.plot_label[i] = flx.Label(text='Value:')
                                self.plot_latest_val[i] = flx.Label(text='')
                                flx.Widget(flex=1)

                        for i in range(0, len(SolarData.params.keys())):
                            with flx.HBox():
                                name = list(SolarData.params.keys())[i]
                                self.latest_params_names[name] = flx.Label(text='{0}:'.format(name))
                                self.latest_params_values[name] = flx.Label(text='NaN')
                                flx.Widget(flex=1)

                        flx.Widget(flex=1)

            with flx.VBox(flex=4):
                for i in range(0, self.plot_num):
                    self.plot[i] = flx.PlotWidget(flex=1, minsize=(270,0), style='width: 640px; height: 320px;',xdata=[], yrange=(0, 100),ylabel='Plot ' + str(i+1))
                    self.update_plot_range(i)
コード例 #4
0
ファイル: widgets.py プロジェクト: svbhat/flexxros
 def init(self,
          topic,
          topic_type,
          key="data",
          yrange=(0, 100),
          nsamples=100):
     self.key = key
     self.nsamples = nsamples
     self.start_time = time()
     self.plot = self.mem_plot = flx.PlotWidget(
         flex=1,
         style='width: 400px; height: 220px;',
         xdata=[],
         yrange=yrange,
         ylabel=topic + "/" + key,
         xlabel="Time")
     self.subscribe(topic, topic_type, self._callback)
コード例 #5
0
ファイル: twente.py プロジェクト: Ph0enixxx/flexx
    def init(self):

        with flx.HFix():
            flx.Widget(flex=1)
            with flx.VBox(flex=0, style='min-width:200px'):
                with flx.GroupWidget(title='Plot options'):
                    flx.Label(text='Month')
                    self.month = flx.ComboBox(options=months,
                                              selected_index=12,
                                              style='width: 100%')
                    self.smoothing_label = flx.Label(text='Smoothing')
                    self.smoothing = flx.Slider(max=20,
                                                step=2,
                                                text='{value} samples')
                flx.Widget(flex=3)
            with flx.VBox(flex=4):
                self.plot = flx.PlotWidget(flex=1,
                                           xdata=years,
                                           yrange=(-5, 20),
                                           title='Average monthly temperature',
                                           xlabel='year',
                                           ylabel=u'temperature (°C)')
            flx.Widget(flex=1)
コード例 #6
0
    def init(self, model):
        super().init()
        self.model = model

        times = [i / 20 for i in range(20)]
        with flx.VBox():
            with flx.HBox():
                with flx.VBox():
                    flx.Label(text='Settings',
                              style='text-align:center;font-weight: bold;')
                    with flx.HBox(flex=0):
                        with flx.VBox():
                            flx.Label(style="text-align:right", text='VIN:')
                            flx.Label(style="text-align:right",
                                      text='Controls Enabled:')
                            flx.Label(style="text-align:right", text='Time:')
                            flx.Label(style="text-align:right",
                                      text='ROS Vehicle Control Running:')
                            flx.Label(style="text-align:right",
                                      text='Recording:')
                            flx.Label(style="text-align:right",
                                      text='GPS Fix:')
                            flx.Label(style="text-align:right",
                                      text='Battery Voltage:')
                            flx.Label(style="text-align:right",
                                      text='Battery Capacity:')
                        with flx.VBox():
                            self.labelVin = flx.Label(style="text-align:left",
                                                      text=relay.vin)
                            self.labelControls = flx.Label(
                                style="text-align:left", text='False')
                            self.labelTime = flx.Label(style="text-align:left",
                                                       text='Not Set')
                            #self.labelTime = flx.Label(style="text-align:left",text=lambda: self.root.store.time)
                            self.labelVehicleControl = flx.Label(
                                style="text-align:left",
                                text=str(relay.vehicleControlRunning))
                            self.labelRecording = flx.Label(
                                style="text-align:left",
                                text=str(relay.pandaRecording))
                            self.labelGps = flx.Label(style="text-align:left",
                                                      text=str(relay.pandaGps))
                            self.labelVoltage = flx.Label(
                                style="text-align:left",
                                text=str(relay.voltage))
                            self.labelCapacity = flx.Label(
                                style="text-align:left",
                                text=str(relay.capacity))
                    with flx.VBox():
                        self.b1 = flx.Button(text='Start')
                        self.b2 = flx.Button(text='Stop')
            #	self.
                with flx.VBox():
                    flx.Label(text='Plot',
                              style='text-align:center;font-weight: bold;')
                    with flx.HBox():
                        flx.Label(text='Time:')
                        self.slider1 = flx.Slider(min=1,
                                                  max=10,
                                                  value=5,
                                                  flex=1)
                        flx.Label(text='Magnitude:')
                        self.slider2 = flx.Slider(min=0,
                                                  max=10,
                                                  value=0,
                                                  flex=1)
                    self.plot = flx.PlotWidget(flex=1,
                                               xdata=times,
                                               xlabel='time',
                                               ylabel='Acc',
                                               title='Profile')