mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-06-03 13:32:25 -04:00
Improved conversation sorting
This commit is contained in:
parent
398c3c3504
commit
ee6cc9fd4f
2 changed files with 3 additions and 1 deletions
|
@ -236,6 +236,7 @@ class ConversationMessage:
|
||||||
self.lxm = LXMF.LXMessage.unpack_from_file(open(self.file_path, "rb"))
|
self.lxm = LXMF.LXMessage.unpack_from_file(open(self.file_path, "rb"))
|
||||||
self.loaded = True
|
self.loaded = True
|
||||||
self.timestamp = self.lxm.timestamp
|
self.timestamp = self.lxm.timestamp
|
||||||
|
self.sort_timestamp = os.path.getmtime(self.file_path)
|
||||||
|
|
||||||
if self.lxm.state > LXMF.LXMessage.DRAFT and self.lxm.state < LXMF.LXMessage.SENT:
|
if self.lxm.state > LXMF.LXMessage.DRAFT and self.lxm.state < LXMF.LXMessage.SENT:
|
||||||
found = False
|
found = False
|
||||||
|
|
|
@ -665,7 +665,7 @@ class ConversationWidget(urwid.WidgetWrap):
|
||||||
message_widget = LXMessageWidget(message)
|
message_widget = LXMessageWidget(message)
|
||||||
self.message_widgets.append(message_widget)
|
self.message_widgets.append(message_widget)
|
||||||
|
|
||||||
self.message_widgets.sort(key=lambda m: m.timestamp, reverse=False)
|
self.message_widgets.sort(key=lambda m: m.sort_timestamp, reverse=False)
|
||||||
|
|
||||||
from nomadnet.vendor.additional_urwid_widgets import IndicativeListBox
|
from nomadnet.vendor.additional_urwid_widgets import IndicativeListBox
|
||||||
self.messagelist = IndicativeListBox(self.message_widgets, position = len(self.message_widgets)-1)
|
self.messagelist = IndicativeListBox(self.message_widgets, position = len(self.message_widgets)-1)
|
||||||
|
@ -699,6 +699,7 @@ class LXMessageWidget(urwid.WidgetWrap):
|
||||||
app = nomadnet.NomadNetworkApp.get_shared_instance()
|
app = nomadnet.NomadNetworkApp.get_shared_instance()
|
||||||
g = app.ui.glyphs
|
g = app.ui.glyphs
|
||||||
self.timestamp = message.get_timestamp()
|
self.timestamp = message.get_timestamp()
|
||||||
|
self.sort_timestamp = message.sort_timestamp
|
||||||
time_format = app.time_format
|
time_format = app.time_format
|
||||||
message_time = datetime.fromtimestamp(self.timestamp)
|
message_time = datetime.fromtimestamp(self.timestamp)
|
||||||
encryption_string = ""
|
encryption_string = ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue