From 8556404b6846e07a2be5ac054d62c0845f71c4c4 Mon Sep 17 00:00:00 2001 From: Gra Date: Sat, 25 Apr 2009 10:05:06 +0200 Subject: [PATCH] Reworked the comments (79 cols). --- imagecapture.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/imagecapture.py b/imagecapture.py index 8b86c4f..2ffd6ed 100644 --- a/imagecapture.py +++ b/imagecapture.py @@ -57,7 +57,8 @@ class ImageWriter(threading.Thread): Point(self.settings['Image Capture']['Capture Clicks Width'], self.settings['Image Capture']['Capture Clicks Height']) - self.filter = re.compile(r"[\\\/\:\*\?\"\<\>\|]+") #regexp filter for the non-allowed characters in windows filenames. + # Regexp filter for the non-allowed characters in windows filenames. + self.filter = re.compile(r"[\\\/\:\*\?\"\<\>\|]+") # Hook to our display. if os.name == 'posix': @@ -90,7 +91,8 @@ class ImageWriter(threading.Thread): self.logger = logging.getLogger('imagewriter') self.logger.setLevel(logging.DEBUG) - # create the "debug" handler - output messages to the console, to stderr, if debug option is set + # Create the "debug" handler - output messages to the console, + # to stderr, if debug option is set. if self.cmdoptions.debug: loglevel = logging.DEBUG else: @@ -148,7 +150,9 @@ class ImageWriter(threading.Thread): AllPlanes = ~0 - try: #cropbox.topleft.x, cropbox.topleft.y, cropbox.size.x, cropbox.size.y, self.savefilename + try: + # cropbox.topleft.x, cropbox.topleft.y, + # cropbox.size.x, cropbox.size.y, self.savefilename raw = self.rootwin.get_image(cropbox.topleft.x, cropbox.topleft.y, cropbox.size.x, cropbox.size.y, X.ZPixmap, AllPlanes) Image.fromstring("RGBX", (cropbox.size.x, cropbox.size.y), raw.data, "raw", "BGRX").convert("RGB").save(savefilename, quality=self.settings['Image Capture']['Capture Clicks Image Quality']) return 0 @@ -183,15 +187,18 @@ class ImageWriter(threading.Thread): try: threadpid, procpid = win32process.GetWindowThreadProcessId(hwnd) - # PROCESS_QUERY_INFORMATION (0x0400) or PROCESS_VM_READ (0x0010) or PROCESS_ALL_ACCESS (0x1F0FFF) + # PROCESS_QUERY_INFORMATION (0x0400) or + # PROCESS_VM_READ (0x0010) or + # PROCESS_ALL_ACCESS (0x1F0FFF) mypyproc = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, False, procpid) procname = win32process.GetModuleFileNameEx(mypyproc, 0) return procname except: #self.logger.error("Failed to get process info from hwnd.", exc_info=sys.exc_info()) - # this happens frequently enough - when the last event caused the closure of the window or program - # so we just return a nice string and don't worry about it. + # This happens frequently enough - when the last event caused + # the closure of the window or program so we just return a nice + # string and don't worry about it. return "noprocname" elif os.name == 'posix': return str(event.WindowProcName) -- 2.45.1