Closed ffrmns closed 2 years ago
I've never tried to run bokehgui on a mobile so it's new territory.
Could you link the example you used successfully?
I used the code from examples/howto/server_embed/standalone_embed.py
https://github.com/bokeh/bokeh/blob/branch-2.4/examples/howto/server_embed/standalone_embed.py
Here is the code I use for utils.py
# Copyright 2017 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
import os
import subprocess
import bokeh.palettes as bp
import bokeh.application as ba
import bokeh.application.handlers as bh
from bokeh.server.server import Server
import bokehgui
from bokeh.themes import Theme
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, Slider
from bokeh.plotting import figure
from bokeh.sampledata.sea_surface_temperature import sea_surface_temperature
def default_tools():
return ['box_zoom', 'ypan', 'ywheel_zoom', 'save', 'reset']
default_labels_f = ["Data {0}".format(i) for i in range(10)]
default_labels_c = ["Re{{Data {0}}}".format(i // 2) if i % 2 == 0
else "Im{{Data {0}}}".format(i // 2) for i in range(10)]
def run_server(tb, sizing_mode="fixed", widget_placement=(0,0), window_size=(200,200)):
port = subprocess.check_output([os.path.abspath(
os.path.dirname(__file__)) + "/scripts/check-port.sh"])
def make_doc(doc):
doc.title = tb.name()
plot_list = []
# widget_list = []
for i in tb.plot_lst:
i.initialize(doc, plot_list)
list_obj = plot_list
layout_t = bokehgui.bokeh_layout.create_layout(list_obj, sizing_mode, window_size)
df = sea_surface_temperature.copy()
source = ColumnDataSource(data=df)
plot = figure(x_axis_type='datetime', y_range=(0, 25), y_axis_label='Temperature (Celsius)',
title="Sea Surface Temperature at 43.18, -70.43")
plot.line('time', 'temperature', source=source)
def callback(attr, old, new):
if new == 0:
data = df
else:
data = df.rolling(f"{new}D").mean()
source.data = ColumnDataSource.from_df(data)
slider = Slider(start=0, end=30, value=0, step=1, title="Smoothing by N Days")
slider.on_change('value', callback)
doc.add_root(column(slider, plot))
doc.add_root(column(slider,layout_t))
doc.theme = Theme(filename="/home/ffa/Unduhan/theme.yaml")
handler = bh.FunctionHandler(make_doc)
app = ba.Application(handler)
server = Server(app,allow_websocket_origin=['*'])
server.run_until_shutdown()
return #server_proc, str(int(port))
PALETTES = {
'Inferno':bp.all_palettes['Inferno'][256],
'Magma' :bp.all_palettes['Magma'][256],
'Plasma' :bp.all_palettes['Plasma'][256],
'Viridis':bp.all_palettes['Viridis'][256],
'Greys' :bp.all_palettes['Greys'][256]
}
It's indeed strange that you could see the temperature plot, and not the plots inside plot_list
.
Especially since the frequency sink is the same type of bokeh plot.
Could the duplicate doc.add_root
cause an issue there? Maybe only the first one is taken into account?
Maybe it's the type of layout used by bokehgui that the mobile browser doesn't like. Do the other types of bokehgui plots work on mobile?
Sorry I'm not able to test things on my side at the moment.
I've repaired my bokehgui installation and I quickly tried the test_bokehgui example on mobile. (On the main-3.8 branch, not the one supporting bokeh 2.0). And the default example works on my phone, it's glitchy and sometimes fails but it works. But including sinks other than the time plot makes my phone unable to connect to the server, like you describe. (the widgets don't seem to cause problems)
It's very mysterious, I'm not sure I can help you debug this, but at least I could reproduce your issue.
Trying with another phone,
It's work with another phone.
I run my simple bokehgui frequency sink without widget. It appears on desktop web client but failed to appear on mobile web client. I have added
allow_websocket_origin=['*']
toServer
inbokehgui/utils.py
.I have tried to modify
bokehgui/utils.py
by added an example from bokeh repository inmake_doc(doc)
function, and it can appears on mobile web cilent.So what can I do to make bokehgui frequency sink appears on mobile web client?
Thanks in advance.