only show mentions from other users
This commit is contained in:
parent
4072e2b7e5
commit
26eec98680
9
bink.py
9
bink.py
@ -107,7 +107,8 @@ if len(sys.argv) > 1:
|
|||||||
|
|
||||||
import urwid
|
import urwid
|
||||||
|
|
||||||
name_re = compile(f"(?<!\w)[@~]?{getpwuid(os.getuid()).pw_name}")
|
current_user = getpwuid(os.getuid()).pw_name
|
||||||
|
name_re = compile(f"(?<!\w)[@~]?{current_user}")
|
||||||
footer = "[c]reate [r]efresh [q]uit | scrolling: arrows, j/k, space, page up/down, ctrl-d/ctrl-u"
|
footer = "[c]reate [r]efresh [q]uit | scrolling: arrows, j/k, space, page up/down, ctrl-d/ctrl-u"
|
||||||
attrmap = [
|
attrmap = [
|
||||||
("bold", "default,bold", "default"),
|
("bold", "default,bold", "default"),
|
||||||
@ -137,9 +138,10 @@ class App():
|
|||||||
|
|
||||||
def post_to_widget(self, post):
|
def post_to_widget(self, post):
|
||||||
body = post["body"]
|
body = post["body"]
|
||||||
|
post_user = post["user"]
|
||||||
time_seconds = post["time"] / 1_000_000_000
|
time_seconds = post["time"] / 1_000_000_000
|
||||||
stamp = datetime.datetime.fromtimestamp(time_seconds)
|
stamp = datetime.datetime.fromtimestamp(time_seconds)
|
||||||
if name_re.search(body):
|
if current_user != post_user and name_re.search(body):
|
||||||
widget_body = []
|
widget_body = []
|
||||||
index = 0
|
index = 0
|
||||||
for match in name_re.finditer(body):
|
for match in name_re.finditer(body):
|
||||||
@ -152,11 +154,10 @@ class App():
|
|||||||
widget_body.append(body[index:])
|
widget_body.append(body[index:])
|
||||||
body = widget_body
|
body = widget_body
|
||||||
pile = urwid.Pile([
|
pile = urwid.Pile([
|
||||||
urwid.Text([("bold", f"~{post['user']}"), " @ ", stamp.strftime("%H:%M (%A, %B %d, %Y)")]),
|
urwid.Text([("bold", f"~{post_user}"), " @ ", stamp.strftime("%H:%M (%A, %B %d, %Y)")]),
|
||||||
urwid.Text(body),
|
urwid.Text(body),
|
||||||
urwid.Divider()
|
urwid.Divider()
|
||||||
])
|
])
|
||||||
# pile.post_time = post["time"]
|
|
||||||
return pile
|
return pile
|
||||||
|
|
||||||
def write_with_editor(self):
|
def write_with_editor(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user