Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Print(screen,
Fire(screen.height, 80, text, 0.4, 40, screen.colours),
0,
speed=1,
transparent=False),
Print(screen,
FigletText("ASCIIMATICS", "banner"),
screen.height - 9, x=(screen.width - width) // 2 + 1,
colour=Screen.COLOUR_BLACK,
bg=Screen.COLOUR_BLACK,
speed=1),
Print(screen,
FigletText("ASCIIMATICS", "banner"),
screen.height - 9,
colour=Screen.COLOUR_WHITE,
bg=Screen.COLOUR_WHITE,
speed=1),
]
scenes.append(Scene(effects, -1))
screen.play(scenes, stop_on_resize=True)
effects = [
Print(screen,
Fire(screen.height, 80, text, 0.4, 40, screen.colours),
0,
speed=1,
transparent=False),
Print(screen,
FigletText("ASCIIMATICS", "banner"),
screen.height - 9, x=(screen.width - width) // 2 + 1,
colour=Screen.COLOUR_BLACK,
bg=Screen.COLOUR_BLACK,
speed=1),
Print(screen,
FigletText("ASCIIMATICS", "banner"),
screen.height - 9,
colour=Screen.COLOUR_WHITE,
bg=Screen.COLOUR_WHITE,
speed=1),
]
scenes.append(Scene(effects, -1))
screen.play(scenes, stop_on_resize=True)
def internal_checks(screen):
# Check screen basically exists
self.assertIsNotNone(screen)
self.assertGreater(screen.width, 0)
self.assertGreater(screen.height, 0)
self.assertGreater(screen.colours, 0)
# Check that the Screen is cleared ready for use.
for x in range(screen.width):
for y in range(screen.height):
char, fg, attr, bg = screen.get_from(x, y)
self.assertEqual(char, ord(" "))
self.assertEqual(fg, Screen.COLOUR_WHITE)
self.assertEqual(attr, 0)
self.assertEqual(bg, Screen.COLOUR_BLACK)
(Screen.COLOUR_RED, 0),
(Screen.COLOUR_RED, 0),
(Screen.COLOUR_RED, 0),
(Screen.COLOUR_RED, 0),
(Screen.COLOUR_RED, 0),
(Screen.COLOUR_RED, 0),
(Screen.COLOUR_RED, 0),
(Screen.COLOUR_RED, Screen.A_BOLD),
(Screen.COLOUR_RED, Screen.A_BOLD),
(Screen.COLOUR_RED, Screen.A_BOLD),
(Screen.COLOUR_RED, Screen.A_BOLD),
(Screen.COLOUR_YELLOW, Screen.A_BOLD),
(Screen.COLOUR_YELLOW, Screen.A_BOLD),
(Screen.COLOUR_YELLOW, Screen.A_BOLD),
(Screen.COLOUR_YELLOW, Screen.A_BOLD),
(Screen.COLOUR_WHITE, Screen.A_BOLD),
]
_COLOURS_256 = [
(0, 0),
(52, 0),
(88, 0),
(124, 0),
(160, 0),
(196, 0),
(202, 0),
(208, 0),
(214, 0),
(220, 0),
(226, 0),
(227, 0),
(228, 0),
if len(self.txqueue(self._interface.node.network)) < 1:
return [''], [()]
image = "TXs: "
color_map = sl_color_map(image)
for index, tx in enumerate(self.txqueue(self._interface.node.network)):
#debug(); pdb.set_trace()
if index > 0 and index < len(self.txqueue(self._interface.node.network)):
image += '║'
color_map += [SL_COLOR]
tx_image = " {}) {} ".format(index, tx.hash.hex()[0:9])
tx_map = sl_color_map(tx_image)
tx_map[1] = (Screen.COLOUR_WHITE,
Screen.A_BOLD,
Screen.COLOUR_BLACK)
image += tx_image
color_map += tx_map
#debug(); pdb.set_trace()
return [image], [color_map]
palettes = defaultdict(lambda: (Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_BLACK))
palettes.update(
def scroll(self, lines):
"""
Scroll the window up or down.
:param lines: Number of lines to scroll. Negative numbers move the buffer up.
"""
line = [(u" ", Screen.COLOUR_WHITE, 0, 0, 1) for _ in range(self._width)]
if lines > 0:
# Limit to buffer size - this will just invalidate all the data
lines = min(lines, self._height)
for y in range(0, self._height - lines):
self._double_buffer[y] = self._double_buffer[y + lines]
self._screen_buffer[y] = self._screen_buffer[y + lines]
for y in range(self._height - lines, self._height):
self._double_buffer[y] = line[:]
self._screen_buffer[y] = line[:]
else:
# Limit to buffer size - this will just invalidate all the data
lines = max(lines, -self._height)
for y in range(0, -lines):
self._double_buffer[self._height + lines + y] = line[:]
self._screen_buffer[y] = line[:]
for y in range(self._height - 1, -lines, -1):
x=13, y=1, transparent=False, speed=2),
Print(screen,
BarChart(
13, 60,
[wv(1), wv(2), wv(3), wv(4), wv(5), wv(7), wv(8), wv(9)],
colour=Screen.COLOUR_GREEN,
axes=BarChart.BOTH,
scale=2.0),
x=68, y=1, transparent=False, speed=2),
Print(screen,
BarChart(
7, 60, [lambda: time.time() * 10 % 101],
gradient=[
(33, Screen.COLOUR_RED, Screen.COLOUR_RED),
(66, Screen.COLOUR_YELLOW, Screen.COLOUR_YELLOW),
(100, Screen.COLOUR_WHITE, Screen.COLOUR_WHITE),
] if screen.colours < 256 else [
(10, 234, 234), (20, 236, 236), (30, 238, 238),
(40, 240, 240), (50, 242, 242), (60, 244, 244),
(70, 246, 246), (80, 248, 248), (90, 250, 250),
(100, 252, 252)
],
char=">",
scale=100.0,
labels=True,
axes=BarChart.X_AXIS),
x=68, y=16, transparent=False, speed=2),
Print(screen,
BarChart(
10, 60,
[wv(1), wv(2), wv(3), wv(4), wv(5), wv(7), wv(8), wv(9)],
colour=[c for c in range(1, 8)],
"waterway": 153,
"marine_label": 12,
"admin": 7,
"country_label": 9,
"state_label": 1,
"place_label": 0,
"building": 252,
"road": 15,
"poi_label": 8
}
_16_PALETTE = {
"landuse": Screen.COLOUR_GREEN,
"water": Screen.COLOUR_BLUE,
"waterway": Screen.COLOUR_BLUE,
"marine_label": Screen.COLOUR_BLUE,
"admin": Screen.COLOUR_WHITE,
"country_label": Screen.COLOUR_RED,
"state_label": Screen.COLOUR_RED,
"place_label": Screen.COLOUR_YELLOW,
"building": Screen.COLOUR_WHITE,
"road": Screen.COLOUR_WHITE,
"poi_label": Screen.COLOUR_RED
}
def __init__(self, screen):
super(Map, self).__init__(screen)
# Current state of the map
self._screen = screen
self._zoom = 0
self._latitude = 51.4778
self._longitude = -0.0015
self._tiles = OrderedDict()
"background":
(Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_BLUE),
"shadow":
(Screen.COLOUR_BLACK, None, Screen.COLOUR_BLACK),
"disabled":
(Screen.COLOUR_BLACK, Screen.A_BOLD, Screen.COLOUR_BLUE),
"invalid":
(Screen.COLOUR_YELLOW, Screen.A_BOLD, Screen.COLOUR_RED),
"label":
(Screen.COLOUR_GREEN, Screen.A_BOLD, Screen.COLOUR_BLUE),
"borders":
(Screen.COLOUR_BLACK, Screen.A_BOLD, Screen.COLOUR_BLUE),
"scroll":
(Screen.COLOUR_CYAN, Screen.A_NORMAL, Screen.COLOUR_BLUE),
"title":
(Screen.COLOUR_WHITE, Screen.A_BOLD, Screen.COLOUR_BLUE),
"edit_text":
(Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_BLUE),
"focus_edit_text":
(Screen.COLOUR_WHITE, Screen.A_BOLD, Screen.COLOUR_CYAN),
"button":
(Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_BLUE),
"focus_button":
(Screen.COLOUR_WHITE, Screen.A_BOLD, Screen.COLOUR_CYAN),
"control":
(Screen.COLOUR_YELLOW, Screen.A_NORMAL, Screen.COLOUR_BLUE),
"selected_control":
(Screen.COLOUR_YELLOW, Screen.A_BOLD, Screen.COLOUR_BLUE),
"focus_control":
(Screen.COLOUR_YELLOW, Screen.A_NORMAL, Screen.COLOUR_BLUE),
"selected_focus_control":
(Screen.COLOUR_YELLOW, Screen.A_BOLD, Screen.COLOUR_CYAN),