aboutsummaryrefslogtreecommitdiffstats
path: root/clients/urwid/main.py
diff options
context:
space:
mode:
authorBlake DeMarcy <ofunknowndescent@gmail.com>2017-04-05 17:09:13 -0500
committerBlake DeMarcy <ofunknowndescent@gmail.com>2017-04-05 17:09:13 -0500
commit65de37998277592b54f462c28b9baf34dbe0d3d4 (patch)
tree86181d43277f5daccb4ea961bb0bddebf7e16263 /clients/urwid/main.py
parentef5d1a28696804e51343ee7a1c695d5c6c060c80 (diff)
downloadbbj-65de37998277592b54f462c28b9baf34dbe0d3d4.tar.gz
improve rainbow vomit
Diffstat (limited to 'clients/urwid/main.py')
-rw-r--r--clients/urwid/main.py30
1 files changed, 22 insertions, 8 deletions
diff --git a/clients/urwid/main.py b/clients/urwid/main.py
index 0ca4249..07d36c6 100644
--- a/clients/urwid/main.py
+++ b/clients/urwid/main.py
@@ -1,7 +1,7 @@
from time import time, sleep, localtime
-from random import choice, randrange
from string import punctuation
from subprocess import run
+from random import choice
from network import BBJ
import urwid
@@ -37,6 +37,8 @@ colors = [
class App:
def __init__(self):
self.mode = None
+ self.thread = None
+ self.usermap = {}
colors = [
("bar", "light magenta", "default"),
("button", "light red", "default"),
@@ -93,9 +95,11 @@ class App:
def index(self):
self.mode = "index"
+ self.thread = None
threads, usermap = network.thread_index()
+ self.usermap.update(usermap)
self.set_header("{} threads", len(threads))
- self.set_footer("Refresh", "Compose", "/Search", "?Help")
+ self.set_footer("Refresh", "Compose", "Quit", "/Search", "?Help")
walker = self.loop.widget.body.base_widget.body
walker.clear()
for thread in threads:
@@ -121,10 +125,13 @@ class App:
def thread_load(self, button, thread_id):
self.mode = "thread"
thread, usermap = network.thread_load(thread_id)
+ self.usermap.update(usermap)
+ self.thread = thread
walker = self.loop.widget.body.base_widget.body
walker.clear()
self.set_header("~{}: {}",
usermap[thread["author"]]["user_name"], thread["title"])
+ self.set_footer("Compose", "Refresh", "\"Quote", "/Search", "<Top", ">End", "QBack")
for message in thread["messages"]:
name = urwid.Text("~{}".format(usermap[message["author"]]["user_name"]))
info = "@ " + self.date_format.format(*localtime(message["created"]))
@@ -143,6 +150,13 @@ class App:
]]
+ # def compose(self):
+ # if self.mode == "index":
+ # feedback = "Starting a new thread..."
+ # elif self.mode == "thread":
+ # feedback = "Replying in "
+
+
class ActionBox(urwid.ListBox):
@@ -156,13 +170,13 @@ class ActionBox(urwid.ListBox):
if app.mode == "index":
app.loop.stop()
# run("clear", shell=True)
- width, height = urwid.raw_display.Screen().get_cols_rows()
+ width, height = app.loop.screen_size
for x in range(height - 1):
- line = str()
- for x in range(width):
- line += choice([" ", choice(punctuation)])
- motherfucking_rainbows(line)
- sleep(0.008)
+ motherfucking_rainbows(
+ "".join([choice([" ", choice(punctuation)]) for x in range(width)])
+ )
+ out = " ~~CoMeE BaCkK SooOn~~ 0000000"
+ motherfucking_rainbows(out.zfill(width))
exit()
else: app.index()
Un proyecto texto-plano.xyz