You can subscribe to this list here.
2003 |
Jan
|
Feb
(20) |
Mar
(122) |
Apr
(16) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bel...@us...> - 2003-02-26 01:12:13
|
Update of /cvsroot/btplusplus/BT++/src/WebServer In directory sc8-pr-cvs1:/tmp/cvs-serv9576/src/WebServer Modified Files: BTWebServer.py HTTPConfigFile.py Log Message: WebLog colored by loglevel & Startup dir creation fixed Index: BTWebServer.py =================================================================== RCS file: /cvsroot/btplusplus/BT++/src/WebServer/BTWebServer.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BTWebServer.py 25 Feb 2003 23:43:17 -0000 1.1 --- BTWebServer.py 26 Feb 2003 01:12:05 -0000 1.2 *************** *** 3,7 **** from HTTPConfigFile import HTTPConfig from threading import Event ! from os import listdir, path from TabTrans.LoaderManager import LoaderManager from urlparse import urlparse --- 3,7 ---- from HTTPConfigFile import HTTPConfig from threading import Event ! from os import listdir, path, chdir, mkdir from TabTrans.LoaderManager import LoaderManager from urlparse import urlparse *************** *** 92,99 **** def WebLogit(a, loglevel = LOG_INFO): if loglevel >= int(HTTPConfig.Get('Display', 'LogLevel')): ! WebLog.append(strftime("[%a, %d %b %Y %H:%M:%S]_", localtime()) + a) if len(WebLog) > int(HTTPConfig.Get('Display', 'LogCount')): WebLog.pop() BTHandler = LoaderManager(log = WebLogit) --- 92,114 ---- def WebLogit(a, loglevel = LOG_INFO): if loglevel >= int(HTTPConfig.Get('Display', 'LogLevel')): ! WebLog.append(strftime("[%a, %d %b %Y %H:%M:%S]_", localtime()) + str(loglevel) + '_' + a) if len(WebLog) > int(HTTPConfig.Get('Display', 'LogCount')): WebLog.pop() + chdir( + path.abspath( + path.dirname(sys.argv[0]) + ) + ) + + try: mkdir(Config.Get('Paths', 'Incoming')) + except: pass + try: mkdir(Config.Get('Paths', 'Torrent')) + except: pass + try: mkdir(Config.Get('Paths', 'History')) + except: pass + try: mkdir(Config.Get('Paths', 'Temp')) + except: pass + BTHandler = LoaderManager(log = WebLogit) *************** *** 396,400 **** ret = "<html>\n<head>\n<title>WebTorrent++ Log</title>\n" ret = ret + "</head>\n<body bgcolor=#%s>\n" % HTTPConfig.Get('WebColors','LogBackground') ! ret = ret + "<h1>WebTorrent++ Log</h1>\n<table bgcolor=#%s border=1 cellpadding=4>\n" % HTTPConfig.Get('WebColors','LogTable') t = WebLog[:] try: --- 411,415 ---- ret = "<html>\n<head>\n<title>WebTorrent++ Log</title>\n" ret = ret + "</head>\n<body bgcolor=#%s>\n" % HTTPConfig.Get('WebColors','LogBackground') ! ret = ret + "<h1>WebTorrent++ Log</h1>\n<table border=1 cellpadding=4>\n" t = WebLog[:] try: *************** *** 403,408 **** pass for line in t: ! sp = str(line).split('_',1) ! ret = ret + "<tr><td nowrap>%s</td><td width=100%%>%s</td></tr>\n" % (sp[0], sp[1]) ret = ret + "</table>\n</body>\n</html>" self.wfile.write(ret) --- 418,423 ---- pass for line in t: ! sp = str(line).split('_',2) ! ret = ret + "<tr bgcolor=#%s><td nowrap>%s</td><td width=100%%>%s</td></tr>\n" % (HTTPConfig.Get('WebColors','LogTable'+sp[1]), sp[0], sp[2]) ret = ret + "</table>\n</body>\n</html>" self.wfile.write(ret) *************** *** 417,429 **** def __init__(self): - try: mkdir(Config.Get('Paths', 'Incoming')) - except: pass - try: mkdir(Config.Get('Paths', 'Torrent')) - except: pass - try: mkdir(Config.Get('Paths', 'History')) - except: pass - try: mkdir(Config.Get('Paths', 'Temp')) - except: pass - self.localIP = socket.gethostbyname(socket.gethostname()) --- 432,435 ---- Index: HTTPConfigFile.py =================================================================== RCS file: /cvsroot/btplusplus/BT++/src/WebServer/HTTPConfigFile.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HTTPConfigFile.py 25 Feb 2003 23:43:17 -0000 1.1 --- HTTPConfigFile.py 26 Feb 2003 01:12:05 -0000 1.2 *************** *** 29,33 **** 'ConfTable': 'CCCCFF', 'LogBackground': 'AA6666', ! 'LogTable': 'FF6666' } } --- 29,36 ---- 'ConfTable': 'CCCCFF', 'LogBackground': 'AA6666', ! 'LogTable0': 'FFFF66', ! 'LogTable1': '66DD66', ! 'LogTable2': 'FF6666', ! 'LogTable3': 'FF6666' } } |
From: <bel...@us...> - 2003-02-25 23:43:21
|
Update of /cvsroot/btplusplus/BT++/src/WebServer In directory sc8-pr-cvs1:/tmp/cvs-serv4449/src/WebServer Added Files: BTWebServer.py HTTPConfigFile.py __init__.py Log Message: WebServer & Completed abstraction of LoaderManager --- NEW FILE: BTWebServer.py --- from BaseHTTPServer import * from ConfigFile import Config from HTTPConfigFile import HTTPConfig from threading import Event from os import listdir, path from TabTrans.LoaderManager import LoaderManager from urlparse import urlparse from urllib import unquote from urllib2 import urlopen from time import sleep, localtime, strftime from BTConstants import * import socket import posixpath import sys __version__ = "0.1" Checked = {0: '', 1:'CHECKED', '0': '', '1':'CHECKED'} HTTP_ROOT = """\ <html> <head> <title>WebTorrent++</title> </head> <frameset rows="50,*"> <frame name="top" src="menu"> <frame name="body" src="torrents"> </frameset> </html> """ HTTP_MENU = """\ <head> <title>Success</title> </head> <body bgcolor=#%s> <table width=100%%><tr> <td><form method=get action="torrents" target="body"><button type=submit>Torrents</button></form></td> <td nowrap><form method=get action="log" target="body"><button type=submit>View Log</button></form></td> <td><form method=get action="config" target="body"><button type=submit>Config</button></form></td> <td width=80%%><form method=post action="torrents" target="body"> <table width=100%% border=1 bgcolor=#%s><tr> <td width=100%%><input type=text style="width:100%%" name=torr title="Paste Torrent URLs here"></td> <td><input type=hidden name=command value=Add><button type=submit>Add</button></td> </tr></table> </form></td> <td nowrap><form method=get action="exit" target="body"><button type=submit>Kill server</button></form></td> </tr></table> </body> """ HTTP_EXIT = """\ <head> <title>Exit</title> </head> <body> <h1>Server Killed.</h1> </body> """ HTTP_DL_ERROR = """\ <head> <title>Download Error</title> </head> <body> <h1>Error downloading Torrent %s</h1> </body> """ LOG_LEVEL_DESC = """\ <table style="font-size:x-small"> <tr><td width=1%%></td><td align=right>0</td><td width=100%%>Trivial</td></tr> <tr><td width=1%%></td><td align=right>1</td><td width=100%%>Info</td></tr> <tr><td width=1%%></td><td align=right>2</td><td width=100%%>Errors</td></tr> <tr><td width=1%%></td><td align=right>3</td><td width=100%%>Critical Errors</td></tr> </table> """ ########################################################################################################### ########################################################################################################### ########################################################################################################### ########################################################################################################### BTWait = Event() ########################################################################################################### ########################################################################################################### ########################################################################################################### ########################################################################################################### WebLog = [] def WebLogit(a, loglevel = LOG_INFO): if loglevel >= int(HTTPConfig.Get('Display', 'LogLevel')): WebLog.append(strftime("[%a, %d %b %Y %H:%M:%S]_", localtime()) + a) if len(WebLog) > int(HTTPConfig.Get('Display', 'LogCount')): WebLog.pop() BTHandler = LoaderManager(log = WebLogit) ########################################################################################################### ########################################################################################################### ########################################################################################################### ########################################################################################################### class BTHTTPHandler(BaseHTTPRequestHandler): server_version = "BTHTTP/" + __version__ def do_GET(self): """Serve a GET request.""" self.send_head() if self.requested == '': self.wfile.write(HTTP_ROOT) elif self.requested == 'torrents': BTHandler.Update() sleep(0.5) self.send_torrents() elif self.requested == 'config': self.send_config() elif self.requested == 'menu': self.wfile.write(HTTP_MENU % (HTTPConfig.Get('WebColors','MenuBackground'),HTTPConfig.Get('WebColors','MenuAddbar'))) elif self.requested == 'log': self.send_log() elif self.requested == 'exit': self.wfile.write(HTTP_EXIT) for loader in BTHandler.Loaders: if loader.IsRunning(): loader.PauseDownload() # for loader in BTHandler.Seeds: # if loader.IsRunning(): loader.PauseDownload() BTWait.set() def do_HEAD(self): """Serve a HEAD request.""" self.send_head() def do_POST(self): self.send_head() length = self.headers.getheader('content-length') res = self.rfile.read(int(length)) res = res.replace('+', ' ') result = dict([x.split('=') for x in res.split('&')]) #self.wfile.write(HTTP_TEST % (result['command'])) if self.requested == 'torrents': if result['command']=='Pause': if result['seed']=='0': BTHandler.Loaders[int(result['nr'])-1].PauseDownload() else: BTHandler.Seeds[int(result['nr'])-1].PauseDownload() elif result['command']=='Resume': if result['seed']=='0': BTHandler.Loaders[int(result['nr'])-1].StartDownload() else: BTHandler.Seeds[int(result['nr'])-1].StartDownload() elif result['command']=='MoveUp': c = int(result['nr']) if result['seed']=='0': BTHandler.Move(c-1, c-2) else: BTHandler.MoveSeed(c-1, c-2) elif result['command']=='MoveDown': c = int(result['nr']) if result['seed']=='0': BTHandler.Move(c-1, c) else: BTHandler.MoveSeed(c-1, c) elif result['command']=='Add': url = result['torr'] if url!='': try: url = unquote(url) h = urlopen(url) spl = urlparse(url) file = path.split(spl[2])[1] if file == '': raise data = h.read() h.close() f = open( path.join(Config.Get('Paths', 'Torrent'), file), 'wb' ) f.write( data ) f.close() except: self.wfile.write(HTTP_DL_ERROR % url) return elif result['command']=='Config': for key in result: if key != 'command': majkey, minkey = key.split('_') if majkey in ['Host','Access','Display','WebColors']: HTTPConfig.Set(majkey, minkey, result[key]) elif (majkey == 'Paths') or (minkey == 'Ip'): Config.Set(majkey, minkey, result[key]) else: Config.Set(majkey, minkey, int(result[key])) Config.Save() HTTPConfig.Save() WebLogit("Configuration Changed.", loglevel = LOG_TRIVIAL) BTHandler.Update() sleep(0.5) self.send_torrents() 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. """ #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) temp = posixpath.normpath(unquote(self.path)) dummy, self.requested = temp.split('/') self.requested = self.requested.replace('?',''); if self.requested in ['','exit','menu','torrents','config','log']: self.send_response(200) self.send_header("Content-type", "text/html") self.send_header("Expires", "Mon, 26 Jul 1997 05:00:00 GMT") self.end_headers() else: self.send_error(404, "File not found") def send_torrents(self): ret = "<html>\n<head>\n<title>WebTorrent++ Download Status</title>\n" ret = ret + "<META HTTP-EQUIV=\"Refresh\" CONTENT=\""+HTTPConfig.Get('Display', 'Refresh')+"\">\n" ret = ret + "</head>\n<body bgcolor=#%s>" % HTTPConfig.Get('WebColors','TorrBackground') if BTHandler.Loaders: ret = ret + "<table border=1 width=100% cellpadding=3>\n<tr bgcolor=#DDDDDD><th colspan=2>Incomplete</th><th align=left>File</th><th>Size</th><th>Transfered</th><th>Speed</th><th>Status</th><th width=15%>Progress</th><th>Remaining</th></tr>\n" c = 0 for loader in BTHandler.Loaders: c = c + 1 if loader.IsFinished(): ret = ret + "<tr bgcolor=#%s>" % HTTPConfig.Get('WebColors','TorrFinished') if c <= Config.Get('Download', 'MaxSimDown'): ret = ret + "<tr bgcolor=#%s>" % HTTPConfig.Get('WebColors','TorrAuto') else: ret = ret + "<tr bgcolor=#%s>" % HTTPConfig.Get('WebColors','TorrNonAuto') if loader.Info['Status']!='Paused': cc = 'Pause' else: cc = 'Resume' ret = ret + "<form method=\"POST\" action=\"torrents\"><td>" ret = ret + "<button type=submit name=command value=%s>%s</button></td><td>" % (cc,cc) if c == 1: cc = 'DISABLED' else: cc = '' ret = ret + "<table><tr><td><button type=submit name=command %s value=MoveUp style=\"font-size:xx-small; font-weight:bold\">↑</button></td></tr>" % (cc) if c == len(BTHandler.Loaders): cc = 'DISABLED' else: cc = '' ret = ret + "<tr><td><button type=submit name=command %s value=MoveDown style=\"font-size:xx-small; font-weight:bold\">↓</button></td></tr></table>" % (cc) ret = ret + "<input type=hidden name=seed value=0><input type=hidden name=nr value=%d>" % (c) ret = ret + "</td></form>" ret = ret + "<td align=left>" + loader.Config['File'] + "</td>" ret = ret + "<td align=center>" + ('%.2f MB' % (loader.Config['Size'] / 1024 / 1024)) + "</td><td align=center>" if loader.Info['FractionDone'] == -1: ret = ret + '?' else: ret = ret + ('%.2f MB' % (loader.Info['FractionDone'] * loader.Config['Size'] / 1024 / 1024)) ret = ret + "</td><td align=center>" + ('%.1f / %.1f' % (loader.Info['SpeedDown'], loader.Info['SpeedUp'])) + "</td>" ret = ret + "<td align=center>" + loader.Info['Status'] ret = ret + "</td><td><table width=100% bordercolor=#0000BB border=1><tr><td><table width=100% height=100%><tr>" if loader.Info['Status']=='Hashing': c1='#FF0000' c2='#0000FF' else: c1='#00FF00' c2='#FF0000' if loader.Info['FractionDone'] == -1: ret = ret + '<td bgcolor=#0000FF width=100%> </td>' else: ret = ret + ('<td bgcolor=%s width=%d%%> </td><td bgcolor=%s width=%d%%> </td>' % (c1, loader.Info['FractionDone']*100, c2, loader.Info['FractionRemain']*100)) ret = ret + "</tr></table></td></tr></table></td>" ret = ret + ('<td align=center>%.1f%% [%.2f MB]</td>' % (loader.Info['FractionRemain'] * 100, loader.Info['FractionRemain'] * loader.Config['Size'] / 1024 / 1024)) ret = ret + "</tr>\n" ret = ret + "</table>\n" else: ret = ret + "<p> No Torrents" ## if BTHandler.Seeds: ## ret = ret + "<p><table border=1 width=100% cellpadding=3>\n<tr bgcolor=#DDDDDD><th colspan=2>Seeds</th><th align=left>File</th><th>Size</th><th>Status</th><th>Speed</th></tr>\n" ## c = 0 ## for loader in BTHandler.Seeds: ## c = c + 1 ## if c <= HTTPConfig.Get('Seed', 'MaxSimSeed'): ## ret = ret + "<tr bgcolor=#FFCCCC>" ## else: ## ret = ret + "<tr bgcolor=#D8BFBC>" ## if loader.Info['Status']!='Paused': ## cc = 'Pause' ## else: ## cc = 'Resume' ## ret = ret + "<form method=\"POST\" action=\"torrents\"><td>" ## ret = ret + "<button type=submit name=command value=%s>%s</button></td><td>" % (cc,cc) ## if c == 1: ## cc = 'DISABLED' ## else: ## cc = '' ## ret = ret + "<table><tr><td><button type=submit name=command %s value=MoveUp style=\"font-size:xx-small; font-weight:bold\">↑</button></td></tr>" % (cc) ## if c == len(BTHandler.Seeds): ## cc = 'DISABLED' ## else: ## cc = '' ## ret = ret + "<tr><td><button type=submit name=command %s value=MoveDown style=\"font-size:xx-small; font-weight:bold\">↓</button></td></tr></table>" % (cc) ## ret = ret + "<input type=hidden name=seed value=1><input type=hidden name=nr value=%d>" % (c) ## ret = ret + "</td></form>" ## ret = ret + "<td align=left width=70%>" + loader.Config['File'] + "</td>" ## ret = ret + "<td align=center>" + ('%.2f MB' % (loader.Config['Size'] / 1024 / 1024)) + "</td>" ## if loader.Info['Status']!='Hashing': ## ret = ret + "<td align=center>" + loader.Info['Status'] ## else: ## ret = ret + ('<td align=center>Hashing (%.1f%%)' % (loader.Info['FractionDone'] * 100)) ## ret = ret + "</td><td align=center>" + ('%.1f' % (loader.Info['SpeedUp'])) + "</td>" ## ret = ret + "</tr>\n" ## ret = ret + "</table>\n" ## if BTHandler.StaleSeeds: ## ret = ret + "<p><table border=1 cellpadding=10><tr><td><b style=\"color:red\">Stale Seeds (content lacking):</b></td></tr><tr><td><b>" ## for s in BTHandler.StaleSeeds: ## ret = ret + s + "<br>" ## ret = ret + "</b></td></tr></table>" ret = ret + "</body>\n</html>\n" self.wfile.write(ret) def send_config(self): ret = "<html>\n<head>\n<title>WebTorrent++ Configuration</title>\n" ret = ret + "</head>\n<body bgcolor=#%s>\n<form method=post action=\"torrents\">\n" % HTTPConfig.Get('WebColors','ConfBackground') ret = ret + "<table width=100%% border=1 bgcolor=#%s><tr><th colspan=2 align=left>Directories</th></tr>\n" % HTTPConfig.Get('WebColors','ConfTable') ret = ret + "<tr><td>Torrent</td><td width=80%%><input type=text style=\"width:100%%\" name=Paths_Torrent value=\"%s\"></td></tr>\n" % (Config.Get('Paths', 'Torrent')) ret = ret + "<tr><td>History</td><td width=80%%><input type=text style=\"width:100%%\" name=Paths_History value=\"%s\"></td></tr>\n" % (Config.Get('Paths', 'History')) ret = ret + "<tr><td>Incoming</td><td width=80%%><input type=text style=\"width:100%%\" name=Paths_Incoming value=\"%s\"></td></tr>\n" % (Config.Get('Paths', 'Incoming')) ret = ret + "<tr><td>Temp</td><td width=80%%><input type=text style=\"width:100%%\" name=Paths_Temp value=\"%s\"></td></tr>\n" % (Config.Get('Paths', 'Temp')) ret = ret + "</table>\n" ret = ret + "<p><table width=100%% border=1 bgcolor=#%s><tr><th align=left>Basic</th></tr>\n" % HTTPConfig.Get('WebColors','ConfTable') ret = ret + "<tr><td><table border=1 width=100%>" ret = ret + "<tr><td>Automatically start new downloads</td><td width=5%% align=center><input type=checkbox name=Download_AutoStart %s value=\"1\"></td></tr>\n" % (Checked[Config.Get('Download', 'AutoStart')]) ret = ret + "<tr><td>Automatically pause downloads (if current>max)</td><td width=5%% align=center><input type=checkbox name=Download_AutoPause %s value=\"1\"></td></tr>\n" % (Checked[Config.Get('Download', 'AutoPause')]) ret = ret + "<tr><td>Maximal simultanous downloads (1-10)</td><td width=5%%><input type=text style=\"width:100%%\" name=Download_MaxSimDown value=\"%s\"></td></tr>\n" % (Config.Get('Download', 'MaxSimDown')) ret = ret + "</table></td></tr>" ## ret = ret + "<tr><td><table border=1 width=100%>" ## ret = ret + "<tr><td>Automatically pause downloads (if current>max)</td><td width=5%% align=center><input type=checkbox name=Seed_AutoPause %s value=\"1\"></td></tr>\n" % (Checked[HTTPConfig.Get('Seed', 'AutoStart')]) ## ret = ret + "<tr><td>Maximal simultanous downloads (1-10)</td><td width=5%%><input type=text style=\"width:100%%\" name=Seed_MaxSimDown value=\"%s\"></td></tr>\n" % (HTTPConfig.Get('Seed', 'MaxSimSeed')) ## ret = ret + "</table></td></tr>" ret = ret + "<tr><td><table border=1 width=100%>" ret = ret + "<tr><td>Maximal download speed (0=unlimited)</td><td width=5%%><input type=text style=\"width:100%%\" name=Download_MaxSpeedDown value=\"%s\"></td></tr>\n" % (Config.Get('Download', 'MaxSpeedDown')) ret = ret + "<tr><td>Maximal upload speed (0=unlimited)</td><td width=5%%><input type=text style=\"width:100%%\" name=Download_MaxSpeedUp value=\"%s\"></td></tr>\n" % (Config.Get('Download', 'MaxSpeedUp')) ret = ret + "</table></td></tr>" ret = ret + "<tr><td><table border=1 width=100%>" ret = ret + "<tr><td>Use background hashing</td><td width=5%% align=center><input type=checkbox name=Hash_Background %s value=\"1\"></td></tr>\n" % (Checked[Config.Get('Hash', 'Background')]) ret = ret + "<tr><td>Maximal simultanous files hashed (1-5)</td><td width=5%%><input type=text style=\"width:100%%\" name=Hash_NumSimHash value=\"%s\"></td></tr>\n" % (Config.Get('Hash', 'NumSimHash')) ret = ret + "</table></td></tr>" ret = ret + "</table>\n" ret = ret + "<p><table width=100%% border=1 bgcolor=#%s><tr><th align=left>Net Config</th></tr>\n" % HTTPConfig.Get('WebColors','ConfTable') ret = ret + "<tr><td><table border=1 width=100%>" ret = ret + "<tr><td>Bind to IP for BitTorrent (*)</td><td width=10%%><input type=text style=\"width:100%%\" name=Bind_Ip value=\"%s\"></td></tr>\n" % (Config.Get('Bind', 'Ip')) ret = ret + "<tr><td>First Port for BitTorrent (*)</td><td width=5%%><input type=text style=\"width:100%%\" name=Bind_PortMin value=\"%s\"></td></tr>\n" % (Config.Get('Bind', 'PortMin')) ret = ret + "<tr><td>Last Port for BitTorrent (*)</td><td width=5%%><input type=text style=\"width:100%%\" name=Bind_PortMax value=\"%s\"></td></tr>\n" % (Config.Get('Bind', 'PortMax')) ret = ret + "</table></td></tr>" ret = ret + "<tr><td><table border=1 width=100%>" ret = ret + "<tr><td>Bind to IP for webserver (*)</td><td width=10%%><input type=text style=\"width:100%%\" name=Host_IP value=\"%s\"></td></tr>\n" % (HTTPConfig.Get('Host', 'IP')) ret = ret + "<tr><td>Webserver port (*)</td><td width=5%%><input type=text style=\"width:100%%\" name=Host_Port value=\"%s\"></td></tr>\n" % (HTTPConfig.Get('Host', 'Port')) ## ret = ret + "</table></td></tr>" ## ret = ret + "<tr><td><table border=1 width=100%>" ret = ret + "<tr><td>Allow access from localhost</td><td width=5%% align=center><input type=checkbox name=Access_AllowLocal %s value=\"1\"></td></tr>\n" % (Checked[HTTPConfig.Get('Access', 'AllowLocal')]) ret = ret + "<tr><td>Allow access from external IPs (separated by space)</td><td width=30%%><input type=text style=\"width:100%%\" name=Access_ValidIPs value=\"%s\"></td></tr>\n" % (HTTPConfig.Get('Access', 'ValidIPs')) ret = ret + "</table></td></tr>" ret = ret + "<tr><td><table border=1 width=100%>" ret = ret + "<tr><td>Refresh torrent page every (seconds)</td><td width=5%%><input type=text style=\"width:100%%\" name=Display_Refresh value=\"%s\"></td></tr>\n" % (HTTPConfig.Get('Display', 'Refresh')) ret = ret + "<tr><td>Log Level (default = 1)<br>" + LOG_LEVEL_DESC + "</td><td width=5%%><input type=text style=\"width:100%%\" name=Display_LogLevel value=\"%s\"></td></tr>\n" % (HTTPConfig.Get('Display', 'LogLevel')) ret = ret + "<tr><td>Number of kept Log entries (default = 200)</td><td width=5%%><input type=text style=\"width:100%%\" name=Display_LogCount value=\"%s\"></td></tr>\n" % (HTTPConfig.Get('Display', 'LogCount')) ret = ret + "</table></td></tr>" ret = ret + "</table>\n" ret = ret + "(*) changes require restart.\n" ret = ret + "<p><center><input type=hidden name=command value=Config><button type=submit>Submit Changes</button></center>\n</form>\n</body>\n</html>\n" self.wfile.write(ret) def send_log(self): ret = "<html>\n<head>\n<title>WebTorrent++ Log</title>\n" ret = ret + "</head>\n<body bgcolor=#%s>\n" % HTTPConfig.Get('WebColors','LogBackground') ret = ret + "<h1>WebTorrent++ Log</h1>\n<table bgcolor=#%s border=1 cellpadding=4>\n" % HTTPConfig.Get('WebColors','LogTable') t = WebLog[:] try: t.reverse() except: pass for line in t: sp = str(line).split('_',1) ret = ret + "<tr><td nowrap>%s</td><td width=100%%>%s</td></tr>\n" % (sp[0], sp[1]) ret = ret + "</table>\n</body>\n</html>" self.wfile.write(ret) ########################################################################################################### ########################################################################################################### ########################################################################################################### ########################################################################################################### class BTWebServer(HTTPServer): def __init__(self): try: mkdir(Config.Get('Paths', 'Incoming')) except: pass try: mkdir(Config.Get('Paths', 'Torrent')) except: pass try: mkdir(Config.Get('Paths', 'History')) except: pass try: mkdir(Config.Get('Paths', 'Temp')) except: pass self.localIP = socket.gethostbyname(socket.gethostname()) HTTPServer.__init__(self, (HTTPConfig.Get('Host','IP'), int(HTTPConfig.Get('Host', 'Port'))), BTHTTPHandler) def verify_request(self, request, client_address): validIPList = HTTPConfig.Get('Access', 'ValidIPs').split(' ') if int(HTTPConfig.Get('Access', 'AllowLocal')) == 1: validIPList.append(self.localIP) validIPList.append('127.0.0.1') if client_address[0] in validIPList: return 1 else: return 0 def server(self): self.serve_forever() --- NEW FILE: HTTPConfigFile.py --- from ConfigFile import ConfigFile http_cfg_default = { 'Host': { 'IP': '', 'Port': '5080' }, 'Access': { 'ValidIPs': '', 'AllowLocal': '1' }, 'Display': { 'Refresh': '10', 'LogLevel': '1', 'LogCount': '200' }, ## 'Seed': { ## 'AutoStart': 1, ## 'MaxSimSeed': 3 ## }, 'WebColors': { 'MenuBackground': 'FFFFCC', 'MenuAddbar': 'FFCCCC', 'TorrBackground': 'CCCC00', 'TorrFinished': 'FFCCCC', 'TorrAuto': 'CCFFCC', 'TorrNonAuto': 'BFD8BC', 'ConfBackground': '6666AA', 'ConfTable': 'CCCCFF', 'LogBackground': 'AA6666', 'LogTable': 'FF6666' } } HTTPConfig = ConfigFile() HTTPConfig.Read('http.ini') HTTPConfig.InstallDefaults(http_cfg_default) --- NEW FILE: __init__.py --- |
From: <bel...@us...> - 2003-02-25 23:43:20
|
Update of /cvsroot/btplusplus/BT++/src In directory sc8-pr-cvs1:/tmp/cvs-serv4449/src Added Files: BTConstants.py WT++.py Log Message: WebServer & Completed abstraction of LoaderManager --- NEW FILE: BTConstants.py --- false = 0 true = 1 LOG_TRIVIAL = 0 LOG_INFO = 1 LOG_ERROR = 2 LOG_CRITICAL = 3 --- NEW FILE: WT++.py --- #!/usr/bin/python from sys import argv, version, exit from os import path, chdir from shutil import copyfile from ConfigFile import Config from WebServer.BTWebServer import BTWebServer, BTWait from threading import * assert version >= '2', "Install Python 2.0 or greater" if __name__ == '__main__': # Change to the directory of BT++ chdir( path.abspath( path.dirname(argv[0]) ) ) # Copy torrent file if len(argv) == 2: try: copyfile(argv[1], path.join(Config.Get('Paths', 'Torrent'), path.split(argv[1])[1])) except: pass print ("Started") httpd = BTWebServer() httpdth = Thread(target = httpd.server) httpdth.setDaemon(1) httpdth.start() BTWait.wait() |
From: <bel...@us...> - 2003-02-25 23:43:20
|
Update of /cvsroot/btplusplus/BT++/src/TabLog In directory sc8-pr-cvs1:/tmp/cvs-serv4449/src/TabLog Modified Files: LogWindow.py Log Message: WebServer & Completed abstraction of LoaderManager Index: LogWindow.py =================================================================== RCS file: /cvsroot/btplusplus/BT++/src/TabLog/LogWindow.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LogWindow.py 22 Feb 2003 15:53:28 -0000 1.2 --- LogWindow.py 25 Feb 2003 23:43:15 -0000 1.3 *************** *** 1,3 **** --- 1,4 ---- from wxPython.wx import * + from BTConstants import * class LogWindow(wxTextCtrl): *************** *** 15,21 **** _UsedWindow = None ! def Log(text, color = [0,0,0], lbreak = true, window = None): global _UsedWindow if window != None: _UsedWindow = window --- 16,28 ---- _UsedWindow = None ! def Log(text, color = [0,0,0], lbreak = true, window = None, loglevel = LOG_INFO): global _UsedWindow + if loglevel == LOG_TRIVIAL: + return + + if (loglevel > LOG_INFO) and (color == [0,0,0]): + color = [255,0,0] + if window != None: _UsedWindow = window *************** *** 23,24 **** --- 30,34 ---- if _UsedWindow: _UsedWindow.Log(text, color, lbreak) + + if loglevel == LOG_CRITICAL: + wxMessageBox(text) |
From: <bel...@us...> - 2003-02-25 23:43:19
|
Update of /cvsroot/btplusplus/BT++/src/TabTrans In directory sc8-pr-cvs1:/tmp/cvs-serv4449/src/TabTrans Modified Files: Loader.py LoaderManager.py Log Message: WebServer & Completed abstraction of LoaderManager Index: Loader.py =================================================================== RCS file: /cvsroot/btplusplus/BT++/src/TabTrans/Loader.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Loader.py 22 Feb 2003 16:47:48 -0000 1.3 --- Loader.py 25 Feb 2003 23:43:16 -0000 1.4 *************** *** 1,4 **** from ConfigFile import Config, ConfigFile ! from TabLog.LogWindow import Log from os import remove, rename, path, getpid, path, makedirs --- 1,4 ---- from ConfigFile import Config, ConfigFile ! from BTConstants import * from os import remove, rename, path, getpid, path, makedirs *************** *** 25,37 **** from core.bencode import bencode, bdecode - from wxPython.wx import * - ########################################################################################################### ########################################################################################################### class Loader: ! def __init__(self, torrent, globup, refresh): self.Refresh = refresh self.FlagEnd = Event() --- 25,36 ---- from core.bencode import bencode, bdecode ########################################################################################################### ########################################################################################################### class Loader: ! def __init__(self, torrent, globup, refresh, log = None): self.Refresh = refresh + self.Log = log self.FlagEnd = Event() *************** *** 121,124 **** --- 120,124 ---- def StartHashing(self): self.ThrHashing.start() + self.OnTrivialInfo('Hashing started') def StartDownload( self ): *************** *** 132,135 **** --- 132,136 ---- self.ThrDownload.setDaemon(false) self.ThrDownload.start() + self.OnTrivialInfo('Download started') def PauseDownload( self ): *************** *** 145,148 **** --- 146,151 ---- upRate = 0, activity = 'Paused' ) + + self.OnTrivialInfo('Download Paused') ########################################################################################################### *************** *** 200,205 **** if upRate != None: self.Info['SpeedUp'] = float(upRate) / (1 << 10) ! ! self.Refresh() ########################################################################################################### --- 203,211 ---- if upRate != None: self.Info['SpeedUp'] = float(upRate) / (1 << 10) ! ! try: ! self.Refresh() ! except: ! pass ########################################################################################################### *************** *** 250,261 **** try: rename( self.Config['TorFull'], path.join(Config.Get('Paths','History'), self.Config['Tor']) ) except: self.OnError('Could not move torrent.') def OnFail(self, reason, errorfunc = None, doneflag = None): ! wxMessageBox('failed: ' + reason) def OnError(self, ErrorMsg): ! Log( 'Error [' + self.Config['File'] + ']: ' + ErrorMsg, [255,0,0]) ########################################################################################################### --- 256,287 ---- try: rename( self.Config['TorFull'], path.join(Config.Get('Paths','History'), self.Config['Tor']) ) + self.OnInfo( 'Download complete' ) except: self.OnError('Could not move torrent.') def OnFail(self, reason, errorfunc = None, doneflag = None): ! try: ! self.Log( 'Failed [' + self.Config['File'] + ']: ' + reason, loglevel = LOG_CRITICAL) ! except: ! pass def OnError(self, ErrorMsg): ! try: ! self.Log( 'Error [' + self.Config['File'] + ']: ' + ErrorMsg, loglevel = LOG_ERROR) ! except: ! pass ! ! def OnInfo(self, Info): ! try: ! self.Log( '[' + self.Config['File'] + ']: ' + Info, loglevel = LOG_INFO) ! except: ! pass ! ! def OnTrivialInfo(self, Info): ! try: ! self.Log( '[' + self.Config['File'] + ']: ' + Info, loglevel = LOG_TRIVIAL) ! except: ! pass ! ########################################################################################################### *************** *** 334,337 **** --- 360,364 ---- self.FlagHash.set() self.Hashed = true + self.OnTrivialInfo('Hashing complete') ########################################################################################################### Index: LoaderManager.py =================================================================== RCS file: /cvsroot/btplusplus/BT++/src/TabTrans/LoaderManager.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LoaderManager.py 22 Feb 2003 19:02:53 -0000 1.4 --- LoaderManager.py 25 Feb 2003 23:43:16 -0000 1.5 *************** *** 3,11 **** from Loader import Loader from core.CurrentRateMeasure import GlobalMeasure ! ! false = 0 ! true = 1 ! ! from TabLog.LogWindow import Log class LoaderManager: --- 3,7 ---- from Loader import Loader from core.CurrentRateMeasure import GlobalMeasure ! from BTConstants import * class LoaderManager: *************** *** 20,28 **** def CreateNewLoader(self, torrent): try: ! loader = Loader(torrent, self.UpMeasure, self.Refresh) self.Loaders.append( loader ) ! Log( 'Added torrent "' + torrent + '"...' ) except: ! Log( 'Error adding torrent "' + torrent + '"...' ) ########################################################################################################### --- 16,30 ---- def CreateNewLoader(self, torrent): try: ! loader = Loader(torrent, self.UpMeasure, self.Refresh, self.Log) self.Loaders.append( loader ) ! try: ! self.Log( 'Added torrent "' + torrent + '"...', loglevel = LOG_INFO ) ! except: ! pass except: ! try: ! self.Log( 'Error adding torrent "' + torrent + '"...', loglevel = LOG_ERROR ) ! except: ! pass ########################################################################################################### |
From: <bel...@us...> - 2003-02-25 23:40:17
|
Update of /cvsroot/btplusplus/BT++/src/WebServer In directory sc8-pr-cvs1:/tmp/cvs-serv2317/WebServer Log Message: Directory /cvsroot/btplusplus/BT++/src/WebServer added to the repository |
From: <sir...@us...> - 2003-02-24 14:35:55
|
Update of /cvsroot/btplusplus/BT++/src/TabTrans In directory sc8-pr-cvs1:/tmp/cvs-serv12649/src/TabTrans Modified Files: Grid.py Log Message: Added scrolling + Begin/EndDrawing() Index: Grid.py =================================================================== RCS file: /cvsroot/btplusplus/BT++/src/TabTrans/Grid.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Grid.py 23 Feb 2003 21:01:42 -0000 1.6 --- Grid.py 24 Feb 2003 14:35:46 -0000 1.7 *************** *** 16,20 **** def __init__(self, parent): ! wxGrid.__init__(self, parent, -1, wxPoint(0,0), wxSize(786,335), style = (wxSIMPLE_BORDER | wxVSCROLL | wxHSCROLL)) self.RegisterDataType( 'ProgressBar', Renderer.ProgressBar(), None ) --- 16,20 ---- def __init__(self, parent): ! wxGrid.__init__(self, parent, -1, wxPoint(0,0), wxSize(786,335), style = wxSIMPLE_BORDER) self.RegisterDataType( 'ProgressBar', Renderer.ProgressBar(), None ) *************** *** 105,108 **** --- 105,109 ---- } + EVT_ERASE_BACKGROUND( self, self.OnEraseBg ) EVT_PAINT( self, self.OnPaint ) EVT_SIZE( self, self.OnSize ) *************** *** 212,227 **** ########################################################################################################### def OnPaint(self, evt = None): if self.IsShown() == false: return - try: dc = self.BufferDC ! # Clear background dc.SetBackground( self.DrawTools['EmptyBackground'] ) dc.Clear() ! # Draw the selections dc.SetPen( self.DrawTools['HighlightOutline'] ) --- 213,237 ---- ########################################################################################################### + def OnEraseBg(self, evt): + pass + def OnPaint(self, evt = None): if self.IsShown() == false: return try: + scx, scy = self.GetViewStart() + unx, uny = self.GetScrollPixelsPerUnit() + + scx = -scx * unx + scy = -scy * uny + dc = self.BufferDC ! dc.BeginDrawing() ! # Clear background dc.SetBackground( self.DrawTools['EmptyBackground'] ) dc.Clear() ! # Draw the selections dc.SetPen( self.DrawTools['HighlightOutline'] ) *************** *** 233,238 **** wxGridCellCoords(sel[len(sel)-1], 6) ) ! dc.DrawRectangle( rect.x + 2, ! rect.y + 20, rect.width + 21, rect.height - 5 ) --- 243,248 ---- wxGridCellCoords(sel[len(sel)-1], 6) ) ! dc.DrawRectangle( scx + rect.x + 2, ! scy + rect.y + 20, rect.width + 21, rect.height - 5 ) *************** *** 256,272 **** x = x + self.GetColSize(col) ! dc.DrawRectangle( rect.x + 25, ! rect.y, rect.width, rect.height ) dc.DrawText( self.Table.GetColLabelValue(col), ! rect.x + 29, ! rect.y + 2 ) # Draw the row 'labels' for row in numrows: ! dc.DrawBitmap( self.DrawTools['ArrowBitmap'], 0, y + 20, true ) y = y + self.GetRowSize(row) --- 266,282 ---- x = x + self.GetColSize(col) ! dc.DrawRectangle( scx + rect.x + 25, ! scy + rect.y, rect.width, rect.height ) dc.DrawText( self.Table.GetColLabelValue(col), ! scx + rect.x + 29, ! scy + rect.y + 2 ) # Draw the row 'labels' for row in numrows: ! dc.DrawBitmap( self.DrawTools['ArrowBitmap'], scx, scy + y + 20, true ) y = y + self.GetRowSize(row) *************** *** 280,285 **** None, dc, ! wxRect( rect.x + 25, ! rect.y + 18, rect.width, rect.height ), --- 290,295 ---- None, dc, ! wxRect( scx + rect.x + 25, ! scy + rect.y + 18, rect.width, rect.height ), *************** *** 289,296 **** --- 299,309 ---- + dc.EndDrawing() w, h = dc.GetSizeTuple() ondc = wxClientDC(self) + ondc.BeginDrawing() ondc.Blit(0, 0, w, h, dc, 0, 0 ) + ondc.EndDrawing() except: pass |
From: <sir...@us...> - 2003-02-23 21:06:37
|
Update of /cvsroot/btplusplus/BT++/dist In directory sc8-pr-cvs1:/tmp/cvs-serv24152/dist Modified Files: README.txt Log Message: Some changes + the Changelog has been removed, it will be put in a seperate file soon. Index: README.txt =================================================================== RCS file: /cvsroot/btplusplus/BT++/dist/README.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** README.txt 14 Feb 2003 22:03:44 -0000 1.8 --- README.txt 23 Feb 2003 21:06:34 -0000 1.9 *************** *** 4,9 **** | Latest Version: http://sf.net/projects/btplusplus/ | | | ! | Copyright (c) 2002 Florian "SirElvis" Wagner | | Contact: sir...@gm... | +----------------------------------------------------------------------+ | This file is part of BitTorrent++. | --- 4,13 ---- | Latest Version: http://sf.net/projects/btplusplus/ | | | ! | Copyright (c) 2003 Florian "SirElvis" Wagner | ! | and | ! | Joshua "xamphear" Cantara | ! | | | Contact: sir...@gm... | + | jca...@gr... | +----------------------------------------------------------------------+ | This file is part of BitTorrent++. | *************** *** 28,33 **** | All Rights Reserved. | | | ! | A copy of the license can be found in the file | ! | 'LICENSE-BitTorrent++.txt'. | +----------------------------------------------------------------------+ | All files contained in the 'core' subdirectory of BitTorrent++ are | --- 32,36 ---- | All Rights Reserved. | | | ! | A copy of the license can be found in the file 'LICENSE.rtf'. | +----------------------------------------------------------------------+ | All files contained in the 'core' subdirectory of BitTorrent++ are | *************** *** 38,43 **** | Copyright (C) 2001-2002 Bram Cohen | | | ! | A copy of the license can be found in the file | ! | 'LICENSE-BitTorrent.txt'. | +----------------------------------------------------------------------+ --- 41,45 ---- | Copyright (C) 2001-2002 Bram Cohen | | | ! | A copy of the license can be found in the file 'LICENSE.rtf'. | +----------------------------------------------------------------------+ *************** *** 66,70 **** 3 - Install wxPython(http://www.wxpython.org) 4 - Unpack the tar.gz / tar.bz ! 5 - run 'python BT++.py' ************************ --- 68,72 ---- 3 - Install wxPython(http://www.wxpython.org) 4 - Unpack the tar.gz / tar.bz ! 5 - use 'run.sh' to start BT++ ************************ *************** *** 72,84 **** ************************ ! When starting the tool the first time it will create two subdirectories. In the one, called 'torrent', you have to put the downloaded torrent ! files. The other, called 'incoming', will be filled with the downloaded ! files. ! ! Depending on your settings BT++ will start new downloads automatically, ! but allways will start hashing your files. One at a time, except ! downloads that are not already hashed are started(there WILL be an ! option to turn this behaviour off). There is some kind of priority implemented. If set to auto download BT++ --- 74,85 ---- ************************ ! When starting the tool the first time it will create four subdirectories. In the one, called 'torrent', you have to put the downloaded torrent ! files. Files that are currently downloaded are put in the 'temp' dir and ! moved to 'incoming' after they are finished. 'history' will contain all ! the torrents of finished files. ! ! Depending on your settings BT++ will start new downloads and background ! hashing automatically. There is some kind of priority implemented. If set to auto download BT++ *************** *** 86,144 **** by draging and droping the number at the very left of the grid, or by using the 'Move Up/Down' options in the right-click-popup. - - ************************ - *** CHANGELOG *** - ************************ - - [0.4.0 (alpha)] - - - associate BT++ with .torrent files - - new preference options - - improvements of the tray icon - - refreshing of torrent folder - - added incoming and history folder - - about dialog - - new, much better looking icons - - context-sensitive help - - configurable background hashing - - improved handling of not valid/damaged torrents - - grid right click menu improvements - - add torrent from url / local file - - global upload rate restriction settings - - extremly simple progress bars - - many, many bugfixes - - [0.3.0 (alpha)] - - - now uses a grid instead of a tree for transfers - - many cosmetic changes and improvements - - file priority - - some major rewrites and code cleanups - - new important features, like up/down speed coming soon - (fundation has been set through rewrites) - - some fixes, but rewrite will surely have introduced new bugs - - [0.2.1 (alpha)] - - - bugfix for torrents containing multiple files - - validator for the preference window - - log window now read only - - [0.2.0 (alpha)] - - - Linux compatibility - - Added: Preference dialog. - - Added: Class for reading and wiriting to the config file. - - Buttons for preference window, collaps/expand all. - - Respect preferences from config file when starting download - - Fixes for some bugs introduced with the latest features. - - Cosmetic changes. - - Tree: Right click menu implemented(only pause/resume). - - Colors in log window(not yet used). - - [0.1.0 (alpha)] - - - first public release - - first set of functions works - - tool is usable - - there ARE bugs and problems --- 87,88 ---- |
From: <sir...@us...> - 2003-02-23 21:01:49
|
Update of /cvsroot/btplusplus/BT++/src/TabTrans In directory sc8-pr-cvs1:/tmp/cvs-serv22167/src/TabTrans Modified Files: Grid.py Log Message: The painting of the window is now encapsulated by a try - except block. Trivial errors, that are likely to occure when drawing are thus ignored. The grid is redrawn pretty frequent, so one draw failing shouldn't matter. Index: Grid.py =================================================================== RCS file: /cvsroot/btplusplus/BT++/src/TabTrans/Grid.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Grid.py 22 Feb 2003 21:12:30 -0000 1.5 --- Grid.py 23 Feb 2003 21:01:42 -0000 1.6 *************** *** 212,298 **** ########################################################################################################### ! def OnPaint(self, evt): if self.IsShown() == false: return - if self.Table.GetNumberCols() == 0 or \ - self.Table.GetNumberRows() == 0: - return - - dc = self.BufferDC - - # Clear background - dc.SetBackground( self.DrawTools['EmptyBackground'] ) - dc.Clear() - - # Draw the selections - dc.SetPen( self.DrawTools['HighlightOutline'] ) - dc.SetBrush( self.DrawTools['HighlightColor'] ) - - if self.currentSelection != []: - sel = self.currentSelection - rect = self.BlockToDeviceRect( wxGridCellCoords(sel[0], 0), - wxGridCellCoords(sel[len(sel)-1], 6) ) - - dc.DrawRectangle( rect.x + 2, - rect.y + 20, - rect.width + 21, - rect.height - 5 ) ! numcols = range(self.Table.GetNumberCols()) ! numrows = range(self.Table.GetNumberRows()) ! x = 0 ! y = 0 ! ! # Draw the col labels ! dc.SetPen( self.DrawTools['HighlightOutline'] ) ! dc.SetBrush( self.DrawTools['HighlightColor'] ) ! ! dc.SetTextForeground( self.DrawTools['LabelFontColor'] ) ! dc.SetFont( self.DrawTools['LabelFont'] ) ! ! for col in numcols: ! rect = wxRect( x, 0, self.GetColSize(col), 18 ) ! x = x + self.GetColSize(col) ! dc.DrawRectangle( rect.x + 25, ! rect.y, ! rect.width, ! rect.height ) ! dc.DrawText( self.Table.GetColLabelValue(col), ! rect.x + 29, ! rect.y + 2 ) ! ! # Draw the row 'labels' ! for row in numrows: ! ! dc.DrawBitmap( self.DrawTools['ArrowBitmap'], 0, y + 20, true ) ! y = y + self.GetRowSize(row) ! ! for col in numcols: ! for row in numrows: ! rect = self.CellToRect(row, col) ! rend = self.GetCellRenderer(row, col) ! rend.Draw( self, ! None, ! dc, ! wxRect( rect.x + 25, ! rect.y + 18, ! rect.width, ! rect.height ), ! row, ! col, ! true ) ! ! w, h = dc.GetSizeTuple() - ondc = wxClientDC(self) - ondc.Blit(0, 0, w, h, dc, 0, 0 ) def OnSize(self, evt): --- 212,299 ---- ########################################################################################################### ! def OnPaint(self, evt = None): if self.IsShown() == false: return ! try: ! dc = self.BufferDC ! # Clear background ! dc.SetBackground( self.DrawTools['EmptyBackground'] ) ! dc.Clear() ! # Draw the selections ! dc.SetPen( self.DrawTools['HighlightOutline'] ) ! dc.SetBrush( self.DrawTools['HighlightColor'] ) ! ! if self.currentSelection != []: ! sel = self.currentSelection ! rect = self.BlockToDeviceRect( wxGridCellCoords(sel[0], 0), ! wxGridCellCoords(sel[len(sel)-1], 6) ) ! ! dc.DrawRectangle( rect.x + 2, ! rect.y + 20, ! rect.width + 21, ! rect.height - 5 ) ! ! numcols = range(self.Table.GetNumberCols()) ! numrows = range(self.Table.GetNumberRows()) ! ! x = 0 ! y = 0 ! # Draw the col labels ! dc.SetPen( self.DrawTools['HighlightOutline'] ) ! dc.SetBrush( self.DrawTools['HighlightColor'] ) ! ! dc.SetTextForeground( self.DrawTools['LabelFontColor'] ) ! dc.SetFont( self.DrawTools['LabelFont'] ) ! for col in numcols: ! rect = wxRect( x, 0, self.GetColSize(col), 18 ) ! x = x + self.GetColSize(col) ! dc.DrawRectangle( rect.x + 25, ! rect.y, ! rect.width, ! rect.height ) ! ! dc.DrawText( self.Table.GetColLabelValue(col), ! rect.x + 29, ! rect.y + 2 ) ! ! # Draw the row 'labels' ! for row in numrows: ! ! dc.DrawBitmap( self.DrawTools['ArrowBitmap'], 0, y + 20, true ) ! y = y + self.GetRowSize(row) ! ! for col in numcols: ! for row in numrows: ! ! rect = self.CellToRect(row, col) ! rend = self.GetCellRenderer(row, col) ! ! rend.Draw( self, ! None, ! dc, ! wxRect( rect.x + 25, ! rect.y + 18, ! rect.width, ! rect.height ), ! row, ! col, ! true ) ! ! ! w, h = dc.GetSizeTuple() ! ondc = wxClientDC(self) ! ondc.Blit(0, 0, w, h, dc, 0, 0 ) ! except: ! pass def OnSize(self, evt): |