You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(45) |
May
(185) |
Jun
|
Jul
(36) |
Aug
(205) |
Sep
(98) |
Oct
(107) |
Nov
(6) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(1) |
Feb
(2) |
Mar
(19) |
Apr
(26) |
May
(18) |
Jun
|
Jul
(12) |
Aug
(16) |
Sep
(22) |
Oct
(7) |
Nov
(11) |
Dec
(74) |
2006 |
Jan
(14) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(14) |
Jun
(5) |
Jul
(20) |
Aug
(10) |
Sep
(1) |
Oct
|
Nov
(4) |
Dec
(1) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(14) |
Aug
|
Sep
|
Oct
(6) |
Nov
(1) |
Dec
|
From: Kevin A. <ka...@us...> - 2004-08-03 05:41:29
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15956 Modified Files: restEditor.py Log Message: switched to using subclass of CodeEditor Index: restEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/restEditor.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** restEditor.py 26 Jul 2004 15:51:14 -0000 1.1 --- restEditor.py 3 Aug 2004 05:41:21 -0000 1.2 *************** *** 4,27 **** __date__ = "$Date$" - PythonCard Editor (codeEditor) wiki page - http://wiki.wxpython.org/index.cgi/PythonCardEditor - - wxStyledTextCtrl documentation - http://wiki.wxpython.org/index.cgi/wxStyledTextCtrl """ ! from PythonCard import about, configuration, dialog, log, menu, model, resource, util [...1252 lines suppressed...] - # need to decide on a clean way of handling various doc options - fn = os.path.dirname(os.__file__) - fn = os.path.join(fn, os.pardir, "Doc", "Python23.chm") - fn = os.path.normpath(fn) - if os.path.isfile(fn): - os.startfile(fn) - else: - webbrowser.open(help_url) - if __name__ == '__main__': ! app = model.Application(CodeEditor) app.MainLoop() --- 51,56 ---- event.skip() if __name__ == '__main__': ! app = model.Application(RestEditor) app.MainLoop() |
From: Kevin A. <ka...@us...> - 2004-08-03 05:41:05
|
Update of /cvsroot/pythoncard/PythonCard/tools/findfiles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15867 Modified Files: findfiles.py Log Message: fixed bad line endings Index: findfiles.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/findfiles/findfiles.py,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** findfiles.py 22 Jul 2004 21:52:28 -0000 1.79 --- findfiles.py 3 Aug 2004 05:40:53 -0000 1.80 *************** *** 25,31 **** import wx ! # KEA 2004-07-22 # force imports for components used in .rsrc.py file ! # so we can do a make standalones with py2exe and bundlebuilder from PythonCard.components import button, checkbox, combobox, list, statictext, textfield ! LASTGREPFILE = 'findfiles.grep' USERCONFIG = 'user.config.txt' --- 25,32 ---- import wx ! # KEA 2004-07-22 ! # force imports for components used in .rsrc.py file ! # so we can do a make standalones with py2exe and bundlebuilder ! from PythonCard.components import button, checkbox, combobox, list, statictext, textfield LASTGREPFILE = 'findfiles.grep' USERCONFIG = 'user.config.txt' |
From: Kevin A. <ka...@us...> - 2004-07-31 06:28:01
|
Update of /cvsroot/pythoncard/PythonCard/samples/conversions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv579/samples/conversions Modified Files: conversions.rsrc.py Log Message: tweaks for mac Index: conversions.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/conversions/conversions.rsrc.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** conversions.rsrc.py 10 May 2004 05:02:06 -0000 1.9 --- conversions.rsrc.py 31 Jul 2004 06:27:51 -0000 1.10 *************** *** 48,70 **** { 'type':'StaticLine', 'name':'staticlineH', 'position':(0, 0), 'size':(400, -1)}, { 'type':'StaticText', 'name':'labelUp', 'position':(5, 5), 'text': 'one'}, ! { 'type':'StaticText', 'name':'labelDown', 'position':(5, 160), 'text': 'two'}, { 'type':'TextArea', 'name':'field1', ! 'position':(0, 20), 'size':(390, 100), 'text':'' }, { 'type':'TextArea', 'name':'field2', ! 'position':(0, 180), 'size':(390, 100), 'text':'' }, { 'type':'Button', 'name':'btnConvertUp', ! 'position':(175, 155), 'size':(200, -1), 'label':'Convert to' }, { 'type':'Button', 'name':'btnConvertDown', ! 'position':(175, 125), 'size':(200, -1), 'label':'Convert to' }, --- 48,70 ---- { 'type':'StaticLine', 'name':'staticlineH', 'position':(0, 0), 'size':(400, -1)}, { 'type':'StaticText', 'name':'labelUp', 'position':(5, 5), 'text': 'one'}, ! { 'type':'StaticText', 'name':'labelDown', 'position':(5, 165), 'text': 'two'}, { 'type':'TextArea', 'name':'field1', ! 'position':(5, 25), 'size':(390, 100), 'text':'' }, { 'type':'TextArea', 'name':'field2', ! 'position':(5, 190), 'size':(390, 100), 'text':'' }, { 'type':'Button', 'name':'btnConvertUp', ! 'position':(175, 160), 'size':(200, -1), 'label':'Convert to' }, { 'type':'Button', 'name':'btnConvertDown', ! 'position':(175, 130), 'size':(200, -1), 'label':'Convert to' }, |
From: Kevin A. <ka...@us...> - 2004-07-30 14:17:40
|
Update of /cvsroot/pythoncard/PythonCard/samples/moderator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17954 Modified Files: moderator.py moderator.rsrc.py Log Message: modified layout to work better on Mac, added AddSpeaker button Index: moderator.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/moderator/moderator.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** moderator.py 5 May 2004 16:53:27 -0000 1.3 --- moderator.py 30 Jul 2004 14:17:31 -0000 1.4 *************** *** 7,15 **** import sys ! from PythonCard import model, timer # maximum time per speaker in seconds ! MAX_TIME = 180 ! DELEGATE_FILE = "delegates.txt" class Moderator(model.Background): --- 7,15 ---- import sys ! from PythonCard import dialog, model, timer # maximum time per speaker in seconds ! MAX_TIME = 5 * 60 ! #MAX_TIME = 180 DELEGATE_FILE = "delegates.txt" class Moderator(model.Background): *************** *** 86,89 **** --- 86,99 ---- self.components.txtTime.text = self.clockModel.readout() + def on_btnAddSpeaker_mouseClick(self, event): + result = dialog.textEntryDialog(self, 'Add Speaker', 'Speaker:', 'First Last') + if result['accepted']: + #returned = result['returned'] + text = result['text'] + #self.components.lstDelegates.append(text) + self.delegates.add(text.strip()) + self.update() + + class CountdownClockModel: def __init__(self, max): Index: moderator.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/moderator/moderator.rsrc.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** moderator.rsrc.py 10 May 2004 05:02:20 -0000 1.3 --- moderator.rsrc.py 30 Jul 2004 14:17:31 -0000 1.4 *************** *** 25,28 **** --- 25,35 ---- 'components': [ + {'type':'Button', + 'name':'btnAddSpeaker', + 'position':(250, 539), + 'size':(151, -1), + 'label':'Add Speaker', + }, + {'type':'List', 'name':'lstDelegates', *************** *** 44,69 **** 'name':'btnPause', 'position':(106, 91), ! 'size':(99, 38), ! 'font':{'faceName': 'Microsoft Sans Serif', 'family': 'sansSerif', 'size': 16}, 'label':'Pause', }, - {'type':'StaticBox', - 'name':'StaticBox3', - 'position':(6, 138), - 'size':(421, 410), - }, - - {'type':'StaticBox', - 'name':'StaticBox1', - 'position':(6, -4), - 'size':(421, 150), - }, - {'type':'Button', 'name':'btnNext', 'position':(244, 90), ! 'size':(151, 38), ! 'font':{'faceName': 'Microsoft Sans Serif', 'family': 'sansSerif', 'size': 16}, 'label':'Next Speaker', }, --- 51,62 ---- 'name':'btnPause', 'position':(106, 91), ! 'size':(99, -1), 'label':'Pause', }, {'type':'Button', 'name':'btnNext', 'position':(244, 90), ! 'size':(151, -1), 'label':'Next Speaker', }, *************** *** 85,89 **** 'position':(16, 23), 'size':(378, 43), ! 'editable':0, 'font':{'faceName': 'Microsoft Sans Serif', 'family': 'sansSerif', 'size': 22}, }, --- 78,82 ---- 'position':(16, 23), 'size':(378, 43), ! 'editable':False, 'font':{'faceName': 'Microsoft Sans Serif', 'family': 'sansSerif', 'size': 22}, }, *************** *** 91,95 **** {'type':'StaticText', 'name':'lblSpeaking', ! 'position':(17, 7), 'text':'Now Speaking:', }, --- 84,88 ---- {'type':'StaticText', 'name':'lblSpeaking', ! 'position':(17, -1), 'text':'Now Speaking:', }, *************** *** 98,102 **** 'name':'lblTimeLeft', 'position':(18, 71), ! 'size':(203, 11), 'text':'Time Left:', }, --- 91,95 ---- 'name':'lblTimeLeft', 'position':(18, 71), ! 'size':(203, -1), 'text':'Time Left:', }, *************** *** 106,110 **** 'position':(16, 89), 'size':(79, 42), ! 'editable':0, 'font':{'faceName': 'Microsoft Sans Serif', 'family': 'sansSerif', 'size': 24}, 'text':'3:00', --- 99,103 ---- 'position':(16, 89), 'size':(79, 42), ! 'editable':False, 'font':{'faceName': 'Microsoft Sans Serif', 'family': 'sansSerif', 'size': 24}, 'text':'3:00', |
From: Kevin A. <ka...@us...> - 2004-07-28 17:06:03
|
Update of /cvsroot/pythoncard/PythonCard/samples/webserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15814 Modified Files: webserver.py Added Files: oldModsWebserver.py Log Message: moved old patched code to oldModsWebserver.py Index: webserver.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/webserver/webserver.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** webserver.py 10 May 2004 00:45:23 -0000 1.24 --- webserver.py 28 Jul 2004 17:05:54 -0000 1.25 *************** *** 71,394 **** return tail.lower() in self.cgi_extensions - # this is a modification to run_cgi in CGIHTTPRequestHandler - # to deal with the IE POST bug which should get fixed in - # Python 2.2.2 and 2.3 - # the only additions are under the comment starting with KEA - def run_cgi(self): - """Execute a CGI script.""" - dir, rest = self.cgi_info - i = rest.rfind('?') - if i >= 0: - rest, query = rest[:i], rest[i+1:] - else: - query = '' - i = rest.find('/') - if i >= 0: - script, rest = rest[:i], rest[i:] - else: - script, rest = rest, '' - scriptname = dir + '/' + script - scriptfile = self.translate_path(scriptname) - if not os.path.exists(scriptfile): - self.send_error(404, "No such CGI script (%s)" % `scriptname`) - return - if not os.path.isfile(scriptfile): - self.send_error(403, "CGI script is not a plain file (%s)" % - `scriptname`) - return - ispy = self.is_python(scriptname) - if not ispy: - if not (self.have_fork or self.have_popen2 or self.have_popen3): - self.send_error(403, "CGI script is not a Python script (%s)" % - `scriptname`) - return - # KEA 2002-09-17 - # it is a pain to have to chmod on CGIs - # and this is a personal server, so skip this check - #if not self.is_executable(scriptfile): - # self.send_error(403, "CGI script is not executable (%s)" % - # `scriptname`) - # return - - # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html - # XXX Much of the following could be prepared ahead of time! - env = {} - env['SERVER_SOFTWARE'] = self.version_string() - env['SERVER_NAME'] = self.server.server_name - env['GATEWAY_INTERFACE'] = 'CGI/1.1' - env['SERVER_PROTOCOL'] = self.protocol_version - env['SERVER_PORT'] = str(self.server.server_port) - env['REQUEST_METHOD'] = self.command - uqrest = urllib.unquote(rest) - env['PATH_INFO'] = uqrest - env['PATH_TRANSLATED'] = self.translate_path(uqrest) - env['SCRIPT_NAME'] = scriptname - if query: - env['QUERY_STRING'] = query - host = self.address_string() - if host != self.client_address[0]: - env['REMOTE_HOST'] = host - env['REMOTE_ADDR'] = self.client_address[0] - # XXX AUTH_TYPE - # XXX REMOTE_USER - # XXX REMOTE_IDENT - if self.headers.typeheader is None: - env['CONTENT_TYPE'] = self.headers.type - else: - env['CONTENT_TYPE'] = self.headers.typeheader - length = self.headers.getheader('content-length') - if length: - env['CONTENT_LENGTH'] = length - accept = [] - for line in self.headers.getallmatchingheaders('accept'): - if line[:1] in "\t\n\r ": - accept.append(line.strip()) - else: - accept = accept + line[7:].split(',') - env['HTTP_ACCEPT'] = ','.join(accept) - ua = self.headers.getheader('user-agent') - if ua: - env['HTTP_USER_AGENT'] = ua - co = filter(None, self.headers.getheaders('cookie')) - if co: - env['HTTP_COOKIE'] = ', '.join(co) - # XXX Other HTTP_* headers - if self.have_fork: - # KEA 2002-09-15 - # make sure CGIs have access to os.environ - env.update(os.environ) - else: - # Since we're setting the env in the parent, provide empty - # values to override previously set values - for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', - 'HTTP_USER_AGENT', 'HTTP_COOKIE'): - env.setdefault(k, "") - - self.send_response(200, "Script output follows") - - decoded_query = query.replace('+', ' ') - - if self.have_fork: - # Unix -- fork as we should - args = [script] - if '=' not in decoded_query: - args.append(decoded_query) - # KEA 2002-09-15 - # we want to run as the same user - # that started the server so we have access - # to their files - #nobody = CGIHTTPServer.nobody_uid() - # KEA - # not supposed to flush on Mac OS X - #self.rfile.flush() # Always flush before forking - self.wfile.flush() # Always flush before forking - pid = os.fork() - if pid != 0: - # Parent - pid, sts = os.waitpid(pid, 0) - # throw away additional data [see bug #427345] - while select.select([self.rfile], [], [], 0)[0]: - waste = self.rfile.read(1) - if sts: - self.log_error("CGI script exit status %#x", sts) - return - # Child - try: - # KEA 2002-09-15 - # see nobody comment above - #try: - # os.setuid(nobody) - #except os.error: - # pass - os.dup2(self.rfile.fileno(), 0) - os.dup2(self.wfile.fileno(), 1) - os.execve(scriptfile, args, env) - except: - self.server.handle_error(self.request, self.client_address) - os._exit(127) - - elif self.have_popen2 or self.have_popen3: - # Windows -- use popen2 or popen3 to create a subprocess - import shutil - if self.have_popen3: - popenx = os.popen3 - else: - popenx = os.popen2 - os.environ.update(env) - cmdline = scriptfile - if self.is_python(scriptfile): - interp = sys.executable - if interp.lower().endswith("w.exe"): - # On Windows, use python.exe, not pythonw.exe - interp = interp[:-5] + interp[-4:] - cmdline = "%s -u %s" % (interp, cmdline) - if '=' not in query and '"' not in query: - cmdline = '%s "%s"' % (cmdline, query) - self.log_message("command: %s", cmdline) - try: - nbytes = int(length) - except: - nbytes = 0 - files = popenx(cmdline, 'b') - fi = files[0] - fo = files[1] - if self.have_popen3: - fe = files[2] - if self.command.lower() == "post" and nbytes > 0: - data = self.rfile.read(nbytes) - fi.write(data) - # KEA now throw away data past Content-length - while select.select([self.rfile._sock], [], [], 0)[0] != []: - waste = self.rfile._sock.recv(1) - fi.close() - shutil.copyfileobj(fo, self.wfile) - if self.have_popen3: - errors = fe.read() - fe.close() - if errors: - self.log_error('%s', errors) - sts = fo.close() - if sts: - self.log_error("CGI script exit status %#x", sts) - else: - self.log_message("CGI script exited OK") - - else: - # Other O.S. -- execute script in this process - os.environ.update(env) - save_argv = sys.argv - save_stdin = sys.stdin - save_stdout = sys.stdout - save_stderr = sys.stderr - try: - try: - sys.argv = [scriptfile] - if '=' not in decoded_query: - sys.argv.append(decoded_query) - sys.stdout = self.wfile - sys.stdin = self.rfile - execfile(scriptfile, {"__name__": "__main__"}) - finally: - sys.argv = save_argv - sys.stdin = save_stdin - sys.stdout = save_stdout - sys.stderr = save_stderr - except SystemExit, sts: - self.log_error("CGI script exit status %s", str(sts)) - else: - self.log_message("CGI script exited OK") - - # replacement for SimpleHTTPServer.SimpleHTTPRequestHandler.send_head - # which should eventually make its way back into the - # SimpleHTTPServer in Python 2.2.2 and 2.3 - # this version handles If-Modified-Since and 304 responses and - # sends the Content-Length - def send_head(self): - """Common code for GET and HEAD commands. - - This sends the response code and MIME headers. - - Return value is either a file object (which has to be copied - to the outputfile by the caller unless the command was HEAD, - and must be closed by the caller under all circumstances), or - None, in which case the caller has nothing further to do. - - """ - """Version of send_head that support CGI scripts""" - ## print self.command - ## print self.request_version - ## print self.path - ## print self.headers - - if self.is_cgi(): - return self.run_cgi() - #else: - # return SimpleHTTPServer.SimpleHTTPRequestHandler.send_head(self) - - path = self.translate_path(self.path) - f = None - if os.path.isdir(path): - for index in "index.html", "index.htm": - index = os.path.join(path, index) - if os.path.exists(index): - path = index - break - else: - return self.list_directory(path) - ctype = self.guess_type(path) - - if ctype.startswith('text/'): - mode = 'r' - else: - mode = 'rb' - try: - f = open(path, mode) - except IOError: - self.send_error(404, "File not found") - return None - - try: - s = os.stat(path) - # the os.stat modified time should be local - # mdt is only used for comparisons below now - mdt = time.gmtime(s[8]) - lastModified = date_time_string(s[8]) - size = str(s[6]) - except: - mdt = None - lastModified = None - size = None - - ims = self.headers.getheader('if-modified-since') - not_modified = 0 - if ims and mdt: - # items 6, 7, 8 of parsedate will be usable - # so those aren't used in the comparison below - # see http://www.python.org/doc/current/lib/module-rfc822.html - sdt = rfc822.parsedate(ims.split(';')[0]) - if mdt[:6] <= sdt[:6]: - not_modified = 1 - # don't send back a file if 304 - f = None - if not_modified: - self.send_response(304) - else: - # note that send_response doesn't currently - # accept an optional size parameter, so it can't - # pass on the size to log_request - # I've provided a backward-compatible version below that uses - # a named argument - self.send_response(200, size=size) - if lastModified: - self.send_header("Last-Modified", lastModified) - if size: - self.send_header("Content-Length", size) - self.send_header("Content-type", ctype) - self.end_headers() - return f - - # replacement for send_response in BaseHTTPRequestHandler - # that accepts a named size parameter - def send_response(self, code, message=None, size=None): - """Send the response header and log the response code. - - Also send two standard headers with the server software - version and the current date. - - """ - if size: - self.log_request(code, size) - else: - self.log_request(code) - if message is None: - if code in self.responses: - message = self.responses[code][0] - else: - message = '' - if self.request_version != 'HTTP/0.9': - self.wfile.write("%s %s %s\r\n" % - (self.protocol_version, str(code), message)) - self.send_header('Server', self.version_string()) - self.send_header('Date', self.date_time_string()) class WebServer(HTTPServer): --- 71,74 ---- --- NEW FILE: oldModsWebserver.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/07/28 17:05:54 $" """ import wx from PythonCard import configuration, model import os, sys import shutil from BaseHTTPServer import HTTPServer import CGIHTTPServer from CGIHTTPServer import CGIHTTPRequestHandler import threading import Queue import ConfigParser import socket # imports needed code is moved back into standard libs import urllib import select CONFIG_FILE = 'webserver.ini' # a backwards compatible date_time_string function # with the one in BaseHTTPRequestHandler # it seems like this should be moved and made a function # as I've done below import time import rfc822 weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] monthname = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] def date_time_string(t=None): global weekdayname, monthname """Return the current date and time formatted for a message header.""" if not t: t = time.time() # assume user supplied time value will be local, not gmt! year, month, day, hh, mm, ss, wd, y, z = time.gmtime(t) s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( weekdayname[wd], day, monthname[month], year, hh, mm, ss) return s class MyRequestHandler(CGIHTTPRequestHandler): # the server variable contains the reference back to the view def log_message(self, format, *args): msg = "%s - - [%s] %s\n" % (self.address_string(), self.log_date_time_string(), format%args) if format.startswith('"%s"'): self.server._notify_window.msgQueue.put(msg) wx.WakeUpIdle() # just log to the GUI now, this could go to a file as well else: # don't put CGI error and exit status messages in the main log print msg cgi_extensions = [".py", ".pyw", ".cgi"] def is_python(self, path): """Test whether argument path is a Python script.""" head, tail = os.path.splitext(path) return tail.lower() in self.cgi_extensions # this is a modification to run_cgi in CGIHTTPRequestHandler # to deal with the IE POST bug which should get fixed in # Python 2.2.2 and 2.3 # the only additions are under the comment starting with KEA def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return ispy = self.is_python(scriptname) if not ispy: if not (self.have_fork or self.have_popen2 or self.have_popen3): self.send_error(403, "CGI script is not a Python script (%s)" % `scriptname`) return # KEA 2002-09-17 # it is a pain to have to chmod on CGIs # and this is a personal server, so skip this check #if not self.is_executable(scriptfile): # self.send_error(403, "CGI script is not executable (%s)" % # `scriptname`) # return # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html # XXX Much of the following could be prepared ahead of time! env = {} env['SERVER_SOFTWARE'] = self.version_string() env['SERVER_NAME'] = self.server.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PROTOCOL'] = self.protocol_version env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_METHOD'] = self.command uqrest = urllib.unquote(rest) env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname if query: env['QUERY_STRING'] = query host = self.address_string() if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] # XXX AUTH_TYPE # XXX REMOTE_USER # XXX REMOTE_IDENT if self.headers.typeheader is None: env['CONTENT_TYPE'] = self.headers.type else: env['CONTENT_TYPE'] = self.headers.typeheader length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length accept = [] for line in self.headers.getallmatchingheaders('accept'): if line[:1] in "\t\n\r ": accept.append(line.strip()) else: accept = accept + line[7:].split(',') env['HTTP_ACCEPT'] = ','.join(accept) ua = self.headers.getheader('user-agent') if ua: env['HTTP_USER_AGENT'] = ua co = filter(None, self.headers.getheaders('cookie')) if co: env['HTTP_COOKIE'] = ', '.join(co) # XXX Other HTTP_* headers if self.have_fork: # KEA 2002-09-15 # make sure CGIs have access to os.environ env.update(os.environ) else: # Since we're setting the env in the parent, provide empty # values to override previously set values for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', 'HTTP_USER_AGENT', 'HTTP_COOKIE'): env.setdefault(k, "") self.send_response(200, "Script output follows") decoded_query = query.replace('+', ' ') if self.have_fork: # Unix -- fork as we should args = [script] if '=' not in decoded_query: args.append(decoded_query) # KEA 2002-09-15 # we want to run as the same user # that started the server so we have access # to their files #nobody = CGIHTTPServer.nobody_uid() # KEA # not supposed to flush on Mac OS X #self.rfile.flush() # Always flush before forking self.wfile.flush() # Always flush before forking pid = os.fork() if pid != 0: # Parent pid, sts = os.waitpid(pid, 0) # throw away additional data [see bug #427345] while select.select([self.rfile], [], [], 0)[0]: waste = self.rfile.read(1) if sts: self.log_error("CGI script exit status %#x", sts) return # Child try: # KEA 2002-09-15 # see nobody comment above #try: # os.setuid(nobody) #except os.error: # pass os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) os.execve(scriptfile, args, env) except: self.server.handle_error(self.request, self.client_address) os._exit(127) elif self.have_popen2 or self.have_popen3: # Windows -- use popen2 or popen3 to create a subprocess import shutil if self.have_popen3: popenx = os.popen3 else: popenx = os.popen2 os.environ.update(env) cmdline = scriptfile if self.is_python(scriptfile): interp = sys.executable if interp.lower().endswith("w.exe"): # On Windows, use python.exe, not pythonw.exe interp = interp[:-5] + interp[-4:] cmdline = "%s -u %s" % (interp, cmdline) if '=' not in query and '"' not in query: cmdline = '%s "%s"' % (cmdline, query) self.log_message("command: %s", cmdline) try: nbytes = int(length) except: nbytes = 0 files = popenx(cmdline, 'b') fi = files[0] fo = files[1] if self.have_popen3: fe = files[2] if self.command.lower() == "post" and nbytes > 0: data = self.rfile.read(nbytes) fi.write(data) # KEA now throw away data past Content-length while select.select([self.rfile._sock], [], [], 0)[0] != []: waste = self.rfile._sock.recv(1) fi.close() shutil.copyfileobj(fo, self.wfile) if self.have_popen3: errors = fe.read() fe.close() if errors: self.log_error('%s', errors) sts = fo.close() if sts: self.log_error("CGI script exit status %#x", sts) else: self.log_message("CGI script exited OK") else: # Other O.S. -- execute script in this process os.environ.update(env) save_argv = sys.argv save_stdin = sys.stdin save_stdout = sys.stdout save_stderr = sys.stderr try: try: sys.argv = [scriptfile] if '=' not in decoded_query: sys.argv.append(decoded_query) sys.stdout = self.wfile sys.stdin = self.rfile execfile(scriptfile, {"__name__": "__main__"}) finally: sys.argv = save_argv sys.stdin = save_stdin sys.stdout = save_stdout sys.stderr = save_stderr except SystemExit, sts: self.log_error("CGI script exit status %s", str(sts)) else: self.log_message("CGI script exited OK") # replacement for SimpleHTTPServer.SimpleHTTPRequestHandler.send_head # which should eventually make its way back into the # SimpleHTTPServer in Python 2.2.2 and 2.3 # this version handles If-Modified-Since and 304 responses and # sends the Content-Length def send_head(self): """Common code for GET and HEAD commands. This sends the response code and MIME headers. Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in which case the caller has nothing further to do. """ """Version of send_head that support CGI scripts""" ## print self.command ## print self.request_version ## print self.path ## print self.headers if self.is_cgi(): return self.run_cgi() #else: # return SimpleHTTPServer.SimpleHTTPRequestHandler.send_head(self) path = self.translate_path(self.path) f = None if os.path.isdir(path): for index in "index.html", "index.htm": index = os.path.join(path, index) if os.path.exists(index): path = index break else: return self.list_directory(path) ctype = self.guess_type(path) if ctype.startswith('text/'): mode = 'r' else: mode = 'rb' try: f = open(path, mode) except IOError: self.send_error(404, "File not found") return None try: s = os.stat(path) # the os.stat modified time should be local # mdt is only used for comparisons below now mdt = time.gmtime(s[8]) lastModified = date_time_string(s[8]) size = str(s[6]) except: mdt = None lastModified = None size = None ims = self.headers.getheader('if-modified-since') not_modified = 0 if ims and mdt: # items 6, 7, 8 of parsedate will be usable # so those aren't used in the comparison below # see http://www.python.org/doc/current/lib/module-rfc822.html sdt = rfc822.parsedate(ims.split(';')[0]) if mdt[:6] <= sdt[:6]: not_modified = 1 # don't send back a file if 304 f = None if not_modified: self.send_response(304) else: # note that send_response doesn't currently # accept an optional size parameter, so it can't # pass on the size to log_request # I've provided a backward-compatible version below that uses # a named argument self.send_response(200, size=size) if lastModified: self.send_header("Last-Modified", lastModified) if size: self.send_header("Content-Length", size) self.send_header("Content-type", ctype) self.end_headers() return f # replacement for send_response in BaseHTTPRequestHandler # that accepts a named size parameter def send_response(self, code, message=None, size=None): """Send the response header and log the response code. Also send two standard headers with the server software version and the current date. """ if size: self.log_request(code, size) else: self.log_request(code) if message is None: if code in self.responses: message = self.responses[code][0] else: message = '' if self.request_version != 'HTTP/0.9': self.wfile.write("%s %s %s\r\n" % (self.protocol_version, str(code), message)) self.send_header('Server', self.version_string()) self.send_header('Date', self.date_time_string()) class WebServer(HTTPServer): def __init__(self, notify_window, server_address, RequestHandlerClass, validIPList=None): self._notify_window = notify_window # this list will come from a config file # and there will be a dialog to edit the valid IP addresses if validIPList: self.validIPList = validIPList else: self.validIPList = ['127.0.0.1'] # add host IP address that this server is running on self.validIPList.append(socket.gethostbyname(socket.gethostname())) self.allowAny = 0 HTTPServer.__init__(self, server_address, RequestHandlerClass) def verify_request(self, request, client_address): if self.allowAny or client_address[0] in self.validIPList: return 1 else: return 0 # just a guess that this is how we should use threads def server(self): self.serve_forever() class WebServerView(model.Background): def on_initialize(self, event): self.initSizers() self.loadConfig() # if you wanted to limit the on screen log size, then set # this to something other than 0 self.maxSizeLog = 0 # Set up event handler for any worker thread results """ Robin said: The Queue class is thread-safe, using a mutex and semaphore to protect access to its contents, so is ideally suited for something like this. """ self.msgQueue = Queue.Queue() os.chdir(self.htdocs) self.srvraddr = ('', self.port) # give the server and request handlers # a reference back to the view for logging self.webServer = WebServer(self, self.srvraddr, MyRequestHandler, self.validIPList) self.thread = threading.Thread(target = self.webServer.server) # I think this allows Python to kill the thread when we quit wxPython # setDaemon must be called before start self.thread.setDaemon(1) self.thread.start() def loadConfig(self): self.configPath = os.path.join(configuration.homedir, 'webserver') if not os.path.exists(self.configPath): os.mkdir(self.configPath) configPath = os.path.join(self.configPath, CONFIG_FILE) defaultPath = os.path.join(self.application.applicationDirectory, CONFIG_FILE) if not os.path.exists(configPath): shutil.copy2(defaultPath, configPath) parser = ConfigParser.ConfigParser() parser.read(configPath) self.htdocs = parser.get('ConfigData', 'htdocs') self.port = int(parser.get('ConfigData', 'port')) ips = parser.get('ConfigData', 'iplist') self.validIPList = ips.split(',') def initSizers(self): sizer1 = wx.BoxSizer(wx.VERTICAL) sizer1.Add(self.components.fldLog, 1, wx.EXPAND) sizer1.Fit(self) sizer1.SetSizeHints(self) self.panel.SetSizer(sizer1) self.panel.SetAutoLayout(1) self.panel.Layout() def on_idle(self, event): if not self.msgQueue.empty(): msg = self.msgQueue.get() self.doLogResult(msg) event.RequestMore() def doLogResult(self, data): if data is not None: # code borrowed from the Message Watcher event history display log = self.components.fldLog log.SetReadOnly(0) if self.maxSizeLog and log.GetLength() > self.maxSizeLog: # delete many lines at once to reduce overhead text = log.GetText() endDel = text.index('\n', self.maxSizeLog / 10) + 1 log.SetTargetStart(0) log.SetTargetEnd(endDel) log.ReplaceTarget("") log.GotoPos(log.GetLength()) log.AddText(data) log.GotoPos(log.GetLength()) log.SetReadOnly(1) else: pass def on_menuOptionsAllowAny_select(self, event): self.webServer.allowAny = self.menuBar.getChecked('menuOptionsAllowAny') if __name__ == '__main__': app = model.Application(WebServerView) app.MainLoop() |
From: Kevin A. <ka...@us...> - 2004-07-28 16:04:29
|
Update of /cvsroot/pythoncard/PythonCard/samples/webserver/html/cgi-bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4766 Modified Files: contacts.py file_upload.py testenv.py Log Message: switch to /usr/bin/python Index: contacts.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/webserver/html/cgi-bin/contacts.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** contacts.py 8 Apr 2004 20:56:57 -0000 1.5 --- contacts.py 28 Jul 2004 16:04:18 -0000 1.6 *************** *** 1,3 **** ! #!/usr/local/bin/python import os, sys --- 1,3 ---- ! #!/usr/bin/python import os, sys Index: testenv.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/webserver/html/cgi-bin/testenv.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testenv.py 17 Jun 2002 17:33:09 -0000 1.3 --- testenv.py 28 Jul 2004 16:04:18 -0000 1.4 *************** *** 1,3 **** ! #!/usr/local/bin/python print "Content-type: text/html\r\n\r\n", print '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' --- 1,3 ---- ! #!/usr/bin/python print "Content-type: text/html\r\n\r\n", print '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' Index: file_upload.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/webserver/html/cgi-bin/file_upload.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** file_upload.py 9 Sep 2002 00:26:38 -0000 1.1 --- file_upload.py 28 Jul 2004 16:04:18 -0000 1.2 *************** *** 1,3 **** ! #!/usr/local/bin/python import cgi, sys, os --- 1,3 ---- ! #!/usr/bin/python import cgi, sys, os |
From: Kevin A. <ka...@us...> - 2004-07-28 15:34:39
|
Update of /cvsroot/pythoncard/PythonCard/samples/tictactoe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31349/samples/tictactoe Modified Files: tictactoe.py Log Message: added event.skip() so New Game button still works Index: tictactoe.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/tictactoe/tictactoe.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tictactoe.py 28 Jul 2004 07:12:49 -0000 1.20 --- tictactoe.py 28 Jul 2004 15:34:30 -0000 1.21 *************** *** 194,197 **** --- 194,199 ---- print "illegal move" # play a beep or do some other warning, a dialog would be too much + else: + event.skip() def on_btn0_mouseUp(self, event): |
From: Kevin A. <ka...@us...> - 2004-07-28 07:21:41
|
Update of /cvsroot/pythoncard/PythonCard/samples/slideshow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22735/samples/slideshow Modified Files: slideshow.py Log Message: fixed pictureViewer launching on Mac Index: slideshow.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/slideshow/slideshow.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** slideshow.py 17 Jul 2004 17:46:24 -0000 1.39 --- slideshow.py 28 Jul 2004 07:21:32 -0000 1.40 *************** *** 442,446 **** #print "image", path try: ! viewer = os.path.join('..', 'pictureViewer', 'pictureViewer.py') if " " in path: path = '"' + path + '"' --- 442,446 ---- #print "image", path try: ! viewer = os.path.abspath(os.path.join('..', 'pictureViewer', 'pictureViewer.py')) if " " in path: path = '"' + path + '"' |
From: Kevin A. <ka...@us...> - 2004-07-28 07:12:58
|
Update of /cvsroot/pythoncard/PythonCard/samples/tictactoe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21141 Modified Files: tictactoe.py tictactoe.rsrc.py Log Message: switched to Image and mouseUp handlers Index: tictactoe.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/tictactoe/tictactoe.rsrc.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tictactoe.rsrc.py 10 May 2004 05:02:45 -0000 1.7 --- tictactoe.rsrc.py 28 Jul 2004 07:12:49 -0000 1.8 *************** *** 34,54 **** { 'type':'StaticText', 'name':'staticTurn', 'position':( 150, 400 ), 'size':(100, 30), 'text': '', 'alignment':'center', 'backgroundColor':'white' }, ! { 'type':'ImageButton', 'name':'btn0', 'position':( 20, 20 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'ImageButton', 'name':'btn1', 'position':( 140, 20 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'ImageButton', 'name':'btn2', 'position':( 260, 20 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'ImageButton', 'name':'btn3', 'position':( 20, 140 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'ImageButton', 'name':'btn4', 'position':( 140, 140 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'ImageButton', 'name':'btn5', 'position':( 260, 140 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'ImageButton', 'name':'btn6', 'position':( 20, 260 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'ImageButton', 'name':'btn7', 'position':( 140, 260 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'ImageButton', 'name':'btn8', 'position':( 260, 260 ), 'size':(-2,-2), 'file':'empty.gif'} ] } --- 34,54 ---- { 'type':'StaticText', 'name':'staticTurn', 'position':( 150, 400 ), 'size':(100, 30), 'text': '', 'alignment':'center', 'backgroundColor':'white' }, ! { 'type':'Image', 'name':'btn0', 'position':( 20, 20 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'Image', 'name':'btn1', 'position':( 140, 20 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'Image', 'name':'btn2', 'position':( 260, 20 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'Image', 'name':'btn3', 'position':( 20, 140 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'Image', 'name':'btn4', 'position':( 140, 140 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'Image', 'name':'btn5', 'position':( 260, 140 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'Image', 'name':'btn6', 'position':( 20, 260 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'Image', 'name':'btn7', 'position':( 140, 260 ), 'size':(-2,-2), 'file':'empty.gif'}, ! { 'type':'Image', 'name':'btn8', 'position':( 260, 260 ), 'size':(-2,-2), 'file':'empty.gif'} ] } Index: tictactoe.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/tictactoe/tictactoe.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tictactoe.py 5 May 2004 16:53:48 -0000 1.19 --- tictactoe.py 28 Jul 2004 07:12:49 -0000 1.20 *************** *** 179,188 **** return 0 ! def on_mouseClick(self, event): # make sure that we only handle a mouseClick for # the ImageButtons on the playfield if self.isPlayfieldButton(event.target): btnName = event.target.name ! print "bg1 mouseClick handler", btnName pos = int(btnName[3]) #print event.target.getName(), 'clicked' --- 179,188 ---- return 0 ! def on_mouseUp(self, event): # make sure that we only handle a mouseClick for # the ImageButtons on the playfield if self.isPlayfieldButton(event.target): btnName = event.target.name ! print "bg1 mouseUp handler", btnName pos = int(btnName[3]) #print event.target.getName(), 'clicked' *************** *** 195,201 **** # play a beep or do some other warning, a dialog would be too much ! def on_btn0_mouseClick(self, event): btnName = event.target.name ! print "btn0 mouseClick handler", btnName pos = int(btnName[3]) #print event.target.getName(), 'clicked' --- 195,201 ---- # play a beep or do some other warning, a dialog would be too much ! def on_btn0_mouseUp(self, event): btnName = event.target.name ! print "btn0 mouseUp handler", btnName pos = int(btnName[3]) #print event.target.getName(), 'clicked' |
From: Kevin A. <ka...@us...> - 2004-07-28 07:12:16
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21040 Modified Files: graphic.py Log Message: fixed default empty bitmap size to be valid on all platforms Index: graphic.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/graphic.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** graphic.py 13 Apr 2004 17:55:04 -0000 1.14 --- graphic.py 28 Jul 2004 07:12:07 -0000 1.15 *************** *** 79,85 **** class Bitmap : ! def __init__(self, fileName='', size=(0, 0)): self._fileName = fileName ! self._size = size self._type = None self.loadFile() --- 79,91 ---- class Bitmap : ! def __init__(self, fileName='', size=(-1, -1)): self._fileName = fileName ! # KEA 2004-07-27 ! # Mac checks that the bitmap is Ok() so need ! # to use a valid size ! if (self._fileName == '') and (tuple(size) == (-1, -1)): ! self._size = (10, 10) ! else: ! self._size = size self._type = None self.loadFile() |
From: Kevin A. <ka...@us...> - 2004-07-28 07:11:42
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21010 Modified Files: util.py Log Message: fixed runScript on Mac Index: util.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/util.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** util.py 25 Apr 2004 18:56:21 -0000 1.25 --- util.py 28 Jul 2004 07:11:33 -0000 1.26 *************** *** 285,289 **** else: python = sys.executable ! os.system(python + interp + filename + args + ' &') # KEA 2004-04-25 --- 285,289 ---- else: python = sys.executable ! os.system(python + interp + filename + ' ' + args + ' &') # KEA 2004-04-25 |
From: Kevin A. <ka...@us...> - 2004-07-28 07:11:15
|
Update of /cvsroot/pythoncard/PythonCard/samples/companies In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20939/samples/companies Modified Files: companies.py Log Message: changed handler to work on Mac Index: companies.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/companies/companies.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** companies.py 30 Apr 2004 23:50:06 -0000 1.12 --- companies.py 28 Jul 2004 07:11:06 -0000 1.13 *************** *** 10,13 **** --- 10,14 ---- import os, sys import webbrowser + import wx # don't use a .ini *************** *** 25,28 **** --- 26,38 ---- flatfileDatabase.FlatfileDatabase.on_initialize(self, event) + # KEA 2004-07-27 + # we won't receive a mouseUp event on Mac OS X + # so we fake it + def on_mouseDown(self, event): + if wx.Platform == '__WXMAC__': + self.on_mouseUp(event) + else: + event.skip() + def on_mouseUp(self, event): #print event.target.name |
From: Kevin A. <ka...@us...> - 2004-07-27 15:43:24
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20019 Modified Files: resourceEditor.py resourceEditor.rsrc.py Log Message: added offset values for Mac Text and List components Index: resourceEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.py,v retrieving revision 1.200 retrieving revision 1.201 diff -C2 -d -r1.200 -r1.201 *** resourceEditor.py 27 Jul 2004 00:37:27 -0000 1.200 --- resourceEditor.py 27 Jul 2004 15:43:14 -0000 1.201 *************** *** 470,474 **** self.startGlobalOffset = [self.startGlobalOffset[0] + wx.SystemSettings.GetMetric(wx.SYS_BORDER_X), self.startGlobalOffset[1] + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)] ! #print "globalPosition", globalPosition #print "self.startGlobalPosition", self.startGlobalPosition --- 470,482 ---- self.startGlobalOffset = [self.startGlobalOffset[0] + wx.SystemSettings.GetMetric(wx.SYS_BORDER_X), self.startGlobalOffset[1] + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)] ! elif wx.Platform == "__WXMAC__": ! # KEA 2004-07-27 ! # The SYS_EDGE and SYS_BORDER numbers don't seem to work on the Mac ! # so I just experimented to find the values below to prevent the components ! # from "hopping" when the user selects them ! if ['List'].count(t): ! self.startGlobalOffset = [self.startGlobalOffset[0] - 1, self.startGlobalOffset[1] - 1] ! elif ['PasswordField', 'TextField', 'TextArea'].count(t): ! self.startGlobalOffset = [self.startGlobalOffset[0] + 3, self.startGlobalOffset[1] + 3] #print "globalPosition", globalPosition #print "self.startGlobalPosition", self.startGlobalPosition Index: resourceEditor.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.rsrc.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** resourceEditor.rsrc.py 12 May 2004 22:02:10 -0000 1.52 --- resourceEditor.rsrc.py 27 Jul 2004 15:43:14 -0000 1.53 *************** *** 185,189 **** {'type':'MenuItem', 'name':'menuViewPropertyEditor', ! 'label':'Property Editor', 'checkable':1, 'checked':1, --- 185,189 ---- {'type':'MenuItem', 'name':'menuViewPropertyEditor', ! 'label':'Property Editor\tCtrl+P', 'checkable':1, 'checked':1, |
From: Kevin A. <ka...@us...> - 2004-07-27 15:05:28
|
Update of /cvsroot/pythoncard/PythonCard/samples/stockprice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12030 Modified Files: stockprice.rsrc.py Log Message: changed StaticText items to use -1 default height Index: stockprice.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/stockprice/stockprice.rsrc.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** stockprice.rsrc.py 10 May 2004 05:02:43 -0000 1.8 --- stockprice.rsrc.py 27 Jul 2004 15:05:19 -0000 1.9 *************** *** 62,66 **** 'name':'stcDate', 'position':(5, 145), ! 'size':(100, 13), 'font':{'family': 'sansSerif', 'style': 'bold'}, 'text':'Date:', --- 62,66 ---- 'name':'stcDate', 'position':(5, 145), ! 'size':(100, -1), 'font':{'family': 'sansSerif', 'style': 'bold'}, 'text':'Date:', *************** *** 70,74 **** 'name':'stcStockPrice', 'position':(5, 110), ! 'size':(130, 13), 'font':{'family': 'sansSerif', 'style': 'bold'}, 'text':'Latest Stock price:', --- 70,74 ---- 'name':'stcStockPrice', 'position':(5, 110), ! 'size':(130, -1), 'font':{'family': 'sansSerif', 'style': 'bold'}, 'text':'Latest Stock price:', *************** *** 78,84 **** 'name':'stcCurrencyType', 'position':(5, 40), ! 'size':(141, 13), 'font':{'family': 'sansSerif', 'style': 'bold'}, ! 'text':'Choose Currency type:', }, --- 78,84 ---- 'name':'stcCurrencyType', 'position':(5, 40), ! 'size':(141, -1), 'font':{'family': 'sansSerif', 'style': 'bold'}, ! 'text':'Choose Currency:', }, *************** *** 86,90 **** 'name':'stcStockSymbol', 'position':(5, 10), ! 'size':(135, 13), 'font':{'family': 'sansSerif', 'style': 'bold'}, 'text':'Enter Stock Symbol:', --- 86,90 ---- 'name':'stcStockSymbol', 'position':(5, 10), ! 'size':(135, -1), 'font':{'family': 'sansSerif', 'style': 'bold'}, 'text':'Enter Stock Symbol:', |
From: Kevin A. <ka...@us...> - 2004-07-27 00:37:36
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15957 Modified Files: resourceEditor.py Log Message: workaround for Mac runtime property editor list selection Index: resourceEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.py,v retrieving revision 1.199 retrieving revision 1.200 diff -C2 -d -r1.199 -r1.200 *** resourceEditor.py 20 Jul 2004 17:54:50 -0000 1.199 --- resourceEditor.py 27 Jul 2004 00:37:27 -0000 1.200 *************** *** 935,940 **** self.offset = (0, 0) if self.application.pw is not None: ! self.application.pw.selectComponentsList('topLeft', 'ImageButton') ! # KEA 2002-02-23 self.propertyEditorWindow.clearComponentList() self.propertyEditorWindow.clearPropertyList() --- 935,942 ---- self.offset = (0, 0) if self.application.pw is not None: ! if wx.Platform == '__WXMAC__': ! self.application.pw.selectComponentsList('topLeft', 'Image') ! else: ! self.application.pw.selectComponentsList('topLeft', 'ImageButton') # KEA 2002-02-23 self.propertyEditorWindow.clearComponentList() self.propertyEditorWindow.clearPropertyList() |
From: Kevin A. <ka...@us...> - 2004-07-26 16:04:20
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3429/tools/codeEditor Modified Files: restEditor.rsrc.py Log Message: brought resource in line with latest codeEditor.rsrc.py Index: restEditor.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/restEditor.rsrc.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** restEditor.rsrc.py 26 Jul 2004 15:51:14 -0000 1.1 --- restEditor.rsrc.py 26 Jul 2004 16:04:11 -0000 1.2 *************** *** 84,87 **** --- 84,88 ---- 'name':'menuFileExit', 'label':'E&xit\tAlt+X', + 'command':'exit', }, ] *************** *** 287,290 **** --- 288,295 ---- }, {'type':'MenuItem', + 'name':'menuShellChangeDirectory', + 'label':'Change &Directory...', + }, + {'type':'MenuItem', 'name':'scriptletSep1', 'label':'-', *************** *** 328,331 **** --- 333,341 ---- 'command':'doHelpAbout', }, + {'type':'MenuItem', + 'name':'menuHelpAboutPythonCard', + 'label':'About PythonCard...', + 'command':'doHelpAboutPythonCard', + }, ] }, *************** *** 335,339 **** 'saveAs':'Save As', 'about':'About codeEditor...', ! 'saveAsWildcard':'Text files (*.txt;*.text)|*.text;*.TXT;*.TEXT;*.txt|HTML and XML files (*.htm;*.html;*.xml)|*.htm;*.xml;*.HTM;*.HTML;*.XML;*.html|All files (*.*)|*.*', 'chars':'chars', 'gotoLine':'Goto line', --- 345,349 ---- 'saveAs':'Save As', 'about':'About codeEditor...', ! 'saveAsWildcard':'All files (*.*)|*.*|Python scripts (*.py;*.pyw)|*.pyw;*.PY;*.PYW;*.py|Text files (*.txt;*.text)|*.text;*.TXT;*.TEXT;*.txt|HTML and XML files (*.htm;*.html;*.xml)|*.htm;*.xml;*.HTM;*.HTML;*.XML;*.html', 'chars':'chars', 'gotoLine':'Goto line', |
From: Kevin A. <ka...@us...> - 2004-07-26 15:54:41
|
Update of /cvsroot/pythoncard/PythonCard/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1696 Added Files: htmlpreview.py htmlpreview.rsrc.py Log Message: experimental html preview template used with restEditor --- NEW FILE: htmlpreview.rsrc.py --- { 'application':{ 'type':'Application', 'name':'HtmlPreview', 'backgrounds': [ { 'type':'Background', 'name':'bgMin', 'title':'HTML Preview', #'size':(800, 600), 'statusBar':1, 'style':['resizeable'], 'components': [ { 'type':'HtmlWindow', 'name':'html', 'size':(400, 200), 'text':'' }, ] } ] } } --- NEW FILE: htmlpreview.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/07/26 15:54:31 $" """ from PythonCard import model import wx import sys class HtmlPreview(model.Background): def on_initialize(self, event): if sys.platform.startswith('win'): size = self.components.html.size del self.components['html'] self.components['html'] = {'type':'IEHtmlWindow', 'name':'html', 'position':(0, 0), 'size':size, 'visible':True} else: self.components.html.SetRelatedFrame(self, "HTML Preview: %s") self.components.html.SetRelatedStatusBar(0) self.singleItemExpandingSizerLayout() def on_close(self, event): self.visible = False |
From: Kevin A. <ka...@us...> - 2004-07-26 15:51:22
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1206 Added Files: restEditor.py restEditor.rsrc.py snippet.py Log Message: added experimental restEditor --- NEW FILE: snippet.py --- from docutils import core from docutils.writers.html4css1 import Writer,HTMLTranslator class NoHeaderHTMLTranslator(HTMLTranslator): def __init__(self, document): HTMLTranslator.__init__(self,document) self.head_prefix = ['','','','',''] self.body_prefix = [] self.body_suffix = [] self.stylesheet = [] _w = Writer() _w.translator_class = NoHeaderHTMLTranslator def restify(string): return core.publish_string(string,writer=_w) if __name__ == '__main__': test = """ Test example of reST__ document. __ http://docutils.sf.net/rst.html - item 1 - item 2 - item 3 """ print restify(test) --- NEW FILE: restEditor.rsrc.py --- {'application':{'type':'Application', 'name':'codeEditor', 'backgrounds': [ {'type':'Background', 'name':'bgCodeEditor', 'title':'Code Editor PythonCard Application', 'size':(400, 300), 'statusBar':1, 'visible':0, 'style':['resizeable'], 'visible':0, 'menubar': {'type':'MenuBar', 'menus': [ {'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ {'type':'MenuItem', 'name':'menuFileNewWindow', 'label':'New Window', }, {'type':'MenuItem', 'name':'menuFileNew', 'label':'&New\tCtrl+N', }, {'type':'MenuItem', 'name':'menuFileOpen', 'label':'&Open\tCtrl+O', }, {'type':'MenuItem', 'name':'menuFileSave', 'label':'&Save\tCtrl+S', }, {'type':'MenuItem', 'name':'menuFileSaveAs', 'label':'Save &As...', }, {'type':'MenuItem', 'name':'fileSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuFileCheckSyntax', 'label':'&Check Syntax (Module)\tAlt+F5', 'command':'checkSyntax', }, {'type':'MenuItem', 'name':'menuFileRun', 'label':'&Run\tCtrl+R', 'command':'fileRun', }, {'type':'MenuItem', 'name':'menuFileRunWithInterpreter', 'label':'Run with &interpreter\tCtrl+Shift+R', 'command':'fileRunWithInterpreter', }, {'type':'MenuItem', 'name':'menuFileRunOptions', 'label':'Run Options...', 'command':'fileRunOptions', }, {'type':'MenuItem', 'name':'fileSep2', 'label':'-', }, {'type':'MenuItem', 'name':'menuFilePageSetup', 'label':'Page Set&up...', }, {'type':'MenuItem', 'name':'menuFilePrint', 'label':'&Print...\tCtrl+P', }, {'type':'MenuItem', 'name':'menuFilePrintPreview', 'label':'Print Pre&view', }, {'type':'MenuItem', 'name':'fileSep2', 'label':'-', }, {'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', }, ] }, {'type':'Menu', 'name':'Edit', 'label':'&Edit', 'items': [ {'type':'MenuItem', 'name':'menuEditUndo', 'label':'&Undo\tCtrl+Z', }, {'type':'MenuItem', 'name':'menuEditRedo', 'label':'&Redo\tCtrl+Y', }, {'type':'MenuItem', 'name':'editSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditCut', 'label':'Cu&t\tCtrl+X', }, {'type':'MenuItem', 'name':'menuEditCopy', 'label':'&Copy\tCtrl+C', }, {'type':'MenuItem', 'name':'menuEditPaste', 'label':'&Paste\tCtrl+V', }, {'type':'MenuItem', 'name':'editSep2', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditFind', 'label':'&Find...\tCtrl+F', 'command':'doEditFind', }, {'type':'MenuItem', 'name':'menuEditFindNext', 'label':'&Find Next\tF3', 'command':'doEditFindNext', }, {'type':'MenuItem', 'name':'menuEditFindFiles', 'label':'Find in Files...\tAlt+F3', 'command':'findFiles', }, {'type':'MenuItem', 'name':'menuEditReplace', 'label':'&Replace...\tCtrl+H', 'command':'doEditFindReplace', }, {'type':'MenuItem', 'name':'menuEditGoTo', 'label':'&Go To...\tCtrl+G', 'command':'doEditGoTo', }, {'type':'MenuItem', 'name':'editSep3', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditReplaceTabs', 'label':'&Replace tabs with spaces', 'command':'doEditReplaceTabs', }, {'type':'MenuItem', 'name':'editSep3', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditClear', 'label':'Cle&ar\tDel', }, {'type':'MenuItem', 'name':'menuEditSelectAll', 'label':'Select A&ll\tCtrl+A', }, {'type':'MenuItem', 'name':'editSep4', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditIndentRegion', 'label':'&Indent Region', 'command':'indentRegion', }, {'type':'MenuItem', 'name':'menuEditDedentRegion', 'label':'&Dedent Region', 'command':'dedentRegion', }, {'type':'MenuItem', 'name':'menuEditCommentRegion', 'label':'Comment &out region\tAlt+3', 'command':'commentRegion', }, {'type':'MenuItem', 'name':'menuEditUncommentRegion', 'label':'U&ncomment region\tShift+Alt+3', 'command':'uncommentRegion', }, ] }, {'type':'Menu', 'name':'menuView', 'label':'&View', 'items': [ {'type':'MenuItem', 'name':'menuViewWhitespace', 'label':'&Whitespace', 'checkable':1, }, {'type':'MenuItem', 'name':'menuViewIndentationGuides', 'label':'Indentation &guides', 'checkable':1, }, {'type':'MenuItem', 'name':'menuViewRightEdgeIndicator', 'label':'&Right edge indicator', 'checkable':1, }, {'type':'MenuItem', 'name':'menuViewEndOfLineMarkers', 'label':'&End-of-line markers', 'checkable':1, }, {'type':'MenuItem', 'name':'menuViewFixedFont', 'label':'&Fixed Font', 'enabled':0, 'checkable':1, }, {'type':'MenuItem', 'name':'viewSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuViewLineNumbers', 'label':'&Line Numbers', 'checkable':1, 'checked':1, }, {'type':'MenuItem', 'name':'menuViewCodeFolding', 'label':'&Code Folding', 'checkable':1, 'checked':0, }, {'type':'MenuItem', 'name':'viewSep2', 'label':'-', }, {'type':'MenuItem', 'name':'menuViewPreviewHTML', 'label':'&Preview HTML\tCtrl+1', 'command':'previewPost', }, {'type':'MenuItem', 'name':'menuViewSourceIsHtml', 'label':'Source is HTML', 'checkable':1, 'checked':0, }, ] }, {'type':'Menu', 'name':'menuFormat', 'label':'F&ormat', 'items': [ {'type':'MenuItem', 'name':'menuFormatStyles', 'label':'&Styles...', 'command':'doSetStyles', }, {'type':'MenuItem', 'name':'menuFormatWrap', 'label':'&Wrap Lines', 'checkable':1, }, ] }, {'type':'Menu', 'name':'menuScriptlet', 'label':'&Shell', 'items': [ {'type':'MenuItem', 'name':'menuScriptletShell', 'label':'&Shell Window\tF5', }, {'type':'MenuItem', 'name':'menuScriptletNamespace', 'label':'&Namespace Window\tF6', }, {'type':'MenuItem', 'name':'menuScriptletSaveUserConfiguration', 'label':'Save &Configuration', }, {'type':'MenuItem', 'name':'scriptletSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuScriptletSaveShellSelection', 'label':'Save Shell Selection...', }, {'type':'MenuItem', 'name':'menuScriptletRunScriptlet', 'label':'Run Scriptlet...', }, ] }, {'type':'Menu', 'name':'menuHelp', 'label':'&Help', 'items': [ {'type':'MenuItem', 'name':'menuShellDocumentation', 'label':'&Shell Documenation...', 'command':'showShellDocumentation', }, {'type':'MenuItem', 'name':'menuPythonCardDocumentation', 'label':'&PythonCard Documentation...\tF1', 'command':'showPythonCardDocumentation', }, {'type':'MenuItem', 'name':'menuPythonDocumentation', 'label':'Python &Documentation...', 'command':'showPythonDocumentation', }, {'type':'MenuItem', 'name':'helpSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuHelpAbout', 'label':'&About codeEditor...', 'command':'doHelpAbout', }, ] }, ] }, 'strings': { 'saveAs':'Save As', 'about':'About codeEditor...', 'saveAsWildcard':'Text files (*.txt;*.text)|*.text;*.TXT;*.TEXT;*.txt|HTML and XML files (*.htm;*.html;*.xml)|*.htm;*.xml;*.HTM;*.HTML;*.XML;*.html|All files (*.*)|*.*', 'chars':'chars', 'gotoLine':'Goto line', 'lines':'lines', 'gotoLineNumber':'Goto line number:', 'documentChangedPrompt':'The text in the %s file has changed.\n\nDo you want to save the changes?', 'untitled':'Untitled', 'sample':'codeEditor sample', 'codeEditor':'codeEditor', 'replaced':'Replaced %d occurances', 'words':'words', 'openFile':'Open file', 'scriptletWildcard':'Python files (*.py)|*.py|All Files (*.*)|*.*', 'document':'Document', }, 'components': [ {'type':'CodeEditor', 'name':'document', 'position':(0, 0), 'size':(250, 100), }, ] # end components } # end background ] # end backgrounds } } --- NEW FILE: restEditor.py --- #!/usr/bin/env python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/07/26 15:51:14 $" PythonCard Editor (codeEditor) wiki page http://wiki.wxpython.org/index.cgi/PythonCardEditor wxStyledTextCtrl documentation http://wiki.wxpython.org/index.cgi/wxStyledTextCtrl """ from PythonCard import about, configuration, dialog, log, menu, model, resource, util from modules.runOptionsDialog import RunOptionsDialog from modules import scriptutils import os, sys import wx from wx import stc from wx.html import HtmlEasyPrinting [...1240 lines suppressed...] def on_showPythonDocumentation_command(self, event): global help_url if sys.platform.startswith("win"): # KEA 2003-10-15 # hack for Python 2.3 Windows help file # need to decide on a clean way of handling various doc options fn = os.path.dirname(os.__file__) fn = os.path.join(fn, os.pardir, "Doc", "Python23.chm") fn = os.path.normpath(fn) if os.path.isfile(fn): os.startfile(fn) else: webbrowser.open(help_url) if __name__ == '__main__': app = model.Application(CodeEditor) app.MainLoop() |
From: Kevin A. <ka...@us...> - 2004-07-22 22:15:36
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12213 Modified Files: codeEditor.py Added Files: macbuild.py Log Message: bundlebuilder script for codeEditor Index: codeEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/codeEditor.py,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** codeEditor.py 19 Jul 2004 18:21:44 -0000 1.117 --- codeEditor.py 22 Jul 2004 22:15:12 -0000 1.118 *************** *** 25,28 **** --- 25,30 ---- import webbrowser + # KEA 2004-07-22 # force imports for components used in .rsrc.py file # so we can do a make standalones with py2exe and bundlebuilder from PythonCard.components import codeeditor + USERCONFIG = 'user.config.txt' --- NEW FILE: macbuild.py --- import os, sys import bundlebuilder # I set this to make adding subfolders into the package easier # KEA 2004-07-22 # rather than hard-coding the path # we'll just get the path from this module ##packageroot = "/Users/kevino/oss/eclass/eclass_builder" packageroot = os.path.abspath(os.path.dirname(__file__)) # for the purposes of building the standalone # change to the directory the build script is in to simplify imports os.chdir(packageroot) # Create the AppBuilder myapp = bundlebuilder.AppBuilder(verbosity=1) # Tell it where to find the main script - the one that loads on startup myapp.mainprogram = os.path.join(packageroot, "codeEditor.py") myapp.standalone = 1 myapp.name = "CodeEditor" # includePackages forces certain packages to be added to the app bundle ##myapp.includePackages.append("encodings") ##myapp.includePackages.append("_xmlplus") # KEA 2004-07-22 # force imports for components used in .rsrc.py file #from PythonCard.components import button, checkbox, combobox, list, statictext, textfield # Here you add supporting files and/or folders to your bundle ##myapp.resources.append(os.path.join(packageroot, "about")) ##myapp.resources.append(os.path.join(packageroot, "autorun")) ##myapp.resources.append(os.path.join(packageroot, "Graphics")) myapp.resources.append(os.path.join(packageroot, "scriptlets")) myapp.resources.append(os.path.join(packageroot, "codeEditor.rsrc.py")) myapp.resources.append(os.path.join(packageroot, "modules", "runOptionsDialog.rsrc.py")) # bundlebuilder does not yet have the capability to detect what shared libraries # are needed by your app - so in this case I am adding the wxPython libs manually myapp.libs.append("/usr/local/lib/libwx_mac-2.4.0.dylib") myapp.libs.append("/usr/local/lib/libwx_mac-2.4.0.rsrc") # Here we build the app! myapp.setup() myapp.build() |
From: Kevin A. <ka...@us...> - 2004-07-22 21:52:40
|
Update of /cvsroot/pythoncard/PythonCard/tools/findfiles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8294 Modified Files: findfiles.py Added Files: macbuild.py Log Message: added macbuild.py bundlebuilder script and manual component imports Index: findfiles.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/findfiles/findfiles.py,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** findfiles.py 12 May 2004 23:23:49 -0000 1.78 --- findfiles.py 22 Jul 2004 21:52:28 -0000 1.79 *************** *** 25,28 **** --- 25,31 ---- import wx + # KEA 2004-07-22 # force imports for components used in .rsrc.py file + # so we can do a make standalones with py2exe and bundlebuilder from PythonCard.components import button, checkbox, combobox, list, statictext, textfield + LASTGREPFILE = 'findfiles.grep' USERCONFIG = 'user.config.txt' --- NEW FILE: macbuild.py --- import os, sys import bundlebuilder # I set this to make adding subfolders into the package easier # KEA 2004-07-22 # rather than hard-coding the path # we'll just get the path from this module ##packageroot = "/Users/kevino/oss/eclass/eclass_builder" packageroot = os.path.abspath(os.path.dirname(__file__)) # for the purposes of building the standalone # change to the directory the build script is in to simplify imports os.chdir(packageroot) # Create the AppBuilder myapp = bundlebuilder.AppBuilder(verbosity=1) # Tell it where to find the main script - the one that loads on startup myapp.mainprogram = os.path.join(packageroot, "findfiles.py") myapp.standalone = 1 myapp.name = "FindFiles" # includePackages forces certain packages to be added to the app bundle ##myapp.includePackages.append("encodings") ##myapp.includePackages.append("_xmlplus") # KEA 2004-07-22 # force imports for components used in .rsrc.py file #from PythonCard.components import button, checkbox, combobox, list, statictext, textfield # Here you add supporting files and/or folders to your bundle ##myapp.resources.append(os.path.join(packageroot, "about")) ##myapp.resources.append(os.path.join(packageroot, "autorun")) ##myapp.resources.append(os.path.join(packageroot, "Graphics")) myapp.resources.append(os.path.join(packageroot, "findfiles.rsrc.py")) # bundlebuilder does not yet have the capability to detect what shared libraries # are needed by your app - so in this case I am adding the wxPython libs manually myapp.libs.append("/usr/local/lib/libwx_mac-2.4.0.dylib") myapp.libs.append("/usr/local/lib/libwx_mac-2.4.0.rsrc") # Here we build the app! myapp.setup() myapp.build() |
From: Kevin A. <ka...@us...> - 2004-07-21 20:24:19
|
Update of /cvsroot/pythoncard/PythonCard/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20146/docs Modified Files: changelog.txt Log Message: switched to using wx.lib.statbmp.GenStaticBitmap on GTK Index: changelog.txt =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/changelog.txt,v retrieving revision 1.293 retrieving revision 1.294 diff -C2 -d -r1.293 -r1.294 *** changelog.txt 22 May 2004 01:07:29 -0000 1.293 --- changelog.txt 21 Jul 2004 20:24:09 -0000 1.294 *************** *** 2,6 **** ! Release 0.8 2004-05-?? Created unit-test facility. defined ignore files for files that should not be imported to check for tests. --- 2,7 ---- ! Release 0.8 2004-08-?? ! switched to using wx.lib.statbmp.GenStaticBitmap on GTK for Image component Created unit-test facility. defined ignore files for files that should not be imported to check for tests. |
From: Kevin A. <ka...@us...> - 2004-07-21 20:24:18
|
Update of /cvsroot/pythoncard/PythonCard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20146/components Modified Files: image.py Log Message: switched to using wx.lib.statbmp.GenStaticBitmap on GTK Index: image.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/image.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** image.py 19 Jul 2004 17:47:39 -0000 1.22 --- image.py 21 Jul 2004 20:24:08 -0000 1.23 *************** *** 8,11 **** --- 8,18 ---- from PythonCard import event, graphic, widget + USE_GENERIC = wx.Platform == '__WXGTK__' + + if USE_GENERIC: + from wx.lib.statbmp import GenStaticBitmap as StaticBitmap + else: + StaticBitmap = wx.StaticBitmap + class ImageSpec(widget.WidgetSpec): def __init__(self): *************** *** 25,29 **** ! class Image(widget.Widget, wx.StaticBitmap): """ A static image. --- 32,36 ---- ! class Image(widget.Widget, StaticBitmap): """ A static image. *************** *** 49,53 **** ## self._bitmap.SetMask(mask) ! wx.StaticBitmap.__init__( self, aParent, --- 56,60 ---- ## self._bitmap.SetMask(mask) ! StaticBitmap.__init__( self, aParent, |
From: Kevin A. <ka...@us...> - 2004-07-21 20:09:16
|
Update of /cvsroot/pythoncard/PythonCard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16813/components Modified Files: choice.py combobox.py list.py Log Message: added appendItems Index: list.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/list.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** list.py 4 May 2004 17:15:42 -0000 1.25 --- list.py 21 Jul 2004 20:09:04 -0000 1.26 *************** *** 109,114 **** # KEA more wxListBox methods ! def append( self, aString ) : ! self.Append( aString ) def clear( self ) : --- 109,117 ---- # KEA more wxListBox methods ! def append(self, aString): ! self.Append(aString) ! ! def appendItems(self, aList): ! self.AppendItems(aList) def clear( self ) : Index: choice.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/choice.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** choice.py 4 May 2004 17:15:42 -0000 1.19 --- choice.py 21 Jul 2004 20:09:04 -0000 1.20 *************** *** 67,70 **** --- 67,73 ---- self.Append(aString) + def appendItems(self, aList): + self.AppendItems(aList) + items = property(_getItems, _setItems) Index: combobox.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/combobox.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** combobox.py 9 May 2004 23:58:08 -0000 1.27 --- combobox.py 21 Jul 2004 20:09:04 -0000 1.28 *************** *** 86,95 **** def _setItems(self, items): self.Clear() ! for item in items : ! self.Append(item) def append( self, aString ) : self.Append( aString ) items = property(_getItems, _setItems) text = property(wx.ComboBox.GetValue, wx.ComboBox.SetValue) --- 86,97 ---- def _setItems(self, items): self.Clear() ! self.AppendItems(items) def append( self, aString ) : self.Append( aString ) + def appendItems(self, aList): + self.AppendItems(aList) + items = property(_getItems, _setItems) text = property(wx.ComboBox.GetValue, wx.ComboBox.SetValue) |
From: Kevin A. <ka...@us...> - 2004-07-21 19:16:52
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4877 Modified Files: dialog.py Log Message: mac workaround and 2.5.2.x change Index: dialog.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/dialog.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** dialog.py 13 Apr 2004 18:15:03 -0000 1.32 --- dialog.py 21 Jul 2004 19:16:43 -0000 1.33 *************** *** 206,209 **** --- 206,212 ---- # None causes a seg fault. aFontData = wx.FontData() + # 2004-07-21 + # Mac needs the color set + aFontData.SetColour(wx.BLACK) if aFont is not None: aFontData.SetInitialFont(aFont._getFont()) |
From: Kevin A. <ka...@us...> - 2004-07-20 18:22:44
|
Update of /cvsroot/pythoncard/PythonCard/samples/financial In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27053/financial Added Files: .cvsignore mortgage.py mortgage.rsrc.py pyfi.py readme.txt Log Message: added mortgage sample for VanPy presentation --- NEW FILE: .cvsignore --- .cvsignore *.pyc *.log .DS_Store --- NEW FILE: pyfi.py --- #!/usr/bin/python """A finance library for Python. All interest rates are to be expressed in decimal notation (i.e. 0.0825 instead of 8.25) This library has been placed in the public domain. Version history: 1.0 - 2001-01 - Initial program - Rupert Scammell <ru...@ya...> 2.0 - 2001-03 - Additions and revisions by Louis Luangkesorn <ll...@no...> (compound interest present value, equivalent value of an annuity) 2.1 - 2004-01 - Readability changes by Matthew Scott <sp...@go...> """ import sys import math def simpleInterest(p, r, t): """Simple interest Returns: interest value Input values: See 'Simple interest future value' below """ i = p * r * t return i def simpleInterestFutureValue(p, r, t): """Simple interest future value Returns: future value Input values: p : principal r : Interest rate (decimal) t : Investment periods """ fv = p * (1 + r * t) return fv def compoundedInterest(fv, p): """Compounded interest Returns: Interest value Input values: fv : Future value p : Principal """ i = fv - p return i def compoundInterestFutureValue(p, r, c, n): """Compound interest future value Returns: future value Input values: p : principal r : interest rate c : number of compounding periods in a year n : (c * t) , total number of compounding periods """ fv = (p * (1 + (r / c))) ** n return fv def annualYield(r, c): """Annual yield Returns: Simple interest rate necessary to yield the same amount of dollars yielded by the annual rate r compounded c times for one year Input values: r : interest rate c : number of compounding periods in a year """ y = ((1 + (r / c)) ** c) - 1 return y def ordinaryAnnuity(pymt, p, r, c, n): """Ordinary annuity formula Returns: future value Input values: pymt : payment made during compounding period p : principal r : annual interest rate c : number of compounding periods in a year n : total number of payments """ block1 = ((1 + (r / c)) ** n) - 1 block2 = r / c fv = pymt * (block1 / block2) return fv def presentValueAnnuity(pymt, r, c, n): """Present value of an annuity Returns: Lump sum that can be deposited at the beginning of the annuity's term, at the same interest rate and with the same compounding period, that would yield the same amount as the annuity. Input values: See 'Ordinary annuity formula' above.""" ipp = r / c pval = pymt * ((1 - ((1 + ipp) ** (-n))) / ipp) return pval def equivalentAnnualCost(pval, r, c, n): """Equivalent value of an annuity Returns: Coupon amount for an annuity given the present value Input values: pval : present value of annuity r : annual interest rate c : number of compounding periods in a year n : total number of payments See 'Ordinary annuity formula' above. """ ipp = r / c pymt = pval / ((1 - ((1 + ipp) ** (-n))) / ipp) return pymt def amortization(loan, r, c, n): """Amortization Returns: The amount of money that needs to be paid at the end of each period to get rid of the total loan. Input values: loan : Total loan amount r : annual interest rate c : number of compounding periods a year n : total number of compounding periods """ ipp = r / c amt = (loan * ipp) / (1 - ((1 + ipp) ** (-n))) return amt def compoundInterestPresentValue(p, r, c, n): """Compound interest present value Returns: present value Input values: p : principal r : interest rate c : number of compounding periods in a year n : (c * t), total number of compounding periods """ pv = (p / ((1 + (r / c)) ** n)) return pv --- NEW FILE: mortgage.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/07/20 18:22:35 $" """ from PythonCard import dialog, model import pyfi class MyBackground(model.Background): def on_initialize(self, event): # if you have any initialization # including sizer setup, do it here self.on_Calculate_mouseClick(None) def on_Calculate_mouseClick(self, event): comp = self.components try: principal = float(comp.Principal.text) interestRate = float(comp.InterestRate.text) if interestRate > 1: interestRate = interestRate / 100.0 payment15 = pyfi.amortization(principal, interestRate, 12, 15 * 12) payment30 = pyfi.amortization(principal, interestRate, 12, 30 * 12) comp.Result.text = "15 year monthly payment: %.2f\n30 year monthly payment: %.2f" % (payment15, payment30) except: dialog.alertDialog(self, 'Please enter valid values', 'Input Value(s) Error') if __name__ == '__main__': app = model.Application(MyBackground) app.MainLoop() --- NEW FILE: readme.txt --- I'm not sure whether this will become a real sample or not. This is a holding place for some demo code I want to build at VanPy. --- NEW FILE: mortgage.rsrc.py --- {'application':{'type':'Application', 'name':'Template', 'backgrounds': [ {'type':'Background', 'name':'bgTemplate', 'title':'Mortgage Calculator', 'position':(5, 5), 'size':(400, 300), 'style':['resizeable'], 'menubar': {'type':'MenuBar', 'menus': [ {'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ {'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit', 'command':'exit', }, ] }, ] }, 'components': [ {'type':'StaticText', 'name':'Result', 'position':(115, 150), 'size':(65, -1), }, {'type':'Button', 'name':'Calculate', 'position':(115, 105), 'label':'Calculate', }, {'type':'TextField', 'name':'Principal', 'position':(115, 10), 'size':(70, -1), 'text':'100000', }, {'type':'TextField', 'name':'InterestRate', 'position':(115, 35), 'size':(35, -1), 'text':'7.5', }, ] # end components } # end background ] # end backgrounds } } |