This repository was archived by the owner on Apr 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathframe_sample.py
More file actions
43 lines (36 loc) · 1.38 KB
/
frame_sample.py
File metadata and controls
43 lines (36 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), "blessedblocks"))
# Previous two lines not needed if blessedblocks modules is installed
from blessedblocks.block import Grid, SizePref
from blessedblocks.blocks import BareBlock, FramedBlock
from blessedblocks.runner import Runner
# Create an embedded block with its own grid
eblocks = {}
eblocks[1] = FramedBlock(BareBlock('eblock1',hjust='>', vjust='='),
top_border='{t.green}x',
bottom_border='{t.blue}y',
#left_border='{t.yellow}z',
#right_border='{t.magenta}a',
title='InnerTop',
title_sep='{t.yellow}-')
eblocks[2] = BareBlock('eblock2', hjust='<', vjust='v')
eg = Grid(layout=[(1,2)], blocks=eblocks)
# These 3 lines will show just the embedded grid
#top = BareBlock(grid=eg)
#r = Runner(top)
#r.start()
# This will embed the embedded grid into an outer block with just a title
outer = BareBlock("", grid=eg)
# Put the outer block into a grid by itself
layout = [1]
blocks = {}
blocks[1] = FramedBlock(outer,
no_borders=True,
title='My Title',
title_sep='{t.red}-')
g = Grid(layout, blocks)
# Now put that in one final top block for running
top = BareBlock(grid=g)
r = Runner(top)
r.start()