Esempio n. 1
0
	def __init__(self):
		# For server
		self.server_name = None
		# Windowing state
		self.window = stdwin.open('WWWW - by Guido van Rossum')
		self.window.setwincursor(WAITCURSOR)
		self.last_mouse_down = None
		self.last_msg = ''
		# Current document state
		self.cur_addr = ''
		self.cur_data = ''
		self.cur_anchors = []
		self.cur_anchornames = []
		self.cur_anchortypes = []
		self.cur_isindex = 0
		self.cur_backend = None
		# User state
		self.raw_mode = 0
		# Logging state
		self.history = []
		# Menus
		self.history_menu = None
		self.anchors_menu = None
		self.make_command_menu()
		self.make_bookmarks_menu()
		# Register us for events
		self.window.dispatch = self.dispatch
		mainloop.register(self.window)
		allwindows.append(self)
		# Initialize cur_backend
		self.setrawdata('', '')
Esempio n. 2
0
def open(title):			# Open a generic window
	w = stdwin.open(title)
	stdwin.setdefwinsize(0, 0)
	# Set default event handlers
	w.draw = nop
	w.char = nop
	w.mdown = nop
	w.mmove = nop
	w.mup = nop
	w.m2down = m2down
	w.m2up = m2up
	w.size = nop
	w.move = nop
	w.activate = w.deactivate = nop
	w.timer = nop
	# default command handlers
	w.close = close
	w.tab = tab
	w.enter = enter
	w.backspace = backspace
	w.arrow = arrow
	w.kleft = w.kup = w.kright = w.kdown = nop
	w.dispatch = treatevent
	register(w)
	return w
Esempio n. 3
0
def open(title):  # Open a generic window
    w = stdwin.open(title)
    stdwin.setdefwinsize(0, 0)
    # Set default event handlers
    w.draw = nop
    w.char = nop
    w.mdown = nop
    w.mmove = nop
    w.mup = nop
    w.m2down = m2down
    w.m2up = m2up
    w.size = nop
    w.move = nop
    w.activate = w.deactivate = nop
    w.timer = nop
    # default command handlers
    w.close = close
    w.tab = tab
    w.enter = enter
    w.backspace = backspace
    w.arrow = arrow
    w.kleft = w.kup = w.kright = w.kdown = nop
    w.dispatch = treatevent
    register(w)
    return w
Esempio n. 4
0
	def realize(self):
		if self.win:
			raise Error, 'realize(): called twice'
		if not self.child:
			raise Error, 'realize(): no child'
		# Compute suggested size
		self.size = self.child.getminsize(self.beginmeasuring(), \
						  self.size)
		save_defsize = stdwin.getdefwinsize()
		scrwidth, scrheight = stdwin.getscrsize()
		width, height = self.size
		if width > scrwidth:
			width = scrwidth * 2/3
		if height > scrheight:
			height = scrheight * 2/3
		stdwin.setdefwinsize(width, height)
		self.hbar, self.vbar = stdwin.getdefscrollbars()
		self.win = stdwin.open(self.title)
		stdwin.setdefwinsize(save_defsize)
		self.win.setdocsize(self.size)
		if self.itimer:
			self.win.settimer(self.itimer)
		width, height = self.win.getwinsize()
		if self.hbar:
			width = self.size[0]
		if self.vbar:
			height = self.size[1]
		self.child.setbounds(((0, 0), (width, height)))
		self.child.realize()
		self.win.dispatch = self.dispatch
		mainloop.register(self.win)
Esempio n. 5
0
 def __init__(self):
     # For server
     self.server_name = None
     # Windowing state
     self.window = stdwin.open('WWWW - by Guido van Rossum')
     self.window.setwincursor(WAITCURSOR)
     self.last_mouse_down = None
     self.last_msg = ''
     # Current document state
     self.cur_addr = ''
     self.cur_data = ''
     self.cur_anchors = []
     self.cur_anchornames = []
     self.cur_anchortypes = []
     self.cur_isindex = 0
     self.cur_backend = None
     # User state
     self.raw_mode = 0
     # Logging state
     self.history = []
     # Menus
     self.history_menu = None
     self.anchors_menu = None
     self.make_command_menu()
     self.make_bookmarks_menu()
     # Register us for events
     self.window.dispatch = self.dispatch
     mainloop.register(self.window)
     allwindows.append(self)
     # Initialize cur_backend
     self.setrawdata('', '')
Esempio n. 6
0
def main():
	player = cd.open()
	stdwin.setdefscrollbars(0, 0)
	win = stdwin.open('CD')
	win.player = player
	win.dispatch = cddispatch
	mainloop.register(win)
	win.settimer(10)
	mainloop.mainloop()
Esempio n. 7
0
def main():
    player = cd.open()
    stdwin.setdefscrollbars(0, 0)
    win = stdwin.open('CD')
    win.player = player
    win.dispatch = cddispatch
    mainloop.register(win)
    win.settimer(10)
    mainloop.mainloop()
Esempio n. 8
0
def makewindow():
	stdwin.setdefwinsize(DEFWIDTH, DEFHEIGHT + stdwin.lineheight())
	win = stdwin.open('clock')
	setdimensions(win)
	win.set = 1		# True when alarm is set
	win.time = 11*60 + 40	# Time when alarm must go off
	win.ring = 0		# True when alarm is ringing
	win.dispatch = cdispatch
	mainloop.register(win)
	settimer(win)
	return win
Esempio n. 9
0
def makewindow():
    stdwin.setdefwinsize(DEFWIDTH, DEFHEIGHT + stdwin.lineheight())
    win = stdwin.open("clock")
    setdimensions(win)
    win.set = 1  # True when alarm is set
    win.time = 11 * 60 + 40  # Time when alarm must go off
    win.ring = 0  # True when alarm is ringing
    win.dispatch = cdispatch
    mainloop.register(win)
    settimer(win)
    return win
Esempio n. 10
0
def makewindow():
    # stdwin.setdefscrollbars(0, 1) # Not in Python 0.9.1
    # stdwin.setfont('monaco') # Not on UNIX! and not Python 0.9.1
    # width, height = stdwin.textwidth('in')*40, stdwin.lineheight()*24
    # stdwin.setdefwinsize(width, height)
    win = stdwin.open('Python interpreter ready')
    win.editor = win.textcreate((0, 0), win.getwinsize())
    win.globals = {}  # Dictionary for user's globals
    win.command = ''  # Partially read command
    win.busy = 0  # Ready to accept a command
    win.auto = 1  # [CR] executes command
    win.insertOutput = 1  # Insert output at focus
    win.insertError = 1  # Insert error output at focus
    win.setwincursor('ibeam')
    win.filename = ''  # Empty if no file for this window
    makefilemenu(win)
    makeeditmenu(win)
    win.dispatch = pdispatch  # Event dispatch function
    mainloop.register(win)
    return win
Esempio n. 11
0
def makewindow():
	# stdwin.setdefscrollbars(0, 1) # Not in Python 0.9.1
	# stdwin.setfont('monaco') # Not on UNIX! and not Python 0.9.1
	# width, height = stdwin.textwidth('in')*40, stdwin.lineheight()*24
	# stdwin.setdefwinsize(width, height)
	win = stdwin.open('Python interpreter ready')
	win.editor = win.textcreate((0,0), win.getwinsize())
	win.globals = {}		# Dictionary for user's globals
	win.command = ''		# Partially read command
	win.busy = 0			# Ready to accept a command
	win.auto = 1			# [CR] executes command
	win.insertOutput = 1		# Insert output at focus
	win.insertError = 1		# Insert error output at focus
	win.setwincursor('ibeam')
	win.filename = ''		# Empty if no file for this window
	makefilemenu(win)
	makeeditmenu(win)
	win.dispatch = pdispatch	# Event dispatch function
	mainloop.register(win)
	return win
Esempio n. 12
0
def main():
	delay = DEF_DELAY
	#
	try:
		thisuser = posix.environ['LOGNAME']
	except:
		thisuser = posix.environ['USER']
	#
	printers = sys.argv[1:]
	if printers:
		# Strip '-P' from printer names just in case
		# the user specified it...
		for i in range(len(printers)):
			if printers[i][:2] == '-P':
				printers[i] = printers[i][2:]
	else:
		if posix.environ.has_key('PRINTER'):
			printers = [posix.environ['PRINTER']]
		else:
			printers = [DEF_PRINTER]
	#
	width = stdwin.textwidth('in')*20
	height = len(printers) * stdwin.lineheight() + 5
	stdwin.setdefwinsize(width, height)
	stdwin.setdefscrollbars(0, 0)
	#
	win = stdwin.open('lpwin')
	#
	win.printers = printers
	win.colors = [c_unknown] * len(printers)
	win.texts = printers[:]
	win.next = 0
	win.delay = DEF_DELAY
	win.thisuser = thisuser
	win.dispatch = lpdispatch
	#
	win.settimer(1)
	#
	mainloop.register(win)
	mainloop.mainloop()
Esempio n. 13
0
	def __init__(self, title):
		self.win = stdwin.open(title)
		self.win.dispatch = self.dispatch
		mainloop.register(self.win)