MCPcopy Index your code
hub / github.com/CaliDog/certstream-python / __init__

Method __init__

examples/gui.py:315–403  ·  view source on GitHub ↗

Draw a line around original_widget. Use 'title' to set an initial title text with will be centered on top of the box. Use `title_align` to align the title to the 'left', 'right', or 'center'. The default is 'center'. You can also override the widgets

(self, original_widget, title="", title_align="center",
                 tlcorner='┌', tline='─', lline='│',
                 trcorner='┐', blcorner='└', rline='│',
                 bline='─', brcorner='┘')

Source from the content-addressed store, hash-verified

313class SidelessLineBox(WidgetDecoration, WidgetWrap):
314
315 def __init__(self, original_widget, title="", title_align="center",
316 tlcorner='┌', tline='─', lline='│',
317 trcorner='┐', blcorner='└', rline='│',
318 bline='─', brcorner='┘'):
319 """
320 Draw a line around original_widget.
321 Use 'title' to set an initial title text with will be centered
322 on top of the box.
323 Use `title_align` to align the title to the 'left', 'right', or 'center'.
324 The default is 'center'.
325 You can also override the widgets used for the lines/corners:
326 tline: top line
327 bline: bottom line
328 lline: left line
329 rline: right line
330 tlcorner: top left corner
331 trcorner: top right corner
332 blcorner: bottom left corner
333 brcorner: bottom right corner
334 .. note:: This differs from the vanilla urwid LineBox by discarding
335 the a line if the middle of the line is set to either None or the
336 empty string.
337 """
338
339 if tline:
340 tline = Divider(tline)
341 if bline:
342 bline = Divider(bline)
343 if lline:
344 lline = SolidFill(lline)
345 if rline:
346 rline = SolidFill(rline)
347 tlcorner, trcorner = Text(tlcorner), Text(trcorner)
348 blcorner, brcorner = Text(blcorner), Text(brcorner)
349
350 if not tline and title:
351 raise ValueError('Cannot have a title when tline is unset')
352
353 self.title_widget = Text(self.format_title(title))
354
355 if tline:
356 if title_align not in ('left', 'center', 'right'):
357 raise ValueError('title_align must be one of "left", "right", or "center"')
358 if title_align == 'left':
359 tline_widgets = [('flow', self.title_widget), tline]
360 else:
361 tline_widgets = [tline, ('flow', self.title_widget)]
362 if title_align == 'center':
363 tline_widgets.append(tline)
364 self.tline_widget = Columns(tline_widgets)
365 top = Columns([
366 ('fixed', 1, tlcorner),
367 self.tline_widget,
368 ('fixed', 1, trcorner)
369 ])
370
371 else:
372 self.tline_widget = None

Callers

nothing calls this directly

Calls 2

format_titleMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected