def init(self): with ui.HBox(): with ui.VBox(): ui.Label(text='<h3>Server monitor</h3>') self.info = ui.Label(text='...') if app.current_server().serving[0] == 'localhost': # Don't do this for a public server self.button = ui.Button(text='Do some work') self.button.connect('mouse_down', self._do_work) self.cpu_plot = ui.PlotWidget( style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='CPU usage (%)', sync_props=False) self.mem_plot = ui.PlotWidget( style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='Mem usage (%)', sync_props=False) ui.Widget(flex=1) # Relay global info into this app relay.connect(self._push_info, 'system_info:' + self.id)
def init(self): self.start_time = time() self.status = ui.Label(text='...') self.cpu_plot = ui.PlotWidget(flex=1, style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='CPU usage (%)') self.mem_plot = ui.PlotWidget(flex=1, style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='Mem usage (%)')
def init(self): with ui.HBox(): with ui.VBox(): ui.Label(text='<h3>Server monitor</h3>') self.info = ui.Label(text='...') if os.getenv('FLEXX_HOSTNAME', 'localhost') == 'localhost': self.button = ui.Button(text='Do some work') self.cpu_plot = ui.PlotWidget(style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='CPU usage (%)') self.mem_plot = ui.PlotWidget(style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='Mem usage (%)') ui.Widget(flex=1)
def init(self): with ui.HBox(): with ui.VBox(): ui.Label(text='<h3>Server monitor</h3>') self.info = ui.Label(text='...') self.button = ui.Button(text='Do some work') self.plot = ui.PlotWidget(size=(640, 480), xdata=[], yrange=(0, 100), ylabel='CPU usage (%)') ui.Widget(flex=1)
def init(self): with ui.HFix(): ui.Widget(flex=1) with ui.VBox(flex=0, style='min-width:200px'): with ui.GroupWidget(title='Plot options'): ui.Label(text='Month') self.month = ui.ComboBox(options=months, selected_index=12, style='width: 100%') self.smoothing_label = ui.Label(text='Smoothing') self.smoothing = ui.Slider(max=20, step=2, text='{value} samples') ui.Widget(flex=3) with ui.VBox(flex=4): self.plot = ui.PlotWidget(flex=1, xdata=years, yrange=(-5, 20), title='Average monthly temperature', xlabel='year', ylabel=u'temperature (°C)') ui.Widget(flex=1)
def init(self): with ui.HBox(): ui.Widget(flex=1) with ui.VBox(flex=0): with ui.GroupWidget(title='Plot options'): with ui.VBox(): self.month_label = ui.Label(text='Month') self.month = ui.Slider(max=12, step=1) self.smoothing_label = ui.Label(text='Smoothing') self.smoothing = ui.Slider(max=20, step=2) ui.Widget(flex=1) with ui.VBox(flex=4): self.plot = ui.PlotWidget(flex=1, xdata=years, yrange=(-5, 20), title='Average monthly temperature', xlabel='year', ylabel=u'temperature (°C)') ui.Widget(flex=0, style='height:30px') ui.Widget(flex=1)