def do_cut(win):
    text = win.editor.getfocustext()
    if not text:
        stdwin.fleep()
        return
    stdwin.setcutbuffer(0, text)
    replace(win, '')
Exemple #2
0
def do_cut(win):
	text = win.editor.getfocustext()
	if not text:
		stdwin.fleep()
		return
	stdwin.setcutbuffer(0, text)
	replace(win, '')
Exemple #3
0
def icopy(win):
    focustext = win.textobj.getfocustext()
    if not focustext:
        stdwin.fleep()
    else:
        stdwin.rotatecutbuffers(1)
        stdwin.setcutbuffer(0, focustext)
Exemple #4
0
	def do_up(self):
		if self.curindex == 0:
			stdwin.fleep()
		else:
			self.curindex = self.curindex - 1
			self.curframe = self.stack[self.curindex][0]
			self.refreshstack()
Exemple #5
0
	def char(self, detail):
		try:
			func = eval('self.do_' + detail)
		except (AttributeError, SyntaxError):
			stdwin.fleep()
			return
		func()
Exemple #6
0
	def do_down(self):
		if self.curindex + 1 == len(self.stack):
			stdwin.fleep()
		else:
			self.curindex = self.curindex + 1
			self.curframe = self.stack[self.curindex][0]
			self.refreshstack()
Exemple #7
0
 def do_down(self):
     if self.curindex + 1 == len(self.stack):
         stdwin.fleep()
     else:
         self.curindex = self.curindex + 1
         self.curframe = self.stack[self.curindex][0]
         self.refreshstack()
Exemple #8
0
def icopy(win):
	focustext = win.textobj.getfocustext()
	if not focustext:
		stdwin.fleep()
	else:
		stdwin.rotatecutbuffers(1)
		stdwin.setcutbuffer(0, focustext)
Exemple #9
0
 def do_up(self):
     if self.curindex == 0:
         stdwin.fleep()
     else:
         self.curindex = self.curindex - 1
         self.curframe = self.stack[self.curindex][0]
         self.refreshstack()
Exemple #10
0
 def char(self, detail):
     try:
         func = eval('self.do_' + detail)
     except (AttributeError, SyntaxError):
         stdwin.fleep()
         return
     func()
def do_clear(window):
	first, last = window.textobject.getfocus()
	if first == last:
		stdwin.fleep()		# Nothing to clear
	else:
		window.textobject.replace('')
		window.changed = 1
		fix_docsize(window)
Exemple #12
0
def playfile(filename):
    killchild()
    try:
        tuple = sndhdr.what(filename)
    except IOError, msg:
        print 'Can\'t open', filename, msg
        stdwin.fleep()
        return
Exemple #13
0
def playfile(filename):
	killchild()
	try:
		tuple = sndhdr.what(filename)
	except IOError, msg:
		print 'Can\'t open', filename, msg
		stdwin.fleep()
		return
Exemple #14
0
	def make_selection(self):
		s = self.tefocus.getfocustext()
		if not s:
			return
		stdwin.rotatecutbuffers(1)
		stdwin.setcutbuffer(0, s)
		if not self.window.setselection(WS_PRIMARY, s):
			stdwin.fleep()
Exemple #15
0
 def mouse_up(self, detail):
     if self.last_mouse_down:
         h1, v1 = self.last_mouse_down[0]
         h2, v2 = detail[0]
         long1 = self.cur_backend.whereis(stdwin, h1, v1)
         long2 = self.cur_backend.whereis(stdwin, h2, v2)
         if not long1 or not long2:
             return
         long1, long2 = self.roundpositions(long1, long2)
         self.cur_backend.setselection((long1, long2))
         #
         selection = self.cur_backend.extractpart(long1, long2)
         if not selection:
             return
         if not self.window.setselection(WS_PRIMARY, selection):
             # Meaning some other application got it now
             stdwin.fleep()
             return
         stdwin.rotatecutbuffers(1)
         stdwin.setcutbuffer(0, selection)
         return
     h, v = detail[0]
     hits = self.cur_backend.hitcheck(h, v)
     if not hits:
         return
     if len(hits) > 1:
         stdwin.message('Please click in exactly one anchor')
         return
     id = hits[0]
     if 1 <= id <= len(self.cur_anchors):
         addr = self.cur_anchors[id - 1]
         name = self.cur_anchornames[id - 1]
         type = self.cur_anchortypes[id - 1]
         button = detail[2]
         if button == 2:
             if name:
                 msg = 'NAME="' + name + '" '
             else:
                 msg = ''
             if addr:
                 msg = msg + 'HREF="' + addr + '"'
             stdwin.message(msg)
         elif addr[:7] == 'telnet:':
             self.telnet(addr)
         elif button == 3 and addr and addr[0] <> '#':
             addr = self.full_addr(addr)
             w = self.new()
             history = self.history + [self.cur_addr]
             if not w.setaddr(addr):
                 w.close()
                 stdwin.message(addr + ': ' + \
                  self.last_msg)
             else:
                 w.set_history(history)
         else:
             self.follow(addr)
     else:
         stdwin.message('Strange - bad anchor id???')
Exemple #16
0
	def mouse_up(self, detail):
		if self.last_mouse_down:
			h1, v1 = self.last_mouse_down[0]
			h2, v2 = detail[0]
			long1 = self.cur_backend.whereis(stdwin, h1, v1)
			long2 = self.cur_backend.whereis(stdwin, h2, v2)
			if not long1 or not long2:
				return
			long1, long2 = self.roundpositions(long1, long2)
			self.cur_backend.setselection((long1, long2))
			#
			selection = self.cur_backend.extractpart(long1, long2)
			if not selection:
				return
			if not self.window.setselection(WS_PRIMARY, selection):
				# Meaning some other application got it now
				stdwin.fleep()
				return
			stdwin.rotatecutbuffers(1)
			stdwin.setcutbuffer(0, selection)
			return
		h, v = detail[0]
		hits = self.cur_backend.hitcheck(h, v)
		if not hits:
			return
		if len(hits) > 1:
			stdwin.message('Please click in exactly one anchor')
			return
		id = hits[0]
		if 1 <= id <= len(self.cur_anchors):
			addr = self.cur_anchors[id-1]
			name = self.cur_anchornames[id-1]
			type = self.cur_anchortypes[id-1]
			button = detail[2]
			if button == 2:
				if name:
					msg = 'NAME="' + name + '" '
				else:
					msg = ''
				if addr:
					msg = msg + 'HREF="' + addr + '"'
				stdwin.message(msg)
			elif addr[:7] == 'telnet:':
				self.telnet(addr)
			elif button == 3 and addr and addr[0] <> '#':
				addr = self.full_addr(addr)
				w = self.new()
				history = self.history + [self.cur_addr]
				if not w.setaddr(addr):
					w.close()
					stdwin.message(addr + ': ' + \
						self.last_msg)
				else:
					w.set_history(history)
			else:
				self.follow(addr)
		else:
			stdwin.message('Strange - bad anchor id???')
Exemple #17
0
 def key_space(self):  # traverse
     if self.gotype('menu', H_PUSH) or self.gotype('next', H_NOP):
         return
     while 1:
         if not self.gotype('up', H_POP):
             stdwin.fleep()
             return
         if self.gotype('next', H_NOP):
             return
Exemple #18
0
 def character(self, c):
     if charnames.has_key(c):
         c = charnames[c]
     try:
         method = getattr(self, 'key_' + c)
     except AttributeError:
         stdwin.fleep()
         return
     method()
def do_copy(window):
	selection = window.textobject.getfocustext()
	if not selection:
		stdwin.fleep()		# Nothing to cut
	elif not window.setselection(WS_PRIMARY, selection):
		stdwin.fleep()		# Window manager glitch...
	else:
		stdwin.rotatecutbuffers(1)
		stdwin.setcutbuffer(0, selection)
Exemple #20
0
	def key_space(self): # traverse
		if self.gotype('menu', H_PUSH) or self.gotype('next', H_NOP):
			return
		while 1:
			if not self.gotype('up', H_POP):
				stdwin.fleep()
				return
			if self.gotype('next', H_NOP):
				return
Exemple #21
0
def but2(win):
	state = win.player.getstatus()[0]
	if state == CD.READY:
		win.player.play(1, 1)
	elif state in (CD.PLAYING, CD.PAUSED):
		win.player.togglepause()
	else:
		stdwin.fleep()
	update(win)
Exemple #22
0
def but2(win):
	state = win.player.getstatus()[0]
	if state == cd.ready:
		win.player.play(1, 1)
	elif state in (cd.playing, cd.paused):
		win.player.togglepause()
	else:
		stdwin.fleep()
	update(win)
Exemple #23
0
	def character(self, c):
		if charnames.has_key(c):
			c = charnames[c]
		try:
			method = getattr(self, 'key_' + c)
		except AttributeError:
			stdwin.fleep()
			return
		method()
Exemple #24
0
def but2(win):
    state = win.player.getstatus()[0]
    if state == CD.READY:
        win.player.play(1, 1)
    elif state in (CD.PLAYING, CD.PAUSED):
        win.player.togglepause()
    else:
        stdwin.fleep()
    update(win)
Exemple #25
0
def idispatch(event):
	type, win, detail = event
	if type == WE_CHAR:
		if not keybindings.has_key(detail):
			detail = string.lower(detail)
		if keybindings.has_key(detail):
			keybindings[detail](win)
			return
		if detail in '0123456789':
			i = eval(detail) - 1
			if i < 0: i = len(win.menu) + i
			if 0 <= i < len(win.menu):
				topic, ref = win.menu[i]
				imove(win, ref)
				return
		stdwin.fleep()
		return
	if type == WE_COMMAND:
		if detail == WC_LEFT:
			iprev(win)
		elif detail == WC_RIGHT:
			inext(win)
		elif detail == WC_UP:
			iup(win)
		elif detail == WC_DOWN:
			idown(win)
		elif detail == WC_BACKSPACE:
			ibackward(win)
		elif detail == WC_RETURN:
			idown(win)
		else:
			stdwin.fleep()
		return
	if type == WE_MENU:
		mp, item = detail
		if mp == None:
			pass # A THINK C console menu was selected
		elif mp in (win.mainmenu, win.navimenu):
			mp.callback[item](win)
		elif mp == win.nodemenu:
			topic, ref = win.menu[item]
			imove(win, ref)
		elif mp == win.footmenu:
			topic, ref = win.footnotes[item]
			imove(win, ref)
		return
	if type == WE_SIZE:
		win.textobj.move((0, 0), win.getwinsize())
		(left, top), (right, bottom) = win.textobj.getrect()
		win.setdocsize(0, bottom)
		return
	if type == WE_CLOSE:
		iclose(win)
		return
	if not win.textobj.event(event):
		pass
Exemple #26
0
def idispatch(event):
    type, win, detail = event
    if type == WE_CHAR:
        if not keybindings.has_key(detail):
            detail = string.lower(detail)
        if keybindings.has_key(detail):
            keybindings[detail](win)
            return
        if detail in '0123456789':
            i = eval(detail) - 1
            if i < 0: i = len(win.menu) + i
            if 0 <= i < len(win.menu):
                topic, ref = win.menu[i]
                imove(win, ref)
                return
        stdwin.fleep()
        return
    if type == WE_COMMAND:
        if detail == WC_LEFT:
            iprev(win)
        elif detail == WC_RIGHT:
            inext(win)
        elif detail == WC_UP:
            iup(win)
        elif detail == WC_DOWN:
            idown(win)
        elif detail == WC_BACKSPACE:
            ibackward(win)
        elif detail == WC_RETURN:
            idown(win)
        else:
            stdwin.fleep()
        return
    if type == WE_MENU:
        mp, item = detail
        if mp == None:
            pass  # A THINK C console menu was selected
        elif mp in (win.mainmenu, win.navimenu):
            mp.callback[item](win)
        elif mp == win.nodemenu:
            topic, ref = win.menu[item]
            imove(win, ref)
        elif mp == win.footmenu:
            topic, ref = win.footnotes[item]
            imove(win, ref)
        return
    if type == WE_SIZE:
        win.textobj.move((0, 0), win.getwinsize())
        (left, top), (right, bottom) = win.textobj.getrect()
        win.setdocsize(0, bottom)
        return
    if type == WE_CLOSE:
        iclose(win)
        return
    if not win.textobj.event(event):
        pass
Exemple #27
0
def ibackward(win):
    lh = stdwin.lineheight()  # XXX Should really use the window's...
    h, v = win.getorigin()
    if v <= 0:
        stdwin.fleep()
        return
    width, height = win.getwinsize()
    increment = max(lh, ((height - 2 * lh) / lh) * lh)
    v = max(0, v - increment)
    win.setorigin(h, v)
Exemple #28
0
def ibackward(win):
	lh = stdwin.lineheight() # XXX Should really use the window's...
	h, v = win.getorigin()
	if v <= 0:
		stdwin.fleep()
		return
	width, height = win.getwinsize()
	increment = max(lh, ((height - 2*lh) / lh) * lh)
	v = max(0, v - increment)
	win.setorigin(h, v)
def do_paste(window):
	selection = stdwin.getselection(WS_PRIMARY)
	if not selection:
		selection = stdwin.getcutbuffer(0)
	if not selection:
		stdwin.fleep()		# Nothing to paste
	else:
		window.textobject.replace(selection)
		window.changed = 1
		fix_docsize(window)
Exemple #30
0
def iforward(win):
    lh = stdwin.lineheight()  # XXX Should really use the window's...
    h, v = win.getorigin()
    docwidth, docheight = win.getdocsize()
    width, height = win.getwinsize()
    if v + height >= docheight:
        stdwin.fleep()
        return
    increment = max(lh, ((height - 2 * lh) / lh) * lh)
    v = v + increment
    win.setorigin(h, v)
Exemple #31
0
def iforward(win):
	lh = stdwin.lineheight() # XXX Should really use the window's...
	h, v = win.getorigin()
	docwidth, docheight = win.getdocsize()
	width, height = win.getwinsize()
	if v + height >= docheight:
		stdwin.fleep()
		return
	increment = max(lh, ((height - 2*lh) / lh) * lh)
	v = v + increment
	win.setorigin(h, v)
Exemple #32
0
	def paste_selection(self):
		if not self.tefocus:
			stdwin.fleep()
			return
		s = stdwin.getselection(WS_PRIMARY)
		if not s:
			s = stdwin.getcutbuffer(0)
			if not s:
				stdwin.fleep()
				return
		self.tefocus.replace(s)
def do_cut(window):
	selection = window.textobject.getfocustext()
	if not selection:
		stdwin.fleep()		# Nothing to cut
	elif not window.setselection(WS_PRIMARY, selection):
		stdwin.fleep()		# Window manager glitch...
	else:
		stdwin.rotatecutbuffers(1)
		stdwin.setcutbuffer(0, selection)
		window.textobject.replace('')
		window.changed = 1
		fix_docsize(window)
Exemple #34
0
def gdiff_ab(w, m, item): # Call SGI's gdiff utility
	x = getselection(w)
	if x:
		a, b = os.path.join(w.a, x), os.path.join(w.b, x)
		if os.path.isdir(a) or os.path.isdir(b):
			stdwin.fleep() # This is for files only
		else:
			diffcmd = 'gdiff'
			diffcmd = diffcmd + mkarg(a) + mkarg(b) + ' &'
			print diffcmd
			sts = os.system(diffcmd)
			if sts: print 'Exit status', sts
Exemple #35
0
 def mouse_down(self, detail):
     (h, v), clicks, button, mask = detail
     i = v / stdwin.lineheight()
     if 0 <= i < len(self.stack):
         if i != self.curindex:
             self.curindex = i
             self.curframe = self.stack[self.curindex][0]
             self.refreshstack()
         elif clicks == 2:
             self.do_frame()
     else:
         stdwin.fleep()
Exemple #36
0
def gdiff_ab(w, m, item): # Call SGI's gdiff utility
	x = getselection(w)
	if x:
		a, b = os.path.join(w.a, x), os.path.join(w.b, x)
		if os.path.isdir(a) or os.path.isdir(b):
			stdwin.fleep() # This is for files only
		else:
			diffcmd = 'gdiff'
			diffcmd = diffcmd + mkarg(a) + mkarg(b) + ' &'
			print diffcmd
			sts = os.system(diffcmd)
			if sts: print 'Exit status', sts
Exemple #37
0
	def mouse_down(self, detail):
		(h, v), clicks, button, mask = detail
		i = v / stdwin.lineheight()
		if 0 <= i < len(self.stack):
			if i != self.curindex:
				self.curindex = i
				self.curframe = self.stack[self.curindex][0]
				self.refreshstack()
			elif clicks == 2:
				self.do_frame()
		else:
			stdwin.fleep()
Exemple #38
0
def ilast(win):
    if not win.last:
        stdwin.fleep()
    else:
        i = len(win.last) - 1
        lastnode, lastfocus = win.last[i]
        imove(win, lastnode)
        if len(win.last) > i + 1:
            # The move succeeded -- restore the focus
            win.textobj.setfocus(lastfocus)
        # Delete the stack top even if the move failed,
        # else the whole stack would remain unreachable
        del win.last[i:]  # Delete the entry pushed by imove as well!
Exemple #39
0
def ilast(win):
	if not win.last:
		stdwin.fleep()
	else:
		i = len(win.last)-1
		lastnode, lastfocus = win.last[i]
		imove(win, lastnode)
		if len(win.last) > i+1:
			# The move succeeded -- restore the focus
			win.textobj.setfocus(lastfocus)
		# Delete the stack top even if the move failed,
		# else the whole stack would remain unreachable
		del win.last[i:] # Delete the entry pushed by imove as well!
Exemple #40
0
def modaldialog(window):
	if window not in windows:
		raise ValueError, 'modaldialog window not registered'
	while window in windows:
		try:
			event = stdwinq.getevent()
		except KeyboardInterrupt:
			event = WE_COMMAND, None, WC_CANCEL
		etype, ewindow, edetail = event
		if etype not in passthrough and ewindow <> window:
			if etype in beeping:
				stdwin.fleep()
			continue
		dispatch(event)
Exemple #41
0
def modaldialog(window):
    if window not in windows:
        raise ValueError, 'modaldialog window not registered'
    while window in windows:
        try:
            event = stdwinq.getevent()
        except KeyboardInterrupt:
            event = WE_COMMAND, None, WC_CANCEL
        etype, ewindow, edetail = event
        if etype not in passthrough and ewindow <> window:
            if etype in beeping:
                stdwin.fleep()
            continue
        dispatch(event)
Exemple #42
0
	def do_list(self):
		fn = self.curframe.f_code.co_filename
		if not self.sourcewindows.has_key(fn):
			import wdbsrcwin
			try:
				self.sourcewindows[fn] = wdbsrcwin. \
					  DebuggerSourceWindow(self, fn)
			except IOError:
				stdwin.fleep()
				return
		w = self.sourcewindows[fn]
		lineno = self.stack[self.curindex][1]
		w.setlineno(lineno)
		w.popup()
Exemple #43
0
 def do_list(self):
     fn = self.curframe.f_code.co_filename
     if not self.sourcewindows.has_key(fn):
         import wdbsrcwin
         try:
             self.sourcewindows[fn] = wdbsrcwin. \
                DebuggerSourceWindow(self, fn)
         except IOError:
             stdwin.fleep()
             return
     w = self.sourcewindows[fn]
     lineno = self.stack[self.curindex][1]
     w.setlineno(lineno)
     w.popup()
Exemple #44
0
def save_hook(self):
	if not G.data:
		stdwin.fleep()
	else:
		prompt = 'Store sampled data on file: '
		try:
			G.savefile = stdwin.askfile(prompt, G.savefile, 1)
		except KeyboardInterrupt:
			return
		try:
			fp = open(G.savefile, 'w')
			fp.write(Magics[G.rate] + G.data)
		except:
			stdwin.message('Cannot create ' + file)
Exemple #45
0
def save_hook(self):
       if not G.data:
               stdwin.fleep()
       else:
               prompt = 'Store sampled data on file: '
               try:
                       G.savefile = stdwin.askfile(prompt, G.savefile, 1)
               except KeyboardInterrupt:
                       return
               try:
                       fp = open(G.savefile, 'w')
                       fp.write(Magics[G.rate] + G.data)
               except:
                       stdwin.message('Cannot create ' + file)
Exemple #46
0
	def setrawdata(self, addr, data):
		if '#' in addr:
			i = string.index(addr, '#')
			addr, anchor = addr[:i], addr[i+1:]
		else:
			anchor = ''
		self.cur_addr = addr
		self.cur_data = data
		#
		self.window.settitle('Formatting ' + addr + ' ...')
		self.window.setorigin(0, 0)
		self.window.setdocsize(0, 0)
		self.window.change((0, 0), (10000, 30000)) # XXX
		#
		# XXX The X11 version here assumes that setdocsize()
		# generates a WE_DRAW event
		b = fmt.StdwinBackEnd(self.window, 0)
		b.d.setfont(htmllib.StdwinStylesheet.stdfontset[0])
		##b = fmt.StdwinBackEnd(self.window, 1) # Mac version
		f = fmt.BaseFormatter(b.d, b)
		p = htmllib.AnchoringParser(f, htmllib.StdwinStylesheet)
		p.feed(self.cur_data)
		p.close()
		b.finish()
		#
		self.cur_backend = b
		self.cur_anchors = p.anchors
		self.cur_anchornames = p.anchornames
		self.cur_anchortypes = p.anchortypes
		self.cur_isindex = p.isindex
		#
		if not places.has_key(self.cur_addr):
			exits = []
		else:
			exits = places[self.cur_addr][1]
		places[self.cur_addr] = (p.title, exits)
		#
		self.command_menu.enable(self.find_index, self.cur_isindex)
		self.make_title()
		self.make_anchors_menu()
		self.window.setwincursor(READYCURSOR)
		#
		if anchor:
			if anchor not in self.cur_anchornames:
				stdwin.fleep() # Anchor not found
				return
			id = 1 + self.cur_anchornames.index(anchor)
			self.cur_backend.showanchor(id)
			return
Exemple #47
0
 def setrawdata(self, addr, data):
     if '#' in addr:
         i = string.index(addr, '#')
         addr, anchor = addr[:i], addr[i + 1:]
     else:
         anchor = ''
     self.cur_addr = addr
     self.cur_data = data
     #
     self.window.settitle('Formatting ' + addr + ' ...')
     self.window.setorigin(0, 0)
     self.window.setdocsize(0, 0)
     self.window.change((0, 0), (10000, 30000))  # XXX
     #
     # XXX The X11 version here assumes that setdocsize()
     # generates a WE_DRAW event
     b = fmt.StdwinBackEnd(self.window, 0)
     b.d.setfont(htmllib.StdwinStylesheet.stdfontset[0])
     ##b = fmt.StdwinBackEnd(self.window, 1) # Mac version
     f = fmt.BaseFormatter(b.d, b)
     p = htmllib.AnchoringParser(f, htmllib.StdwinStylesheet)
     p.feed(self.cur_data)
     p.close()
     b.finish()
     #
     self.cur_backend = b
     self.cur_anchors = p.anchors
     self.cur_anchornames = p.anchornames
     self.cur_anchortypes = p.anchortypes
     self.cur_isindex = p.isindex
     #
     if not places.has_key(self.cur_addr):
         exits = []
     else:
         exits = places[self.cur_addr][1]
     places[self.cur_addr] = (p.title, exits)
     #
     self.command_menu.enable(self.find_index, self.cur_isindex)
     self.make_title()
     self.make_anchors_menu()
     self.window.setwincursor(READYCURSOR)
     #
     if anchor:
         if anchor not in self.cur_anchornames:
             stdwin.fleep()  # Anchor not found
             return
         id = 1 + self.cur_anchornames.index(anchor)
         self.cur_backend.showanchor(id)
         return
Exemple #48
0
	def mouse_down(self, detail):
		(h, v), clicks, button, mask = detail
		if h >= self.leftmargin:
			srcwin.SourceWindow.dispatch(self, \
				(WE_MOUSE_DOWN, self.win, detail))
			return
		lineno = v/self.lineheight + 1
		if 1 <= lineno <= self.linecount:
			if self.debugger.get_break(self.filename, lineno):
				f = self.debugger.clear_break
			else:
				f = self.debugger.set_break
			err = f(self.filename, lineno)
			if err: stdwin.message(err)
			else: self.changemark(lineno)
		else:
			stdwin.fleep()
def settimer(win):
    now = time.time()
    hours, minutes, seconds = win.times = calctime(now)
    delay = 61 - seconds
    win.settimer(10 * delay)
    minutes = minutes + hours * 60
    if win.ring:
        # Is it time to stop the alarm ringing?
        since = (minutes - win.time + 720) % 720
        if since >= 5:
            # Stop it now
            win.ring = 0
        else:
            # Ring again, once every minute
            stdwin.fleep()
    elif win.set and minutes == win.time:
        # Start the alarm ringing
        win.ring = 1
        stdwin.fleep()
Exemple #50
0
def settimer(win):
	now = time.time()
	hours, minutes, seconds = win.times = calctime(now)
	delay = 61 - seconds
	win.settimer(10 * delay)
	minutes = minutes + hours*60
	if win.ring:
		# Is it time to stop the alarm ringing?
		since = (minutes - win.time + 720) % 720
		if since >= 5:
			# Stop it now
			win.ring = 0
		else:
			# Ring again, once every minute
			stdwin.fleep()
	elif win.set and minutes == win.time:
		# Start the alarm ringing
		win.ring = 1
		stdwin.fleep()
Exemple #51
0
def settimer():
       now = getlocaltime()
       G.times = calctime(now)
       delay = 61 - now % 60
       G.w.settimer(10 * delay)
       minutes = (now/60) % 720
       if A.ring:
               # Is it time to stop the alarm ringing?
               since = (minutes - A.time + 720) % 720
               if since >= 5:
                       # Stop it now
                       A.ring = 0
               else:
                       # Ring again, once every minute
                       stdwin.fleep()
       elif A.set and minutes = A.time:
               # Start the alarm ringing
               A.ring = 1
               stdwin.fleep()
Exemple #52
0
def settimer(win):
	now = getlocaltime()
	win.times = calctime(now)
	delay = 61 - now % 60
	win.settimer(10 * delay)
	minutes = (now/60) % 720
	if win.ring:
		# Is it time to stop the alarm ringing?
		since = (minutes - win.time + 720) % 720
		if since >= 5:
			# Stop it now
			win.ring = 0
		else:
			# Ring again, once every minute
			stdwin.fleep()
	elif win.set and minutes == win.time:
		# Start the alarm ringing
		win.ring = 1
		stdwin.fleep()
Exemple #53
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 `)
Exemple #54
0
	def mouse_down(self, detail):
		(h, v), clicks, button, mask = detail
		if clicks != 2:
			return
		i = v / stdwin.lineheight()
		if 5 <= i < len(self.displaylist):
			import string
			name = string.splitfields(self.displaylist[i],' = ')[0]
			if not self.dict.has_key(name):
				stdwin.fleep()
				return
			value = self.dict[name]
			if not hasattr(value, '__dict__'):
				stdwin.fleep()
				return
			name = 'instance ' + `value`
			if self.debugger.framewindows.has_key(name):
				self.debugger.framewindows[name].popup()
			else:
				self.debugger.framewindows[name] = \
					  FrameWindow(self.debugger,
						  self.frame, value.__dict__,
						  name)
			return
		stdwin.fleep()