Example #1
0
def wait_until_change(lp):
	xpos = qterm.caretX(lp)
	ypos = qterm.caretY(lp)
	line = qterm.getText(lp, ypos)
	small_sleep()
	x = qterm.caretX(lp)
	y = qterm.caretY(lp)
	str = qterm.getText(lp, y)
	t = maxtry
	while x == xpos and y == ypos and str == line and t > 0:
		small_sleep()
		x = qterm.caretX(lp)
		y = qterm.caretY(lp)
		str = qterm.getText(lp, y)
		t -= 1
Example #2
0
def get_title_list_ready(lp):
	global lastlineno
	if not return_to_list(lp):
		return
	lineno = qterm.caretY(lp)
	line = qterm.getText(lp, lineno)
	# try digest list
	exp = r'^(?:->|\s*>)\s*(\d+)\s*\[(.+?)\]\s*(.*?)\s*$'
	matchobj = re.match(exp, line)
	if matchobj:
		return 1, matchobj.group(1), matchobj.group(2), matchobj.group(3)
	else:	# try normal article list
		exp = r'^(?:>)\s*(\S+)\s*(?:[+*NmMgGbBrRoO.])?\s+(\S+)\s*(\w+)\s*(\d+)(?:\.)?\s*(?:x|@)?(¡ñ|¡ô|¡ï|Re:|©À) (.*?)\s*$'
		print 'maybe article'
		matchobj = re.match(exp, line)
		if matchobj:
			if matchobj.group(5) == 'Re:' or matchobj.group(5) == '©À':
				reply = 'Re: '
			else:
				reply = ''
			return 0, matchobj.group(1), matchobj.group(2), reply + matchobj.group(6)
		else:
			print 'line %s not matched' % line