mirror of
https://github.com/markqvist/NomadNet.git
synced 2024-10-01 01:26:07 -04:00
Added option to limit messages per sync operation
This commit is contained in:
parent
830a8e7f23
commit
efdcec5670
@ -251,9 +251,9 @@ class NomadNetworkApp:
|
|||||||
def get_sync_progress(self):
|
def get_sync_progress(self):
|
||||||
return self.message_router.propagation_transfer_progress
|
return self.message_router.propagation_transfer_progress
|
||||||
|
|
||||||
def request_lxmf_sync(self):
|
def request_lxmf_sync(self, limit = None):
|
||||||
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
|
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
|
||||||
self.message_router.request_messages_from_propagation_node(self.identity)
|
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
|
||||||
|
|
||||||
def cancel_lxmf_sync(self):
|
def cancel_lxmf_sync(self):
|
||||||
if self.message_router.propagation_transfer_state != LXMF.LXMRouter.PR_IDLE:
|
if self.message_router.propagation_transfer_state != LXMF.LXMRouter.PR_IDLE:
|
||||||
|
@ -327,6 +327,7 @@ class ConversationsDisplay():
|
|||||||
self.close_conversation(conversation)
|
self.close_conversation(conversation)
|
||||||
|
|
||||||
def sync_conversations(self):
|
def sync_conversations(self):
|
||||||
|
g = self.app.ui.glyphs
|
||||||
self.dialog_open = True
|
self.dialog_open = True
|
||||||
|
|
||||||
def dismiss_dialog(sender):
|
def dismiss_dialog(sender):
|
||||||
@ -336,9 +337,17 @@ class ConversationsDisplay():
|
|||||||
if self.app.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
|
if self.app.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
|
||||||
self.app.cancel_lxmf_sync()
|
self.app.cancel_lxmf_sync()
|
||||||
|
|
||||||
|
max_messages_group = []
|
||||||
|
r_mall = urwid.RadioButton(max_messages_group, "Download all", state=True)
|
||||||
|
r_mlim = urwid.RadioButton(max_messages_group, "Limit to", state=False)
|
||||||
|
ie_lim = urwid.IntEdit("", 5)
|
||||||
|
rbs = urwid.GridFlow([r_mlim, ie_lim], 12, 1, 0, align="left")
|
||||||
|
|
||||||
def sync_now(sender):
|
def sync_now(sender):
|
||||||
self.app.request_lxmf_sync()
|
limit = None
|
||||||
|
if r_mlim.get_state():
|
||||||
|
limit = ie_lim.value()
|
||||||
|
self.app.request_lxmf_sync(limit)
|
||||||
self.update_sync_dialog()
|
self.update_sync_dialog()
|
||||||
|
|
||||||
def cancel_sync(sender):
|
def cancel_sync(sender):
|
||||||
@ -359,10 +368,24 @@ class ConversationsDisplay():
|
|||||||
real_sync_button.bc = button_columns
|
real_sync_button.bc = button_columns
|
||||||
|
|
||||||
if self.app.get_default_propagation_node() != None:
|
if self.app.get_default_propagation_node() != None:
|
||||||
|
pn_hash = self.app.get_default_propagation_node()
|
||||||
|
pn_ident = RNS.Identity.recall(pn_hash)
|
||||||
|
node_hash = RNS.Destination.hash_from_name_and_identity("nomadnetwork.node", pn_ident)
|
||||||
|
pn_entry = self.app.directory.find(node_hash)
|
||||||
|
|
||||||
|
# TODO: Remove
|
||||||
|
RNS.log(str(self.app.get_default_propagation_node()))
|
||||||
|
RNS.log(RNS.prettyhexrep(self.app.get_default_propagation_node()))
|
||||||
|
RNS.log(str(pn_entry))
|
||||||
|
|
||||||
dialog = DialogLineBox(
|
dialog = DialogLineBox(
|
||||||
urwid.Pile([
|
urwid.Pile([
|
||||||
urwid.Text(""),
|
urwid.Text(""+g["node"]+" "+str(pn_entry.display_name), align="center"),
|
||||||
|
urwid.Divider(g["divider1"]),
|
||||||
sync_progress,
|
sync_progress,
|
||||||
|
urwid.Divider(g["divider1"]),
|
||||||
|
r_mall,
|
||||||
|
rbs,
|
||||||
urwid.Text(""),
|
urwid.Text(""),
|
||||||
button_columns
|
button_columns
|
||||||
]), title="Message Sync"
|
]), title="Message Sync"
|
||||||
|
Loading…
Reference in New Issue
Block a user