Commit 89a94587 authored by Andrej Shadura's avatar Andrej Shadura

Imported Upstream version 0.12

parents
MANIFEST
This diff is collapsed.
include MANIFEST.in
include README COPYING NEWS TODO
global-include .cvsignore
recursive-include doc Makefile
include doc/src/*.texi
include doc/info/python-xlib.info doc/info/python-xlib.info-*[0-9]
include doc/html/index.html doc/html/python-xlib_toc.html
include doc/html/python-xlib_*.html doc/html/texi2html
include doc/ps/python-xlib.ps
include utils/tcpbug.py utils/parsexbug.py
include examples/draw.py examples/draw-proto.py examples/profilex.py
include examples/shapewin.py
include examples/threadtest.py
-*-outline-*-
NEWS for Python X Library
* Version 0.12 29 Mar 2002
** SHAPE extension
Jeffrey Boser contributed a SHAPE extension module, allowing Python
Xlib programs to use shaped windows. Take a look at
examples/shapewin.py for ideas on how to use it. For more information
on shaped windows, see
http://ftp.x.org/pub/R6.6/xc/doc/hardcopy/Xext/shape.PS.gz
** Python 2.2 fix
In Python 2.2 FCNTL.FD_CLOEXEC has disappeared and FCNTL on the whole
is deprecated, so that had to be dealt with to make the Xlib work with
that version.
* Version 0.11 23 Feb 2002
** Regression tests for the protocol definition
Regressions tests have been created for all requests, replies and
events. The tests use PyUnit, and the old resource database test has
been updated to use it too.
** A lot of protocol bugfixes
The bugs discovered by the regression tests have been fixed.
Additionally, a subtle bug in the core engine which could cause a
"can't happen"-error has also been found and fixed.
* Version 0.10 16 Dec 2001
** Event bugfix
The xlib failed to parse the type code of events sent from other
clients using SendEvent. This has been fixed, adding the field
`send_event' to all event objects.
** Event documentation
The section "Event Types" in the manual has been written, detailing
all event types in the core protocol. The manual is now ten pages
thicker.
** Basic support for GetImage/PutImage
The Drawable methods put_image() and get_image() have been
implemented, but handling image data is still up to the user. There
is however, thanks to Ilpo Nyyssönen, a trivial method put_pil_image()
that will work on some combinations of image and drawable depth. It's
not perfect, but it's a start.
* Version 0.9 4 Dec 2001
** Documentation improved
The documentation has been augmented with a chapter about event
handling, and a chapter listing all X objects and their methods
provided by the library. They are not described in any detail,
though.
** Keysym handling improved
The module Xlib.XK, which listed all keysyms, have been split up into
several sub-modules providing different sets of keysyms. By importing
Xlib.XK only the miscellany and latin1 sets are loaded, thus removing
some unnecessary clutter.
Xlib.display.Display has two new methods (lookup_string() and
rebind_string()) for translating keysyms into characters.
** Small changes to library interface
The order of the Xlib.display.Display method send_event() parameters
event_mask and propagate has changed.
Some of the class names in Xlib.protocol.event have changed, to have
the same namse as the corresponding. event type constant.
** A few bugfixes
If a display has more than one screen, the default screen was always
set to the highest numbered one, irrespective of what the user
specified in $DISPLAY.
Some response attributes in Xlib.protocol.request accidentally
included a comma.
* Version 0.8 12 Jan 2001
** Uses distutils
Python Xlib now uses distutils to make installation and distribution
building easier.
** Tested with Python 2.0
A few incompatibilities with Python 2.0 has been fixed.
* Version 0.7 8 Jan 2001
** Fixed the 64-bit platform fix.
As it turns out, the attempted fix for 64-bit platforms in v0.6 didn't
really work. Close study of structmodules.c gave the answer why, and
now it really should work. Yeah.
** Optimizations of core protocol engine
Python Xlib is now at least 25% faster after the core of the protocol
engine has been rewritten. This is some quite cute code: tailor-made
methods are generated for all structures, resulting in a 650% speed-up
in generating binary data, and a 75% speed-up in parsing binary data.
Interested Python hackers are recommended to take a look at the Struct
class in Xlib/protocol/rq.py.
* Version 0.6 29 Dec 2000
** Fix to make python-xlib work on 64-bytes architectures.
The struct and array modules uses sizeof(long) to determine the number
of bytes used when representing the type code 'l'. On Intel and VAX,
this is 32 bits as expected. On Alpha, it's 64 bits. python-xlib now
probes how large each type code is to avoid this problem.
* Version 0.5 28 Dec 2000
** Functions implemented to get and set all ICCCM WM properties on
Window objects.
** Keymap cache implemented, with external Xlib.display.Display
methods keycode_to_keysym, keysym_to_keycode, keysym_to_keycodes and
refresh_keyboard_mapping.
** Two utils for debugging X traffic implemented.
utils/tcpbug.py forwards a TCP connection and outputs the
communication between the client and the server. This output can then
be fed into utils/parsexbug.py, which will output all requests,
responses, errors and events in a readable format.
* Version 0.4 4 Oct 2000
** Thread support completed, but not really stresstested yet.
** A framework for handling different platforms has been implemented,
together with generic Unix code and some simple VMS code.
** Some documentation has been written.
** The usual bunch of bugfixes.
Metadata-Version: 1.0
Name: python-xlib
Version: 0.12
Summary: Python X Library
Home-page: http://python-xlib.sourceforge.net/
Author: Peter Liljenberg
Author-email: petli@ctrl-c.liu.se
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
The Python X Library
*** Copyright
The main part of the code is
Copyright (C) 2000-2002 Peter Liljenberg
Some contributed code is copyrighted by the contributors, in these
cases that is indicated in the source files in question.
The Python X Library is released under GPL, see the file COPYING for
details.
*** Requirements
The Python X Library requires Python 1.5.2 or newer. It has been
tested to various extents with Pythons 1.5.2, 2.0, 2.1 and 2.2.
*** Installation
The Python Xlib uses the standard distutils to make installation
easy. Distutils is shipped with Python 1.6 and newer. Python 1.5.2
users must download and install distutils before Python Xlib can be
installed. Distutils can be downloaded from
http://www.python.org/sigs/distutils-sig/.
Install Python Xlib by running this command:
python setup.py install
Installation can be modified with the normal install options, see the
documentation of distutils for details.
Alternatively, you can run programs from the distribution directory,
or changing the module path in programs.
There's a simple example program, implemented twice using both the
high-level interface and the low-level protocol.
*** Introduction
The Python X Library is intended to be a fully functional X client
library for Python programs. It is written entirely in Python, in
contrast to earlier X libraries for Python (the ancient X extension
and the newer plxlib) which were interfaces to the C Xlib.
This is possible to do since X client programs communicate with the X
server via the X protocol. The communication takes place over TCP/IP,
Unix sockets, DECnet or any other streaming network protocol. The C
Xlib is merely an interface to this protocol, providing functions
suitable for a C environment.
There are three advantages of implementing a pure Python library:
* Integration: The library can make use of the wonderful object
system in Python, providing an easy-to-use class hierarchy.
* Portability: The library will be usable on (almost) any computer
which have Python installed. A C interface could be problematic to
port to non-Unix systems, such as MS Windows or OpenVMS.
* Maintainability: It is much easier to develop and debug native
Python modules than modules written in C.
*** Project status
The low-level protocol is complete, implementing client-side X11R6.
The high-level object oriented interface is also fully functional.
It is possible to write client applications with the library.
Currently, the only real application using Python Xlib is the window
manager PLWM, starting with version 2.0.
There is a resource database implementation, ICCCM support and a
framework for adding X extension code. Currently only the XTEST
extension has been implemented.
There are most likely still bugs, but the library is at least stable
enough to run PLWM. A continously bigger part of the library is
covered by regression tests, improving stability.
The documentation is still quite rudimentary, but should be of some
help for people programming with the Xlib. X beginners should first
find some general texts on X. A very good starting point is
http://www.rahul.net/kenton/xsites.html
See the file TODO for a detailed list of what is missing,
approximately ordered by importance.
*** Contact information
Author email: Peter Liljenberg <petli@ctrl-c.liu.se>
The Python X Library is a SourceForged project. The project page is
http://sourgeforge.net/projects/python-xlib/. Source is available
from that page as tar.gz-releases and from the CVS tree.
There isn't any real web page yet, only a derivative of this file. It
is located at http://python-xlib.sourceforge.net/. It now also
features the documentation for downloading or browsing.
*** To be a real C Xlib replacement
* High-level functions: currently, there are mostly methods which
directly correspond to X requests. There should be some simpler
functions (e.g. Window.resize_window() in addition to
Window.configure(), Drawable.rectangle() in addition to
Drawable.poly_rectangle(), etc), and possibly also compound
functions (e.g. create_pixmap_from_image() which would load an image
file and create a pixmap of it).
* Events: advanced event queue handling, e.g. filtering out events,
only process events for a certain window, etc.
* Extensions: as many extensions as possible should be implemented.
*** Miscellaneous
* Faster, faster! The protocol engine isn't very fast, despite the
optimizations in version 0.7. I've started on this, but it is a big
job.
* The tread support and the protocol engine needs to be stress
tested. They _seem_ to work, but that's no guarantee.
* Much more documentation.
* Test suite: a test suite which exercises the entire library would
definitely be a nice thing to have. A start has been made for this,
testing the protocol definitions.
* Porting: the library should be runnable wherever there is a Python
interpreter (with the necessary IPC support, that is.)
* Widget set: a Python-optimized widget set using the X library would
be really cute. The AnyGUI project could be a good front-end to
use.
* Server-side support: while we're at it, why not extend the library
to provide at least the server-side parsing of the X protocol? It
could be usable for writing X proxies, or for that matter, a
complete X server in Python (this might be a little too spaced-out,
though...)
This diff is collapsed.
# $Id: XK.py,v 1.4 2001/01/19 18:59:37 petli Exp $
#
# Xlib.XK -- X keysym defs
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# 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
from X import NoSymbol
def string_to_keysym(str):
return globals().get('XK_' + str, NoSymbol)
def load_keysym_group(group):
if '.' in group:
raise ValueError('invalid keysym group name: %s' % group)
# Try to import the corresponding package. This will
# finally result in the package calling _load_keysyms_into_XK
__import__('Xlib.keysymdef.%s' % group, globals(), locals())
def _load_keysyms_into_XK(mod):
# I reckon that this is the fastest way to import all
# keysyms into this modules global dict.
# To have some kind of security, check that we're only
# loading something out of Xlib.keysymdef
if mod[:15] == 'Xlib.keysymdef.':
exec 'from %s import *' % mod in globals()
# Always import miscellany and latin1 keysyms
import Xlib.keysymdef.miscellany
import Xlib.keysymdef.latin1
def keysym_to_string(keysym):
# ISO latin 1, LSB is the code
if keysym & 0xff00 == 0:
return chr(keysym & 0xff)
if keysym in [XK_BackSpace, XK_Tab, XK_Clear, XK_Return,
XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete]:
return chr(keysym & 0xff)
# We should be able to do these things quite automatically
# for latin2, latin3, etc, in Python 2.0 using the Unicode,
# but that will have to wait.
return None
# $Id: Xatom.py,v 1.2 2000/08/22 14:06:22 petli Exp $
#
# Xlib.Xatom -- Standard X atoms
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# 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
PRIMARY = 1
SECONDARY = 2
ARC = 3
ATOM = 4
BITMAP = 5
CARDINAL = 6
COLORMAP = 7
CURSOR = 8
CUT_BUFFER0 = 9
CUT_BUFFER1 = 10
CUT_BUFFER2 = 11
CUT_BUFFER3 = 12
CUT_BUFFER4 = 13
CUT_BUFFER5 = 14
CUT_BUFFER6 = 15
CUT_BUFFER7 = 16
DRAWABLE = 17
FONT = 18
INTEGER = 19
PIXMAP = 20
POINT = 21
RECTANGLE = 22
RESOURCE_MANAGER = 23
RGB_COLOR_MAP = 24
RGB_BEST_MAP = 25
RGB_BLUE_MAP = 26
RGB_DEFAULT_MAP = 27
RGB_GRAY_MAP = 28
RGB_GREEN_MAP = 29
RGB_RED_MAP = 30
STRING = 31
VISUALID = 32
WINDOW = 33
WM_COMMAND = 34
WM_HINTS = 35
WM_CLIENT_MACHINE = 36
WM_ICON_NAME = 37
WM_ICON_SIZE = 38
WM_NAME = 39
WM_NORMAL_HINTS = 40
WM_SIZE_HINTS = 41
WM_ZOOM_HINTS = 42
MIN_SPACE = 43
NORM_SPACE = 44
MAX_SPACE = 45
END_SPACE = 46
SUPERSCRIPT_X = 47
SUPERSCRIPT_Y = 48
SUBSCRIPT_X = 49
SUBSCRIPT_Y = 50
UNDERLINE_POSITION = 51
UNDERLINE_THICKNESS = 52
STRIKEOUT_ASCENT = 53
STRIKEOUT_DESCENT = 54
ITALIC_ANGLE = 55
X_HEIGHT = 56
QUAD_WIDTH = 57
WEIGHT = 58
POINT_SIZE = 59
RESOLUTION = 60
COPYRIGHT = 61
NOTICE = 62
FONT_NAME = 63
FAMILY_NAME = 64
FULL_NAME = 65
CAP_HEIGHT = 66
WM_CLASS = 67
WM_TRANSIENT_FOR = 68
LAST_PREDEFINED = 68
# $Id: Xcursorfont.py,v 1.2 2000/08/22 14:06:22 petli Exp $
#
# Xlib.Xcursorfont -- standard cursors
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# 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
num_glyphs = 154
X_cursor = 0
arrow = 2
based_arrow_down = 4
based_arrow_up = 6
boat = 8
bogosity = 10
bottom_left_corner = 12
bottom_right_corner = 14
bottom_side = 16
bottom_tee = 18
box_spiral = 20
center_ptr = 22
circle = 24
clock = 26
coffee_mug = 28
cross = 30
cross_reverse = 32
crosshair = 34
diamond_cross = 36
dot = 38
dotbox = 40
double_arrow = 42
draft_large = 44
draft_small = 46
draped_box = 48
exchange = 50
fleur = 52
gobbler = 54
gumby = 56
hand1 = 58
hand2 = 60
heart = 62
icon = 64
iron_cross = 66
left_ptr = 68
left_side = 70
left_tee = 72
leftbutton = 74
ll_angle = 76
lr_angle = 78
man = 80
middlebutton = 82
mouse = 84
pencil = 86
pirate = 88
plus = 90
question_arrow = 92
right_ptr = 94
right_side = 96
right_tee = 98
rightbutton = 100
rtl_logo = 102
sailboat = 104
sb_down_arrow = 106
sb_h_double_arrow = 108
sb_left_arrow = 110
sb_right_arrow = 112
sb_up_arrow = 114
sb_v_double_arrow = 116
shuttle = 118
sizing = 120
spider = 122
spraycan = 124
star = 126
target = 128
tcross = 130
top_left_arrow = 132
top_left_corner = 134
top_right_corner = 136
top_side = 138
top_tee = 140
trek = 142
ul_angle = 144
umbrella = 146
ur_angle = 148
watch = 150
xterm = 152
# $Id: Xutil.py,v 1.2 2000/08/22 14:06:22 petli Exp $
#
# Xlib.Xutil -- ICCCM definitions and similar stuff
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# 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
NoValue = 0x0000
XValue = 0x0001
YValue = 0x0002
WidthValue = 0x0004
HeightValue = 0x0008
AllValues = 0x000F
XNegative = 0x0010
YNegative = 0x0020
USPosition = (1 << 0)
USSize = (1 << 1)
PPosition = (1 << 2)
PSize = (1 << 3)
PMinSize = (1 << 4)
PMaxSize = (1 << 5)
PResizeInc = (1 << 6)
PAspect = (1 << 7)
PBaseSize = (1 << 8)
PWinGravity = (1 << 9)
PAllHints = (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
InputHint = (1 << 0)
StateHint = (1 << 1)
IconPixmapHint = (1 << 2)
IconWindowHint = (1 << 3)
IconPositionHint = (1 << 4)
IconMaskHint = (1 << 5)
WindowGroupHint = (1 << 6)
AllHints = (InputHint|StateHint|IconPixmapHint|IconWindowHint|
IconPositionHint|IconMaskHint|WindowGroupHint)
WithdrawnState = 0
NormalState = 1
IconicState = 3
DontCareState = 0
ZoomState = 2
InactiveState = 4
RectangleOut = 0
RectangleIn = 1
RectanglePart = 2
VisualNoMask = 0x0
VisualIDMask = 0x1
VisualScreenMask = 0x2
VisualDepthMask = 0x4
VisualClassMask = 0x8
VisualRedMaskMask = 0x10
VisualGreenMaskMask = 0x20
VisualBlueMaskMask = 0x40
VisualColormapSizeMask = 0x80
VisualBitsPerRGBMask = 0x100
VisualAllMask = 0x1FF
ReleaseByFreeingColormap = 1
BitmapSuccess = 0
BitmapOpenFailed = 1
BitmapFileInvalid = 2
BitmapNoMemory = 3
XCSUCCESS = 0
XCNOMEM = 1
XCNOENT = 2
# $Id: __init__.py,v 1.14 2002/03/30 00:34:53 petli Exp $
#
# Xlib.__init__ -- glue for Xlib package
#
# Copyright (C) 2000-2002 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# 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 string
__version__ = (0, 12)
__version_extra__ = ''
__version_string__ = string.join(map(str, __version__), '.') + __version_extra__
__all__ = [