4545
4646def _notebook_print_banner ():
4747 from ipywidgets import Image
48- from IPython .display import display
48+ from IPython .display import display , HTML
4949
5050 logo_path = Path (__file__ ).parent .parent .joinpath (
5151 "assets" , "fastplotlib_face_logo.png"
@@ -54,40 +54,69 @@ def _notebook_print_banner():
5454 with open (logo_path , "rb" ) as f :
5555 logo_data = f .read ()
5656
57+ # get small logo image
5758 image = Image (value = logo_data , format = "png" , width = 300 , height = 55 )
5859
59- display (image )
60-
61- # print logo and adapter info
60+ # get adapters and info
6261 adapters = [a for a in wgpu .gpu .enumerate_adapters ()]
6362 adapters_info = [a .info for a in adapters ]
6463
6564 default_adapter_info = wgpu .gpu .request_adapter ().info
6665 default_ix = adapters_info .index (default_adapter_info )
6766
68- if len (adapters ) > 0 :
69- print ("Available devices:" )
67+ if len (adapters ) < 1 :
68+ return
69+
70+ # start HTML table
71+ table_str = (
72+ "<b>Available devices:</b>"
73+ "<table>"
74+ "<tr>"
75+ "<th>Valid</th>"
76+ "<th>Device</th>"
77+ "<th>Type</th>"
78+ "<th>Backend</th>"
79+ "<th>Driver</th>"
80+ "</tr>"
81+ )
7082
83+ # parse each adapter that WGPU found
7184 for ix , adapter in enumerate (adapters_info ):
7285 atype = adapter ["adapter_type" ]
7386 backend = adapter ["backend_type" ]
7487 driver = adapter ["description" ]
7588 device = adapter ["device" ]
7689
77- if atype == "DiscreteGPU" and backend != "OpenGL" :
78- charactor = chr (0x2705 )
79- elif atype == "IntegratedGPU" and backend != "OpenGL" :
80- charactor = chr (0x0001FBC4 )
90+ if atype in ("DiscreteGPU" , "IntegratedGPU" ) and backend != "OpenGL" :
91+ charactor = chr (0x2705 ) # green checkmark
92+ tooltip = "This adapter can be used with fastplotlib"
93+ elif backend == "OpenGL" :
94+ charactor = chr (0x0000274C ) # red x
95+ tooltip = "This adapter cannot be used with fastplotlib"
96+ elif device .startswith ("llvmpipe" ) or atype == "CPU" :
97+ charactor = f"{ chr (0x00002757 )} limited" # red !
98+ tooltip = "CPU rendering support is limited and mainly for testing purposes"
8199 else :
82- charactor = chr (0x2757 )
100+ charactor = f"{ chr (0x00002757 )} unknown" # red !
101+ tooltip = "Unknown adapter type and backend"
83102
84103 if ix == default_ix :
85104 default = " (default) "
86105 else :
87- default = " "
106+ default = ""
88107
89- output_str = f"{ charactor } { default } | { device } | { atype } | { backend } | { driver } "
90- print (output_str )
108+ # add row to HTML table
109+ table_str += f'<tr title="{ tooltip } ">'
110+ # add each element to this row
111+ for s in [f"{ charactor } { default } " , device , atype , backend , driver ]:
112+ table_str += f"<td>{ s } </td>"
113+ table_str += "</tr>"
114+
115+ table_str += "</table>"
116+
117+ # display logo and adapters table
118+ display (image )
119+ display (HTML (table_str ))
91120
92121
93122if GUI_BACKEND == "jupyter" :
0 commit comments