Exemplo n.º 1
0
def igoto(win):
	try:
		choice = stdwin.askstr('Go to node (full name):', '')
	except KeyboardInterrupt:
		return
	if not choice:
		stdwin.message('Sorry, Go to has no default')
		return
	imove(win, choice)
Exemplo n.º 2
0
def igoto(win):
    try:
        choice = stdwin.askstr('Go to node (full name):', '')
    except KeyboardInterrupt:
        return
    if not choice:
        stdwin.message('Sorry, Go to has no default')
        return
    imove(win, choice)
Exemplo n.º 3
0
	def key_G(self): # goto
		try:
			reply = stdwin.askstr('Go to document:', self.cur_addr)
		except KeyboardInterrupt:
			return
		addr = string.strip(reply)
		if not addr:
			return
		self.follow(addr)
Exemplo n.º 4
0
 def key_G(self):  # goto
     try:
         reply = stdwin.askstr('Go to document:', self.cur_addr)
     except KeyboardInterrupt:
         return
     addr = string.strip(reply)
     if not addr:
         return
     self.follow(addr)
Exemplo n.º 5
0
	def key_f(self): # Find string
		if last_regex:
			prog, pat = last_regex
		else:
			prog, pat = None, ''
		try:
			pat = stdwin.askstr('Enter regular expression:', pat)
		except KeyboardInterrupt:
			return
		self.find(pat)
Exemplo n.º 6
0
 def key_f(self):  # Find string
     if last_regex:
         prog, pat = last_regex
     else:
         prog, pat = None, ''
     try:
         pat = stdwin.askstr('Enter regular expression:', pat)
     except KeyboardInterrupt:
         return
     self.find(pat)
Exemplo n.º 7
0
def isearch(win):
	try:
		pat = stdwin.askstr('Search pattern:', win.pat)
	except KeyboardInterrupt:
		return
	if not pat:
		pat = win.pat
		if not pat:
			stdwin.message('No previous pattern')
			return
	try:
		cpat = regexp.compile(pat)
	except regexp.error, msg:
		stdwin.message('Bad pattern: ' + msg)
		return
Exemplo n.º 8
0
	def key_i(self): # find keyword in index
		try:
			reply = stdwin.askstr('Find keyword(s) in index:', '')
		except KeyboardInterrupt:
			return
		words = string.split(reply)
		if not words:
			return
		scheme, host, port, path, search, anchor = \
			wwwlib.parse_addr(self.cur_addr)
		if len(search) > 1: hist = H_NOP
		else: hist = H_PUSH
		search = '?' + string.joinfields(words, '+')
		addr = wwwlib.unparse_addr(scheme,host,port,path,search,'')
		self.follow(addr, hist)
Exemplo n.º 9
0
def isearch(win):
    try:
        pat = stdwin.askstr('Search pattern:', win.pat)
    except KeyboardInterrupt:
        return
    if not pat:
        pat = win.pat
        if not pat:
            stdwin.message('No previous pattern')
            return
    try:
        cpat = regexp.compile(pat)
    except regexp.error, msg:
        stdwin.message('Bad pattern: ' + msg)
        return
Exemplo n.º 10
0
 def key_i(self):  # find keyword in index
     try:
         reply = stdwin.askstr('Find keyword(s) in index:', '')
     except KeyboardInterrupt:
         return
     words = string.split(reply)
     if not words:
         return
     scheme, host, port, path, search, anchor = \
      wwwlib.parse_addr(self.cur_addr)
     if len(search) > 1: hist = H_NOP
     else: hist = H_PUSH
     search = '?' + string.joinfields(words, '+')
     addr = wwwlib.unparse_addr(scheme, host, port, path, search, '')
     self.follow(addr, hist)
Exemplo n.º 11
0
def ichoice(win, prompt, list, default):
	if not list:
		stdwin.fleep()
		return
	if not default:
		topic, ref = list[0]
		default = topic
	try:
		choice = stdwin.askstr(prompt, default)
	except KeyboardInterrupt:
		return
	if not choice:
		return
	choice = string.lower(choice)
	n = len(choice)
	for topic, ref in list:
		topic = string.lower(topic)
		if topic[:n] == choice:
			imove(win, ref)
			return
	stdwin.message('Sorry, no topic matches ' + `choice`)
Exemplo n.º 12
0
def ichoice(win, prompt, list, default):
    if not list:
        stdwin.fleep()
        return
    if not default:
        topic, ref = list[0]
        default = topic
    try:
        choice = stdwin.askstr(prompt, default)
    except KeyboardInterrupt:
        return
    if not choice:
        return
    choice = string.lower(choice)
    n = len(choice)
    for topic, ref in list:
        topic = string.lower(topic)
        if topic[:n] == choice:
            imove(win, ref)
            return
    stdwin.message('Sorry, no topic matches ' + ` choice `)
Exemplo n.º 13
0
def askstr(prompt, default):
    return stdwin.askstr(prompt, default)
Exemplo n.º 14
0
def askstr(prompt, default):
	return stdwin.askstr(prompt, default)