[Pypt-offline-general] SF.net SVN: pypt-offline: [134] trunk
Status: Beta
Brought to you by:
riteshsarraf
|
From: <rit...@us...> - 2007-03-22 11:02:59
|
Revision: 134
http://svn.sourceforge.net/pypt-offline/?rev=134&view=rev
Author: riteshsarraf
Date: 2007-03-22 04:02:57 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
* Fixed color display on Microsoft Windows. Will need more beautification
Modified Paths:
--------------
trunk/TODO
trunk/pypt_core.py
Property Changed:
----------------
trunk/
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
- .project
+ .project
.pydevproject
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2007-03-22 10:06:03 UTC (rev 133)
+++ trunk/TODO 2007-03-22 11:02:57 UTC (rev 134)
@@ -11,4 +11,5 @@
is selected the others will be deactivated. That's design, only one option allowed a time. :-)
* Use Python's logging module to better handle messages, warnings and errors <done>
* Implement apt's newly added feature (> 0.6.4) of Package Diff
-* Add functionality for Offline Bug Reports
\ No newline at end of file
+* Add functionality for Offline Bug Reports
+* Handle KeyboardInterrupt exception in threads so that if the user sends an interrupt signal, the program should exit
\ No newline at end of file
Modified: trunk/pypt_core.py
===================================================================
--- trunk/pypt_core.py 2007-03-22 10:06:03 UTC (rev 133)
+++ trunk/pypt_core.py 2007-03-22 11:02:57 UTC (rev 134)
@@ -19,6 +19,12 @@
except ImportError:
pass
+WindowColor = True
+try:
+ import WConio
+except ImportError:
+ WindowColor = False
+
'''This is the core module. It does the main job of downloading packages/update packages,\nfiguring out if the packages are in the local cache, handling exceptions and many more stuff'''
@@ -118,12 +124,7 @@
Light Cyan = 11
'''
- try:
- import WConio
- except ImportError:
- WindowColor = False
-
- def __init__(self, warnings, verbose):
+ def __init__(self, warnings, verbose, color = None):
if warnings is True:
self.WARN = True
@@ -133,14 +134,16 @@
self.VERBOSE = True
else: self.VERBOSE = False
+ self.color = color
+
def msg(self, msg):
- if self.WindowColor:
+ if self.color:
WConio.textcolor(15)
sys.stdout.write(msg)
sys.stdout.flush()
def err(self, msg):
- if self.WindowColor:
+ if self.color:
WConio.textcolor(4)
sys.stderr.write(msg)
sys.stderr.flush()
@@ -148,14 +151,14 @@
# For the rest, we need to check the options also
def warn(self, msg):
if self.WARN is True:
- if self.WindowColor:
+ if self.color:
WConio.textcolor(12)
sys.stderr.write(msg)
sys.stderr.flush()
def verbose(self, msg):
if self.VERBOSE is True:
- if self.WindowColor:
+ if self.color:
WConio.textcolor(11)
sys.stdout.write(msg)
sys.stdout.flush()
@@ -623,6 +626,8 @@
log.err("Couldn't archive %s to file %s.\n" % (file, ArgumentOptions.zip_update_file) )
sys.exit(1)
os.unlink(os.path.join(download_path, file) )
+ else:
+ errlist.append(file)
elif key == 'Upgrade':
response.put(func(cache_dir, file) )
@@ -878,7 +883,7 @@
# The log implementation
# Instantiate the class
global log
- log = Log(options.warnings, options.verbose)
+ log = Log(options.warnings, options.verbose, WindowColor)
log.msg("pypt-offline %s\n" % (version))
log.msg("Copyright %s\n" % (copyright))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|