示例#1
0
def load_canvas(canvas, text):
    for item in canvas.get_all_items():
        canvas.remove(item)
    ascii = preprocess.preprocess(options.Options(), text)
    figures = aparser.parse(ascii)
    for f in figures:
        if isinstance(f, figure.Box):
            gaphs.Box(f, canvas)
        elif isinstance(f, figure.Line):
            gaphs.Line(f, canvas)
示例#2
0
def load_canvas(canvas, text):
    for item in canvas.get_all_items():
        canvas.remove(item)
    ascii = preprocess.preprocess(options.Options(), text)
    figures = aparser.parse(ascii)
    for f in figures:
        if isinstance(f, figure.Box):
            gaphs.Box(f, canvas)
        elif isinstance(f, figure.Line):
            gaphs.Line(f, canvas)
示例#3
0
	def RetrClick(self, event):
		"""Send RETR command"""
		#TODO add check if a message is deleted
		i = int(self.retrTc.GetValue())
		if self.loginStatus and i <= self.numberOfMsg:
			form = map(lambda i : str(i) + '\n', self.popObject.retr(i)[1])
			self.msg = ('',''.join(form))[1]
			info = aparser.parse(self.msg)
			self.subjectTc.SetValue(info['subject'])
			self.fromTc.SetValue(info['from'])
			self.readTc.SetValue(info['body'])
			self.attachLbl.SetLabel('Attachment: %d file(s)' % len(info['attachments']))
			s = ''
			for a in info['attachments']:
				s += str(info['attachments'].index(a)) + '.' + a.name + '  '
			self.attachTc.SetValue(s)
示例#4
0
	def PrintLoggedIn(self, username, userMsg, passMsg):
		"""Print welcome, user, list of msg"""
		self.logTc.AppendText(self.popObject.getwelcome() + '\n')
		self.logTc.AppendText('Welcome back, ' + username + '!\n')
		statMsg = list(self.popObject.stat())
		self.numberOfMsg = statMsg[0]
		parsed = 'You have ' + str(statMsg[0]) + ' mails = ' + str(statMsg[1]) + ' bytes\n'
		self.logTc.AppendText(parsed)

		#print info of all email
		for i in range(1, statMsg[0]+1):
			#add \n char to all string
			form = map(lambda i : str(i) + '\n', self.popObject.retr(i)[1])
			msg = ('',''.join(form))[1]
			info = aparser.parse(msg)
			s = (str(i), info['date'].split()[0], info['from'], info['subject'], str(len(info['attachments'])))
			string = '%s %s %20.20s "%30.30s" Att %s' % s
			#print string + '\n'
			self.logTc.AppendText(string + '\n')