2 new revisions:
Revision: 3905eaea74d1
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Sat May 3 09:09:08 2014 UTC
Log: Only set the mouse visible/hidden if there's a window....
http://code.google.com/p/pyglet/source/detail?r=3905eaea74d1
Revision: 18920e80968d
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Thu May 8 06:02:29 2014 UTC
Log: Support copatible platforms (eg, BSD systems as Linux)...
http://code.google.com/p/pyglet/source/detail?r=18920e80968d
==============================================================================
Revision: 3905eaea74d1
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Sat May 3 09:09:08 2014 UTC
Log: Only set the mouse visible/hidden if there's a window.
Fixes issue #739.
http://code.google.com/p/pyglet/source/detail?r=3905eaea74d1
Modified:
/pyglet/window/__init__.py
=======================================
--- /pyglet/window/__init__.py Sat Dec 7 21:49:17 2013 UTC
+++ /pyglet/window/__init__.py Sat May 3 09:09:08 2014 UTC
@@ -1040,7 +1040,8 @@
'''
self._mouse_visible = visible
- self.set_mouse_platform_visible()
+ if self._window:
+ self.set_mouse_platform_visible()
def set_mouse_platform_visible(self, platform_visible=None):
'''Set the platform-drawn mouse cursor visibility. This is called
==============================================================================
Revision: 18920e80968d
Branch: default
Author: Juan J. Martínez <
j...@usebox.net>
Date: Thu May 8 06:02:29 2014 UTC
Log: Support copatible platforms (eg, BSD systems as Linux)
Fixes issue #634
http://code.google.com/p/pyglet/source/detail?r=18920e80968d
Modified:
/doc/programming_guide/gl.txt
/pyglet/__init__.py
/pyglet/app/__init__.py
/pyglet/canvas/__init__.py
/pyglet/clock.py
/pyglet/font/__init__.py
/pyglet/gl/__init__.py
/pyglet/gl/base.py
/pyglet/gl/lib.py
/pyglet/image/codecs/__init__.py
/pyglet/info.py
/pyglet/input/__init__.py
/pyglet/lib.py
/pyglet/media/avbin.py
/pyglet/media/drivers/openal/__init__.py
/pyglet/resource.py
/pyglet/window/__init__.py
/pyglet/window/key.py
/pyglet/window/win32/__init__.py
/tests/image/PLATFORM_LA_LOAD.py
/tests/image/PLATFORM_L_LOAD.py
/tests/image/PLATFORM_RGBA_LOAD.py
/tests/test.py
/tools/genwrappers.py
=======================================
--- /doc/programming_guide/gl.txt Wed Jun 25 23:34:42 2008 UTC
+++ /doc/programming_guide/gl.txt Thu May 8 06:02:29 2014 UTC
@@ -203,13 +203,17 @@
``pyglet.gl.wgl``. You must only import the correct module for the running
operating system::
- if sys.platform == 'linux2':
+ if sys.platform.startswith('linux'):
from pyglet.gl.glx import *
glxCreatePbuffer(...)
elif sys.platform == 'darwin':
from pyglet.gl.agl import *
aglCreatePbuffer(...)
+Alternativally you can use ``pyglet.compat_platform`` to support platforms
that are
+compatible with platforms not officially supported by pyglet. For example
+FreeBSD systems will appear as ``linux-compat`` in
``pyglet.compat_platform``.
+
There are convenience modules for querying the version and extensions of
WGL
and GLX named ``pyglet.gl.wgl_info`` and ``pyglet.gl.glx_info``,
respectively.
AGL does not have such a module, just query the version of OS X instead.
=======================================
--- /pyglet/__init__.py Sat Dec 7 19:02:32 2013 UTC
+++ /pyglet/__init__.py Thu May 8 06:02:29 2014 UTC
@@ -59,6 +59,11 @@
#:
version = '1.2alpha1'
+# Pyglet platform treats *BSD systems as Linux
+compat_platform = sys.platform
+if "bsd" in compat_platform:
+ compat_platform = "linux-compat"
+
def _require_ctypes_version(version):
# Check ctypes version
import ctypes
@@ -197,7 +202,7 @@
def _choose_darwin_platform():
"""Choose between Darwin's Carbon and Cocoa implementations."""
- if sys.platform != 'darwin':
+ if compat_platform != 'darwin':
return
import struct
numbits = 8*struct.calcsize("P")
@@ -227,7 +232,7 @@
pass
_read_environment()
-if sys.platform == 'cygwin':
+if compat_platform == 'cygwin':
# This hack pretends that the posix-like ctypes provides windows
# functionality. COM does not work with this hack, so there is no
# DirectSound support.
=======================================
--- /pyglet/app/__init__.py Sat Dec 14 16:28:07 2013 UTC
+++ /pyglet/app/__init__.py Thu May 8 06:02:29 2014 UTC
@@ -157,16 +157,17 @@
event_loop.exit()
from pyglet.app.base import EventLoop
+from pyglet import compat_platform
if _is_epydoc:
from pyglet.app.base import PlatformEventLoop
else:
- if sys.platform == 'darwin':
+ if compat_platform == 'darwin':
from pyglet import options as pyglet_options
if pyglet_options['darwin_cocoa']:
from pyglet.app.cocoa import CocoaEventLoop as
PlatformEventLoop
else:
from pyglet.app.carbon import CarbonEventLoop as
PlatformEventLoop
- elif sys.platform in ('win32', 'cygwin'):
+ elif compat_platform in ('win32', 'cygwin'):
from pyglet.app.win32 import Win32EventLoop as PlatformEventLoop
else:
from pyglet.app.xlib import XlibEventLoop as PlatformEventLoop
=======================================
--- /pyglet/canvas/__init__.py Sat Dec 14 16:59:18 2013 UTC
+++ /pyglet/canvas/__init__.py Thu May 8 06:02:29 2014 UTC
@@ -84,7 +84,8 @@
if _is_epydoc:
from pyglet.canvas.base import Display, Screen, Canvas, ScreenMode
else:
- if sys.platform == 'darwin':
+ from pyglet import compat_platform
+ if compat_platform == 'darwin':
from pyglet import options as pyglet_options
if pyglet_options['darwin_cocoa']:
from pyglet.canvas.cocoa import CocoaDisplay as Display
@@ -94,7 +95,7 @@
from pyglet.canvas.carbon import CarbonDisplay as Display
from pyglet.canvas.carbon import CarbonScreen as Screen
from pyglet.canvas.carbon import CarbonCanvas as Canvas
- elif sys.platform in ('win32', 'cygwin'):
+ elif compat_platform in ('win32', 'cygwin'):
from pyglet.canvas.win32 import Win32Display as Display
from pyglet.canvas.win32 import Win32Screen as Screen
from pyglet.canvas.win32 import Win32Canvas as Canvas
=======================================
--- /pyglet/clock.py Wed Oct 2 17:12:15 2013 UTC
+++ /pyglet/clock.py Thu May 8 06:02:29 2014 UTC
@@ -142,12 +142,12 @@
__version__ = '$Id$'
import time
-import sys
import ctypes
import pyglet.lib
+from pyglet import compat_platform
-if sys.platform in ('win32', 'cygwin'):
+if compat_platform in ('win32', 'cygwin'):
# Win32 Sleep function is only 10-millisecond resolution, so instead
# use a waitable timer object, which has up to 100-nanosecond
resolution
# (hardware and implementation dependent, of course).
@@ -943,6 +943,7 @@
def test_clock():
import getopt
+ import sys
test_seconds = 1
test_fps = 60
show_fps = False
=======================================
--- /pyglet/font/__init__.py Wed Nov 7 14:27:00 2012 UTC
+++ /pyglet/font/__init__.py Thu May 8 06:02:29 2014 UTC
@@ -565,14 +565,14 @@
self._layout.draw()
if not getattr(sys, 'is_epydoc', False):
- if sys.platform == 'darwin':
+ if pyglet.compat_platform == 'darwin':
if pyglet.options['darwin_cocoa']:
from pyglet.font.quartz import QuartzFont
_font_class = QuartzFont
else:
from pyglet.font.carbon import CarbonFont
_font_class = CarbonFont
- elif sys.platform in ('win32', 'cygwin'):
+ elif pyglet.compat_platform in ('win32', 'cygwin'):
if pyglet.options['font'][0] == 'win32':
from pyglet.font.win32 import Win32Font
_font_class = Win32Font
=======================================
--- /pyglet/gl/__init__.py Sat Apr 14 13:08:08 2012 UTC
+++ /pyglet/gl/__init__.py Thu May 8 06:02:29 2014 UTC
@@ -208,14 +208,15 @@
from pyglet import app
app.windows.remove(_shadow_window)
+from pyglet import compat_platform
from base import ObjectSpace, CanvasConfig, Context
if _is_epydoc:
from base import Config
-elif _sys.platform in ('win32', 'cygwin'):
+elif compat_platform in ('win32', 'cygwin'):
from win32 import Win32Config as Config
-elif _sys.platform.startswith('linux'):
+elif compat_platform.startswith('linux'):
from xlib import XlibConfig as Config
-elif _sys.platform == 'darwin':
+elif compat_platform == 'darwin':
if _pyglet.options['darwin_cocoa']:
from cocoa import CocoaConfig as Config
else:
=======================================
--- /pyglet/gl/base.py Sat Apr 28 14:55:49 2012 UTC
+++ /pyglet/gl/base.py Thu May 8 06:02:29 2014 UTC
@@ -1,9 +1,7 @@
#!/usr/bin/python
# $Id:$
-import sys as _sys
-
-from pyglet import gl
+from pyglet import gl, compat_platform
from
pyglet.gl import gl_info
from
pyglet.gl import glu_info
@@ -265,7 +263,7 @@
('_workaround_vbo_finish',
lambda info: ('ATI' in info.get_renderer() and
info.have_version(1, 5) and
- _sys.platform == 'darwin')),
+ compat_platform == 'darwin')),
]
def __init__(self, config, context_share=None):
=======================================
--- /pyglet/gl/lib.py Fri Mar 28 15:11:48 2008 UTC
+++ /pyglet/gl/lib.py Thu May 8 06:02:29 2014 UTC
@@ -38,7 +38,6 @@
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
-import sys
import ctypes
import pyglet
@@ -135,9 +134,9 @@
link_GLX = None
link_WGL = None
-if sys.platform in ('win32', 'cygwin'):
+if pyglet.compat_platform in ('win32', 'cygwin'):
from pyglet.gl.lib_wgl import link_GL, link_GLU, link_WGL
-elif sys.platform == 'darwin':
+elif pyglet.compat_platform == 'darwin':
from pyglet.gl.lib_agl import link_GL, link_GLU, link_AGL
else:
from pyglet.gl.lib_glx import link_GL, link_GLU, link_GLX
=======================================
--- /pyglet/image/codecs/__init__.py Sat Apr 14 13:08:08 2012 UTC
+++ /pyglet/image/codecs/__init__.py Thu May 8 06:02:29 2014 UTC
@@ -53,7 +53,7 @@
__version__ = '$Id: $'
import os.path
-import sys
+from pyglet import compat_platform
_decoders = [] # List of registered ImageDecoders
_decoder_extensions = {} # Map str -> list of matching ImageDecoders
@@ -185,7 +185,7 @@
# Mac OS X default: Quicktime for Carbon, Quartz for Cocoa.
# TODO: Make ctypes Quartz the default for both Carbon & Cocoa.
- if sys.platform == 'darwin':
+ if compat_platform == 'darwin':
try:
from pyglet import options as pyglet_options
if pyglet_options['darwin_cocoa']:
@@ -200,7 +200,7 @@
pass
# Windows XP default: GDI+
- if sys.platform in ('win32', 'cygwin'):
+ if compat_platform in ('win32', 'cygwin'):
try:
import pyglet.image.codecs.gdiplus
add_encoders(gdiplus)
@@ -209,7 +209,7 @@
pass
# Linux default: GdkPixbuf 2.0
- if sys.platform.startswith('linux'):
+ if compat_platform.startswith('linux'):
try:
import pyglet.image.codecs.gdkpixbuf2
add_encoders(gdkpixbuf2)
=======================================
--- /pyglet/info.py Mon Mar 14 19:43:08 2011 UTC
+++ /pyglet/info.py Thu May 8 06:02:29 2014 UTC
@@ -75,6 +75,7 @@
'''Dump pyglet version and options.'''
import pyglet
print 'pyglet.version:', pyglet.version
+ print 'pyglet.compat_platform:', pyglet.compat_platform
print 'pyglet.__file__:', pyglet.__file__
for key, value in pyglet.options.items():
print "pyglet.options['%s'] = %r" % (key, value)
=======================================
--- /pyglet/input/__init__.py Sat Apr 14 13:08:08 2012 UTC
+++ /pyglet/input/__init__.py Thu May 8 06:02:29 2014 UTC
@@ -151,7 +151,9 @@
def get_tablets(display=None):
return []
- if sys.platform.startswith('linux'):
+ from pyglet import compat_platform
+
+ if compat_platform.startswith('linux'):
from x11_xinput import get_devices as xinput_get_devices
from x11_xinput_tablet import get_tablets
from evdev import get_devices as evdev_get_devices
@@ -159,13 +161,13 @@
def get_devices(display=None):
return (evdev_get_devices(display) +
xinput_get_devices(display))
- elif sys.platform in ('cygwin', 'win32'):
+ elif compat_platform in ('cygwin', 'win32'):
from directinput import get_devices, get_joysticks
try:
from wintab import get_tablets
except:
pass
- elif sys.platform == 'darwin':
+ elif compat_platform == 'darwin':
from pyglet import options as pyglet_options
if pyglet_options['darwin_cocoa']:
from darwin_hid import get_devices, get_joysticks,
get_apple_remote
=======================================
--- /pyglet/lib.py Thu Apr 17 16:52:32 2014 UTC
+++ /pyglet/lib.py Thu May 8 06:02:29 2014 UTC
@@ -143,7 +143,8 @@
find_library = lambda self, name: ctypes.util.find_library(name)
- platform = sys.platform
+ platform = pyglet.compat_platform
+ # this is only for library loading, don't include it in pyglet.platform
if platform == 'cygwin':
platform = 'win32'
@@ -204,7 +205,7 @@
# pyinstaller.py sets sys.frozen to True, and puts dylibs in
# Contents/MacOS, which path pyinstaller puts in sys._MEIPASS
if (hasattr(sys, 'frozen') and hasattr(sys, '_MEIPASS') and
- sys.frozen == True and sys.platform == 'darwin'):
+ sys.frozen == True and pyglet.compat_platform == 'darwin'):
search_path.append(os.path.join(sys._MEIPASS, libname))
if '/' in path:
@@ -338,9 +339,9 @@
return self._ld_so_cache.get(path)
-if sys.platform == 'darwin':
+if pyglet.compat_platform == 'darwin':
loader = MachOLibraryLoader()
-elif sys.platform.startswith('linux'):
+elif pyglet.compat_platform.startswith('linux'):
loader = LinuxLibraryLoader()
else:
loader = LibraryLoader()
=======================================
--- /pyglet/media/avbin.py Wed Oct 2 17:12:15 2013 UTC
+++ /pyglet/media/avbin.py Thu May 8 06:02:29 2014 UTC
@@ -38,7 +38,6 @@
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
-import sys
import struct
import ctypes
import threading
@@ -55,7 +54,7 @@
from pyglet.compat import asbytes, asbytes_filename
-if sys.platform.startswith('win') and struct.calcsize('P') == 8:
+if pyglet.compat_platform.startswith('win') and struct.calcsize('P') == 8:
av = 'avbin64'
else:
av = 'avbin'
=======================================
--- /pyglet/media/drivers/openal/__init__.py Sun Dec 2 00:00:48 2012 UTC
+++ /pyglet/media/drivers/openal/__init__.py Thu May 8 06:02:29 2014 UTC
@@ -35,7 +35,6 @@
import ctypes
import heapq
-import sys
import threading
import time
import Queue
@@ -606,7 +605,7 @@
def get_extensions(self):
extensions = alc.alcGetString(self._device, alc.ALC_EXTENSIONS)
- if sys.platform == 'darwin' or sys.platform.startswith('linux'):
+ if pyglet.compat_platform == 'darwin' or
pyglet.compat_platform.startswith('linux'):
return ctypes.cast(extensions,
ctypes.c_char_p).value.split(' ')
else:
return _split_nul_strings(extensions)
=======================================
--- /pyglet/resource.py Mon Mar 3 18:33:48 2014 UTC
+++ /pyglet/resource.py Thu May 8 06:02:29 2014 UTC
@@ -162,14 +162,15 @@
:rtype: str
'''
- if sys.platform in ('cygwin', 'win32'):
+
+ if pyglet.compat_platform in ('cygwin', 'win32'):
if 'APPDATA' in os.environ:
return os.path.join(os.environ['APPDATA'], name)
else:
return os.path.expanduser('~/%s' % name)
- elif sys.platform == 'darwin':
+ elif pyglet.compat_platform == 'darwin':
return os.path.expanduser('~/Library/Application Support/%s' %
name)
- elif sys.platform.startswith('linux'):
+ elif pyglet.compat_platform.startswith('linux'):
if 'XDG_CONFIG_HOME' in os.environ:
return os.path.join(os.environ['XDG_CONFIG_HOME'], name)
else:
=======================================
--- /pyglet/window/__init__.py Sat May 3 09:09:08 2014 UTC
+++ /pyglet/window/__init__.py Thu May 8 06:02:29 2014 UTC
@@ -678,7 +678,7 @@
# TODO: Move into platform _create?
# Not harmless on Carbon because upsets _width and _height
# via _on_window_bounds_changed.
- if sys.platform != 'darwin' or pyglet.options['darwin_cocoa']:
+ if pyglet.compat_platform != 'darwin' or
pyglet.options['darwin_cocoa']:
self.set_location(*self._windowed_location)
def _set_fullscreen_mode(self, mode, width, height):
@@ -1695,12 +1695,12 @@
else:
# Try to determine which platform to use.
- if sys.platform == 'darwin':
+ if pyglet.compat_platform == 'darwin':
if pyglet.options['darwin_cocoa']:
from pyglet.window.cocoa import CocoaWindow as Window
else:
from pyglet.window.carbon import CarbonWindow as Window
- elif sys.platform in ('win32', 'cygwin'):
+ elif pyglet.compat_platform in ('win32', 'cygwin'):
from pyglet.window.win32 import Win32Window as Window
else:
# XXX HACK around circ problem, should be fixed after removal of
=======================================
--- /pyglet/window/key.py Sat Dec 7 19:02:32 2013 UTC
+++ /pyglet/window/key.py Thu May 8 06:02:29 2014 UTC
@@ -186,8 +186,8 @@
#: Accelerator modifier. On Windows and Linux, this is ``MOD_CTRL``, on
#: Mac OS X it's ``MOD_COMMAND``.
MOD_ACCEL = MOD_CTRL
-import sys as _sys
-if _sys.platform == 'darwin':
+from pyglet import compat_platform
+if compat_platform == 'darwin':
MOD_ACCEL = MOD_COMMAND
=======================================
--- /pyglet/window/win32/__init__.py Sat Dec 7 19:02:32 2013 UTC
+++ /pyglet/window/win32/__init__.py Thu May 8 06:02:29 2014 UTC
@@ -41,9 +41,9 @@
from ctypes import *
import unicodedata
import warnings
-import sys
-if sys.platform not in ('cygwin', 'win32'):
+from pyglet import compat_platform
+if compat_platform not in ('cygwin', 'win32'):
raise ImportError('Not a win32 platform.')
import pyglet
=======================================
--- /tests/image/PLATFORM_LA_LOAD.py Sat Apr 14 13:08:08 2012 UTC
+++ /tests/image/PLATFORM_LA_LOAD.py Thu May 8 06:02:29 2014 UTC
@@ -9,13 +9,13 @@
import unittest
import base_load
-import sys
+from pyglet import compat_platform
-if sys.platform.startswith('linux'):
+if compat_platform.startswith('linux'):
from pyglet.image.codecs.gdkpixbuf2 import GdkPixbuf2ImageDecoder as
dclass
-elif sys.platform in ('win32', 'cygwin'):
+elif compat_platform in ('win32', 'cygwin'):
from pyglet.image.codecs.gdiplus import GDIPlusDecoder as dclass
-elif sys.platform == 'darwin':
+elif compat_platform == 'darwin':
from pyglet import options as pyglet_options
if pyglet_options['darwin_cocoa']:
from pyglet.image.codecs.quartz import QuartzImageDecoder as dclass
=======================================
--- /tests/image/PLATFORM_L_LOAD.py Sat Apr 14 13:08:08 2012 UTC
+++ /tests/image/PLATFORM_L_LOAD.py Thu May 8 06:02:29 2014 UTC
@@ -9,13 +9,13 @@
import unittest
import base_load
-import sys
+from pyglet import compat_platform
-if sys.platform.startswith('linux'):
+if compat_platform.startswith('linux'):
from pyglet.image.codecs.gdkpixbuf2 import GdkPixbuf2ImageDecoder as
dclass
-elif sys.platform in ('win32', 'cygwin'):
+elif compat_platform in ('win32', 'cygwin'):
from pyglet.image.codecs.gdiplus import GDIPlusDecoder as dclass
-elif sys.platform == 'darwin':
+elif compat_platform == 'darwin':
from pyglet import options as pyglet_options
if pyglet_options['darwin_cocoa']:
from pyglet.image.codecs.quartz import QuartzImageDecoder as dclass
=======================================
--- /tests/image/PLATFORM_RGBA_LOAD.py Sat Apr 14 13:08:08 2012 UTC
+++ /tests/image/PLATFORM_RGBA_LOAD.py Thu May 8 06:02:29 2014 UTC
@@ -9,13 +9,13 @@
import unittest
import base_load
-import sys
+from pyglet import compat_platform
-if sys.platform.startswith('linux'):
+if compat_platform.startswith('linux'):
from pyglet.image.codecs.gdkpixbuf2 import GdkPixbuf2ImageDecoder as
dclass
-elif sys.platform in ('win32', 'cygwin'):
+elif compat_platform in ('win32', 'cygwin'):
from pyglet.image.codecs.gdiplus import GDIPlusDecoder as dclass
-elif sys.platform == 'darwin':
+elif compat_platform == 'darwin':
from pyglet import options as pyglet_options
if pyglet_options['darwin_cocoa']:
from pyglet.image.codecs.quartz import QuartzImageDecoder as dclass
=======================================
--- /tests/test.py Thu Apr 17 18:49:52 2014 UTC
+++ /tests/test.py Thu May 8 06:02:29 2014 UTC
@@ -225,6 +225,7 @@
# So we can find tests.regression and ensure local pyglet copy is tested.
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
+from pyglet import compat_platform
import tests.regression
import pyglet.image
@@ -530,12 +531,13 @@
'linux': 'X11',
'linux2': 'X11',
'linux3': 'X11',
+ 'linux-compat': 'X11',
'win32': 'WIN',
'cygwin': 'WIN',
'darwin': 'OSX'
}
- if sys.platform in platform_capabilities:
- capabilities.append(platform_capabilities[sys.platform])
+ if compat_platform in platform_capabilities:
+ capabilities.append(platform_capabilities[compat_platform])
script_root = os.path.dirname(__file__)
plan_filename = os.path.normpath(os.path.join(script_root, 'plan.txt'))
@@ -594,6 +596,7 @@
options.log.info('Capabilities
are: %s', ', '.join(options.capabilities))
options.log.info('sys.platform = %s', sys.platform)
options.log.info('pyglet.version = %s', pyglet.version)
+
options.log.info('pyglet.platform = %s', pyglet.platform)
options.log.info('Reading test plan from %s', options.plan)
plan = TestPlan.from_file(options.plan)
=======================================
--- /tools/genwrappers.py Sat Apr 14 13:08:08 2012 UTC
+++ /tools/genwrappers.py Thu May 8 06:02:29 2014 UTC
@@ -17,7 +17,7 @@
if not os.path.exists('pyglet/window'):
assert False, 'Run with CWD = trunk root.'
names = sys.argv[1:]
- if sys.platform.startswith('linux'):
+ if pyglet.compat_platform.startswith('linux'):
if 'xlib' in names:
wrap('tools/wraptypes/wrap.py',
'-opyglet/libs/x11/xlib.py',