Belle II Software development
CollectionsViewer Class Reference
Inheritance diagram for CollectionsViewer:
IPythonWidget

Public Member Functions

def __init__ (self, collections)
 
def create (self)
 

Public Attributes

 collections
 The collections to show.
 
 table_row_html
 Template for a table row.
 

Detailed Description

Viewer object for the store entries.
Do not use it on your own.

Definition at line 145 of file viewer.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  collections 
)
Create a new collections viewer with the collections object from the process.
Collections must be a StoreContentList with a list of StoreContents.

Definition at line 151 of file viewer.py.

151 def __init__(self, collections):
152 """
153 Create a new collections viewer with the collections object from the process.
154 Collections must be a StoreContentList with a list of StoreContents.
155 """
156
157 self.collections = collections
158
159
160 self.table_row_html = """<tr><td style="padding: 10px 0;">{content.name}</td>
161 <td style="padding: 10px 0;">{content.number}</td></tr>"""
162

Member Function Documentation

◆ create()

def create (   self)
Create the widget

Reimplemented from IPythonWidget.

Definition at line 163 of file viewer.py.

163 def create(self):
164 """
165 Create the widget
166 """
167
168 import ipywidgets as widgets
169
170 if self.collections is None:
171 return widgets.HTML("")
172
173 a = widgets.Tab()
174 children = []
175
176 for i, event in enumerate(self.collections):
177 html = widgets.HTML()
178 html.value = """<table style="border-collapse: separate; border-spacing: 50px 0;">"""
179 for store_content in event.content:
180 html.value += self.table_row_html.format(content=store_content)
181 html.value += "</table>"
182 children.append(html)
183 a.set_title(i, "Event " + str(event.event_number))
184
185 a.children = children
186
187 return a
188
189

Member Data Documentation

◆ collections

collections

The collections to show.

Definition at line 157 of file viewer.py.

◆ table_row_html

table_row_html

Template for a table row.

Definition at line 160 of file viewer.py.


The documentation for this class was generated from the following file: