mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-06-07 14:02:51 -04:00
List sort fix
This commit is contained in:
parent
c6cf11df36
commit
17e752d134
2 changed files with 11 additions and 4 deletions
|
@ -45,16 +45,21 @@ class Conversation:
|
||||||
|
|
||||||
if display_name == None and app_data:
|
if display_name == None and app_data:
|
||||||
display_name = app_data.decode("utf-8")
|
display_name = app_data.decode("utf-8")
|
||||||
|
|
||||||
|
if display_name == None:
|
||||||
|
sort_name = ""
|
||||||
|
else:
|
||||||
|
sort_name = display_name
|
||||||
|
|
||||||
trust_level = app.directory.trust_level(source_hash, display_name)
|
trust_level = app.directory.trust_level(source_hash, display_name)
|
||||||
|
|
||||||
entry = (source_hash_text, display_name, trust_level)
|
entry = (source_hash_text, display_name, trust_level, sort_name)
|
||||||
conversations.append(entry)
|
conversations.append(entry)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Error while loading conversation "+str(dirname)+", skipping it. The contained exception was: "+str(e), RNS.LOG_ERROR)
|
RNS.log("Error while loading conversation "+str(dirname)+", skipping it. The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||||
|
|
||||||
conversations.sort(key=lambda e: (-e[2], e[1], e[0]), reverse=False)
|
conversations.sort(key=lambda e: (-e[2], e[3], e[0]), reverse=False)
|
||||||
|
|
||||||
return conversations
|
return conversations
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,8 @@ class ConversationsDisplay():
|
||||||
if not self.dialog_open:
|
if not self.dialog_open:
|
||||||
ilb_position = self.ilb.get_selected_position()
|
ilb_position = self.ilb.get_selected_position()
|
||||||
self.update_conversation_list()
|
self.update_conversation_list()
|
||||||
self.ilb.select_item(ilb_position)
|
if ilb_position != None:
|
||||||
|
self.ilb.select_item(ilb_position)
|
||||||
|
|
||||||
def update_listbox(self):
|
def update_listbox(self):
|
||||||
|
|
||||||
|
@ -183,7 +184,8 @@ class ConversationsDisplay():
|
||||||
self.update_listbox()
|
self.update_listbox()
|
||||||
options = self.columns_widget.options("weight", ConversationsDisplay.list_width)
|
options = self.columns_widget.options("weight", ConversationsDisplay.list_width)
|
||||||
self.columns_widget.contents[0] = (self.listbox, options)
|
self.columns_widget.contents[0] = (self.listbox, options)
|
||||||
self.ilb.select_item(ilb_position)
|
if ilb_position != None:
|
||||||
|
self.ilb.select_item(ilb_position)
|
||||||
nomadnet.NomadNetworkApp.get_shared_instance().ui.loop.draw_screen()
|
nomadnet.NomadNetworkApp.get_shared_instance().ui.loop.draw_screen()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue