Another try at sussing the Quartz bindings.

This commit is contained in:
Eratosthenes 2010-12-18 10:04:34 -05:00
parent 16da7ceda7
commit 3b6867df29

View File

@ -31,7 +31,7 @@ import os
import gtk import gtk
# Other Library modules # Other Library modules
from Quartz import CoreGraphics from Quartz.CoreGraphics import *
# FPDB modules # FPDB modules
from TableWindow import Table_Window from TableWindow import Table_Window
@ -45,39 +45,39 @@ class Table(Table_Window):
# self.window, and self.parent (if required). # self.window, and self.parent (if required).
self.number = None self.number = None
WinList = CoreGraphics.CGWindowListCreate(0,0) WinList = CGWindowListCreate(0,0)
WinListDict = CoreGraphics.CGWindowListCreateDescriptionFromArray(WinList) WinListDict = CGWindowListCreateDescriptionFromArray(WinList)
for d in WinListDict: for d in WinListDict:
if re.search(self.search_string, d['kCGWindowName'], re.I): if re.search(self.search_string, d[kCGWindowName], re.I):
title = d['kCGWindowName'] title = d[kCGWindowName]
if self.check_bad_words(title): continue if self.check_bad_words(title): continue
self.number = d['kCGWindowNumber'] self.number = d[kCGWindowNumber]
self.title = title self.title = title
if self.number is None: if self.number is None:
return None return None
def get_geometry(self): def get_geometry(self):
WinList = CoreGraphics.CGWindowListCreate(0,0) WinList = CGWindowListCreate(0,0)
WinListDict = CoreGraphics.CGWindowListCreateDescriptionFromArray(WinList) WinListDict = CGWindowListCreateDescriptionFromArray(WinList)
for d in WinListDict: for d in WinListDict:
if d['kCGWindowNumber'] == self.number: if d[CGWindowNumber] == self.number:
return {'x' : d['kCGWindowBounds']['X'], return {'x' : d[kCGWindowBounds][X],
'y' : d['kCGWindowBounds']['Y'], 'y' : d[kCGWindowBounds][Y],
'width' : d['kCGWindowBounds']['Width'], 'width' : d[kCGWindowBounds][Width],
'height' : d['kCGWindowBounds']['Height'] 'height' : d[kCGWindowBounds][Height]
} }
return None return None
def get_window_title(self): def get_window_title(self):
WinList = CoreGraphics.CGWindowListCreate(0,0) WinList = CGWindowListCreate(0,0)
WinListDict = CoreGraphics.CGWindowListCreateDescriptionFromArray(WinList) WinListDict = CGWindowListCreateDescriptionFromArray(WinList)
for d in WinListDict: for d in WinListDict:
if d['kCGWindowNumber'] == self.number: if d[kCGWindowNumber] == self.number:
return d['kCGWindowName'] return d[kCGWindowName]
return None return None
def topify(self, window): def topify(self, window):