-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhandler.py
executable file
·69 lines (58 loc) · 1.97 KB
/
handler.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/python
'''
This file is a part of whrwthal.
whrwthal is an offline bible referencing module.
Copyright (C) 2020 Gregory Caceres-Munsell <gregcaceres@gmail.com>
'''
import curses
import time
from blurses import Blurses
import whrwthal
from whrwthal import textile
def start(self, t=5.0):
# A simple timed progress bar ~5.0 seconds
time.sleep(t)
def mainmenu(window, menu):
title = ['whrwthal -- Offline Bible Referencing']
preamble = ''.join([textile.preamble(),
'\n\nwhrwhtal (adverb), as in:\n\n',
'Wherewithal shall a young man ',
'cleanse his way? by taking heed ',
'thereto according to thy word. - Psalm 119:9'])
mode = 0
while mode == 0:
window.clear()
window.update()
window.draw(title, top=2, left=2)
window.wrap(preamble, width=80, vcenter=True, hcenter=True)
window.draw(menu(), bottom=5, left=5)
mode = menu.input(window.getch())
return mode
def howto(window, menu):
pageup = ['<-']
pagedown = ['->']
pages = [textile.keybinds(whrwthal),
'\n'.join([' A good search looks like...',
'---------------------------',
'Romans 5:8-10 John 3:16',
'Psalm 119 Philemon',
'phrase word'])]
i = 0
while 0 <= i < len(pages):
window.clear()
window.update()
window.wrap(pages[i], width=90, vcenter=True, hcenter=True)
window.draw(pagedown, right=5, bottom=5)
window.draw(pageup, top=5, left=5)
key = window.getch()
if (key == 10) or (key == ord('l')) or (key == curses.KEY_RIGHT):
i += 1
elif (key == ord('h')) or (key == curses.KEY_LEFT):
i -= 1
return 0
# SUBMENU'S
# def aboutmenu(window, menu):
blurses = Blurses()
blurses.bind('', mainmenu)
blurses.bind('How-To', howto)
blurses.run()