~bennabiy/+junk/python-xlib

« back to all changes in this revision

Viewing changes to .pc/python3.patch/Xlib/xobject/fontable.py

  • Committer: Package Import Robot
  • Author(s): Andrew Shadura, Ramkumar Ramachandra, Andrew Shadura
  • Date: 2015-08-13 08:14:19 UTC
  • mfrom: (6.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20150813081419-hdefinnghp2iydkx
Tags: 0.14+20091101-3
[ Ramkumar Ramachandra ]
* Remove useless debugging output (Closes: #565996)

[ Andrew Shadura ]
* Switch to 3.0 (quilt) format.
* Rename patches.
* Use debhelper 9 in its short form.
* Use pybuild.
* Bump Standards-Version.
* Don't build or install PostScript documentation and info files.
* Use system-provided texi2html instead of a shipped version
  (Closes: #795057).
* Update debian/copyright (Closes: #795057).
* Don't install Makefile or texi2html with the documentation.
* Set executable bit for examples.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Xlib.xobject.fontable -- fontable objects (GC, font)
 
2
#
 
3
#    Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
 
4
#
 
5
#    This program is free software; you can redistribute it and/or modify
 
6
#    it under the terms of the GNU General Public License as published by
 
7
#    the Free Software Foundation; either version 2 of the License, or
 
8
#    (at your option) any later version.
 
9
#
 
10
#    This program is distributed in the hope that it will be useful,
 
11
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
#    GNU General Public License for more details.
 
14
#
 
15
#    You should have received a copy of the GNU General Public License
 
16
#    along with this program; if not, write to the Free Software
 
17
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 
 
19
from Xlib.protocol import request
 
20
 
 
21
import resource
 
22
import cursor
 
23
 
 
24
class Fontable(resource.Resource):
 
25
    __fontable__ = resource.Resource.__resource__
 
26
 
 
27
    def query(self):
 
28
        return request.QueryFont(display = self.display,
 
29
                                 font = self.id)
 
30
 
 
31
    def query_text_extents(self, string):
 
32
        return request.QueryTextExtents(display = self.display,
 
33
                                        font = self.id,
 
34
                                        string = string)
 
35
 
 
36
 
 
37
class GC(Fontable):
 
38
    __gc__ = resource.Resource.__resource__
 
39
 
 
40
    def change(self, onerror = None, **keys):
 
41
        request.ChangeGC(display = self.display,
 
42
                         onerror = onerror,
 
43
                         gc = self.id,
 
44
                         attrs = keys)
 
45
 
 
46
 
 
47
    def copy(self, src_gc, mask, onerror = None):
 
48
        request.CopyGC(display = self.display,
 
49
                       onerror = onerror,
 
50
                       src_gc = src_gc,
 
51
                       dst_gc = self.id,
 
52
                       mask = mask)
 
53
 
 
54
    def set_dashes(self, offset, dashes, onerror = None):
 
55
        request.SetDashes(display = self.display,
 
56
                          onerror = onerror,
 
57
                          gc = self.id,
 
58
                          dash_offset = offset,
 
59
                          dashes = dashes)
 
60
 
 
61
    def set_clip_rectangles(self, x_origin, y_origin, rectangles, ordering, onerror = None):
 
62
        request.SetClipRectangles(display = self.display,
 
63
                                  onerror = onerror,
 
64
                                  ordering = ordering,
 
65
                                  gc = self.id,
 
66
                                  x_origin = x_origin,
 
67
                                  y_origin = y_origin,
 
68
                                  rectangles = rectangles)
 
69
    def free(self, onerror = None):
 
70
        request.FreeGC(display = self.display,
 
71
                       onerror = onerror,
 
72
                       gc = self.id)
 
73
 
 
74
        self.display.free_resource_id(self.id)
 
75
 
 
76
 
 
77
 
 
78
class Font(Fontable):
 
79
    __font__ = resource.Resource.__resource__
 
80
 
 
81
    def close(self, onerror = None):
 
82
        request.CloseFont(display = self.display,
 
83
                          onerror = onerror,
 
84
                          font = self.id)
 
85
        self.display.free_resource_id(self.id)
 
86
 
 
87
    def create_glyph_cursor(self, mask, source_char, mask_char,
 
88
                            (fore_red, fore_green, fore_blue),
 
89
                            (back_red, back_green, back_blue)):
 
90
 
 
91
        cid = self.display.allocate_resource_id()
 
92
        request.CreateGlyphCursor(display = self.display,
 
93
                                  cid = cid,
 
94
                                  source = self.id,
 
95
                                  mask = mask,
 
96
                                  source_char = source_char,
 
97
                                  mask_char = mask_char,
 
98
                                  fore_red = fore_red,
 
99
                                  fore_green = fore_green,
 
100
                                  fore_blue = fore_blue,
 
101
                                  back_red = back_red,
 
102
                                  back_green = back_green,
 
103
                                  back_blue = back_blue)
 
104
 
 
105
        cls = self.display.get_resource_class('cursor', cursor.Cursor)
 
106
        return cls(self.display, cid, owner = 1)