[Nym3-commit] r144 - trunk/nym3/Client
laurent at komite.net
laurent at komite.net
Tue Dec 28 21:45:46 CET 2004
Author: laurent
Date: 2004-12-28 21:45:43 +0100 (Tue, 28 Dec 2004)
New Revision: 144
Modified:
trunk/nym3/Client/testcurses.py
Log:
First try at a synbox tab (ncurses interface).
Modified: trunk/nym3/Client/testcurses.py
===================================================================
--- trunk/nym3/Client/testcurses.py 2004-12-28 16:03:15 UTC (rev 143)
+++ trunk/nym3/Client/testcurses.py 2004-12-28 20:45:43 UTC (rev 144)
@@ -41,7 +41,61 @@
else:
return subj[i]
+class Synbox_tab(Tab):
+ """Tab that manages a synbox. We hold the _decrypted_ synopsis as a
+ list of {mid / read_status / fetch_status / synopsis}.
+ read_status is one of { read, unread }, and fetch_status is one of:
+ - fetch: message is scheduled to be fetched
+ - delete: message is scheduled to be deleted
+ - fetch_asked: a control message containing a retrieve command
+ for this message was already sent
+ - delete_asked: a control message containing a delete command
+ for this message was already sent."""
+
+ def __init__(self):
+ self.synlist = [];
+ pass
+
+ def view(self, i):
+ """Display the requested synopsis"""
+ # TODO : this needs a PAGER view.
+ self.synlist[i]['read_status'] = 'read'
+ pass
+
+ def mark_unread(self, i):
+ self.synlist[i]['read_status'] = 'unread'
+
+ def mark_read(self, i):
+ self.synlist[i]['read_status'] = 'read'
+
+ def size(self):
+ return len(self.synlist)
+
+ def line(self, i):
+ """Ugly print current entry as a line"""
+ # TODO: we need to draw this better.
+ # Allow the user to specify some kind of format
+ # and take the flags into account to.
+ assert(i < len(self.synlist))
+ syn = self.synlist[i]
+ sfrom, sdate, subject = self.extract(syn)
+ return "%s %s %s" % (sdate, sfrom, subject)
+
+ def fetch(self, l):
+ """Schedule every entry listed in l for retrieval"""
+ for i in l:
+ self.synlist[i]['fetch_status'] = 'fetch'
+
+ def delete(self, l):
+ """Schedule every entry listed in l for deletion"""
+ for i in l:
+ self.synlist[i]['fetch_status'] = 'delete'
+
+ def process_pending(self):
+ """Gather pending control commands to the server"""
+ pass
+
class Screen_ctx:
""" this class holds all the information relative to the content and the
way a screen is drawn"""
More information about the Nym3-commit
mailing list