aboutsummaryrefslogtreecommitdiffstats
path: root/clients/urwid/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'clients/urwid/main.py')
-rw-r--r--clients/urwid/main.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/clients/urwid/main.py b/clients/urwid/main.py
index 06bae27..d95b505 100644
--- a/clients/urwid/main.py
+++ b/clients/urwid/main.py
@@ -668,6 +668,8 @@ class App(object):
"Enable Formatting" if raw else "Disable Formatting",
self.toggle_formatting, message))
buttons.insert(0, urwid.Button("Edit Post", self.edit_post, message))
+ if network.user["is_admin"]:
+ buttons.insert(0, urwid.Text(("20", "Reminder: You're an admin!")))
if not buttons:
return
@@ -823,19 +825,22 @@ class App(object):
self.usermap.update(usermap)
self.walker.clear()
- server_pin_counter = 0
+ server_pins = []
client_pin_counter = 0
for thread in threads:
if thread["pinned"]:
- self.walker.insert(server_pin_counter, self.make_thread_body(thread, pinned="server"))
- server_pin_counter += 1
+ server_pins.append(thread)
elif thread["thread_id"] in self.client_pinned_threads:
self.walker.insert(client_pin_counter, self.make_thread_body(thread, pinned="client"))
client_pin_counter += 1
else:
self.walker.append(self.make_thread_body(thread))
+ # make sure these are always up top
+ for index, thread in enumerate(server_pins):
+ self.walker.insert(index, self.make_thread_body(thread, pinned="server"))
+
self.set_bars(True)
if self.last_index_pos:
@@ -882,6 +887,14 @@ class App(object):
self.index()
+ def toggle_server_pin(self):
+ if self.mode != "index" or not network.user["is_admin"]:
+ return
+ thread = self.walker.get_focus()[0].thread
+ network.thread_set_pin(thread["thread_id"], not thread["pinned"])
+ self.index()
+
+
def search_index_callback(self, query):
simple_query = query.lower().strip()
threads, usermap = network.thread_index()
@@ -2233,6 +2246,9 @@ class ActionBox(urwid.ListBox):
elif key == "*":
app.toggle_client_pin()
+ elif key == "\\":
+ app.toggle_server_pin()
+
elif key == "~":
# sssssshhhhhhhh
app.loop.stop()
@@ -2240,13 +2256,12 @@ class ActionBox(urwid.ListBox):
except: pass
app.loop.start()
- elif keyl == "f12":
+ elif keyl == "$":
app.loop.stop()
call("clear", shell=True)
- motherfucking_rainbows(obnoxious_logo)
readline.set_completer(rlcompleter.Completer().complete)
readline.parse_and_bind("tab: complete")
- interact(banner=version + "\n(BBJ Interactive Console)", local=globals())
+ interact(banner="Python " + version + "\nBBJ Interactive Console\nCtrl-D exits.", local=globals())
app.loop.start()
elif app.mode == "thread" and not app.window_split and not overlay:
Un proyecto texto-plano.xyz