Merge branch 'master' of git://git.assembla.com/free_poker_tools.git
This commit is contained in:
commit
40b1551036
|
@ -44,9 +44,11 @@ import Options
|
||||||
(options, argv) = Options.fpdb_options()
|
(options, argv) = Options.fpdb_options()
|
||||||
|
|
||||||
# get the correct module for the current os
|
# get the correct module for the current os
|
||||||
if os.name == 'posix':
|
if sys.platform == 'linux2':
|
||||||
import XTables as Tables
|
import XTables as Tables
|
||||||
elif os.name == 'nt':
|
elif sys.platform == 'darwin':
|
||||||
|
import OSXTables as Tables
|
||||||
|
else: # This is bad--figure out the values for the various windows flavors
|
||||||
import WinTables as Tables
|
import WinTables as Tables
|
||||||
|
|
||||||
import locale
|
import locale
|
||||||
|
|
|
@ -32,6 +32,8 @@ import sys
|
||||||
import pygtk
|
import pygtk
|
||||||
import gtk
|
import gtk
|
||||||
import gobject
|
import gobject
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
# FreePokerTools modules
|
# FreePokerTools modules
|
||||||
from Mucked import Aux_Window
|
from Mucked import Aux_Window
|
||||||
|
|
90
pyfpdb/OSXTables.py
Normal file
90
pyfpdb/OSXTables.py
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""XWindows specific methods for TableWindows Class.
|
||||||
|
"""
|
||||||
|
# Copyright 2008 - 2010, Ray E. Barker
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
|
# Standard Library modules
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
|
# pyGTK modules
|
||||||
|
import gtk
|
||||||
|
|
||||||
|
# Other Library modules
|
||||||
|
from Quartz.CoreGraphics import *
|
||||||
|
|
||||||
|
# FPDB modules
|
||||||
|
from TableWindow import Table_Window
|
||||||
|
|
||||||
|
class Table(Table_Window):
|
||||||
|
|
||||||
|
def find_table_parameters(self):
|
||||||
|
|
||||||
|
# This is called by __init__(). Find the poker table window of interest,
|
||||||
|
# given the self.search_string. Then populate self.number, self.title,
|
||||||
|
# self.window, and self.parent (if required).
|
||||||
|
|
||||||
|
self.number = None
|
||||||
|
WinList = CGWindowListCreate(0,0)
|
||||||
|
WinListDict = CGWindowListCreateDescriptionFromArray(WinList)
|
||||||
|
|
||||||
|
for d in WinListDict:
|
||||||
|
if re.search(self.search_string, d.get(kCGWindowName, ""), re.I):
|
||||||
|
title = d[kCGWindowName]
|
||||||
|
if self.check_bad_words(title): continue
|
||||||
|
self.number = d[kCGWindowNumber]
|
||||||
|
self.title = title
|
||||||
|
if self.number is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_geometry(self):
|
||||||
|
|
||||||
|
WinList = CGWindowListCreate(0,0)
|
||||||
|
WinListDict = CGWindowListCreateDescriptionFromArray(WinList)
|
||||||
|
|
||||||
|
for d in WinListDict:
|
||||||
|
if d[CGWindowNumber] == self.number:
|
||||||
|
return {'x' : d[kCGWindowBounds][X],
|
||||||
|
'y' : d[kCGWindowBounds][Y],
|
||||||
|
'width' : d[kCGWindowBounds][Width],
|
||||||
|
'height' : d[kCGWindowBounds][Height]
|
||||||
|
}
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_window_title(self):
|
||||||
|
WinList = CGWindowListCreate(0,0)
|
||||||
|
WinListDict = CGWindowListCreateDescriptionFromArray(WinList)
|
||||||
|
|
||||||
|
for d in WinListDict:
|
||||||
|
if d[kCGWindowNumber] == self.number:
|
||||||
|
return d[kCGWindowName]
|
||||||
|
return None
|
||||||
|
|
||||||
|
def topify(self, window):
|
||||||
|
# The idea here is to call set_transient_for on the HUD window, with the table window
|
||||||
|
# as the argument. This should keep the HUD window on top of the table window, as if
|
||||||
|
# the hud window was a dialog belonging to the table.
|
||||||
|
|
||||||
|
# This is the gdkhandle for the HUD window
|
||||||
|
gdkwindow = gtk.gdk.window_foreign_new(window.number)
|
||||||
|
gdkwindow.set_transient_for(self.gdkhandle)
|
|
@ -22,12 +22,8 @@ Main program module to test/demo the Tables subclasses.
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
import L10n
|
|
||||||
_ = L10n.get_translation()
|
|
||||||
|
|
||||||
# Standard Library modules
|
# Standard Library modules
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
|
|
||||||
# pyGTK modules
|
# pyGTK modules
|
||||||
import pygtk
|
import pygtk
|
||||||
|
@ -36,11 +32,15 @@ import gobject
|
||||||
|
|
||||||
# fpdb/free poker tools modules
|
# fpdb/free poker tools modules
|
||||||
import Configuration
|
import Configuration
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
# get the correct module for the current os
|
# get the correct module for the current os
|
||||||
if os.name == 'posix':
|
if sys.platform == 'linux2':
|
||||||
import XTables as Tables
|
import XTables as Tables
|
||||||
elif os.name == 'nt':
|
elif sys.platform == 'darwin':
|
||||||
|
import OSXTables as Tables
|
||||||
|
else: # This is bad--figure out the values for the various windows flavors
|
||||||
import WinTables as Tables
|
import WinTables as Tables
|
||||||
|
|
||||||
config = Configuration.Config()
|
config = Configuration.Config()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user