~bennabiy/+junk/python-xlib

« back to all changes in this revision

Viewing changes to Xlib/xobject/drawable.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:
16
16
#    along with this program; if not, write to the Free Software
17
17
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 
19
 
import string
20
19
 
21
20
from Xlib import X, Xatom, Xutil
22
21
from Xlib.protocol import request, rq
23
22
 
24
23
# Other X resource objects
25
 
import resource
26
 
import colormap
27
 
import cursor
28
 
import fontable
29
 
 
30
 
# Inter-client communication conventions
31
 
import icccm
 
24
from Xlib.xobject import resource, colormap, cursor, fontable, icccm
32
25
 
33
26
class Drawable(resource.Resource):
34
27
    __drawable__ = resource.Resource.__resource__
231
224
            unit = self.display.info.bitmap_format_scanline_unit
232
225
            stride = roundup(width * unit, pad) >> 3
233
226
        else:
234
 
            raise ValueError, 'Unknown data format'
 
227
            raise ValueError('Unknown data format')
235
228
 
236
229
        maxlen = (self.display.info.max_request_length << 2) \
237
230
                 - request.PutImage._request.static_size
238
 
        split = maxlen / stride
 
231
        split = maxlen // stride
239
232
 
240
233
        x1 = 0
241
234
        x2 = width
461
454
            val = prop.value
462
455
            if prop.bytes_after:
463
456
                prop = self.get_property(property, type, sizehint,
464
 
                                         prop.bytes_after / 4 + 1)
 
457
                                         prop.bytes_after // 4 + 1)
465
458
                val = val + prop.value
466
459
 
467
460
            prop.value = val
668
661
        if d is None or d.format != 8:
669
662
            return None
670
663
        else:
671
 
            parts = string.split(d.value, '\0')
 
664
            parts = d.value.split('\0')
672
665
            if len(parts) < 2:
673
666
                return None
674
667
            else:
765
758
    # Returns a DictWrapper, or None
766
759
 
767
760
    def _get_struct_prop(self, pname, ptype, pstruct):
768
 
        r = self.get_property(pname, ptype, 0, pstruct.static_size / 4)
 
761
        r = self.get_property(pname, ptype, 0, pstruct.static_size // 4)
769
762
        if r and r.format == 32:
770
763
            value = r.value.tostring()
771
764
            if len(value) == pstruct.static_size:
784
777
        else:
785
778
            keys.update(hints)
786
779
 
787
 
        value = apply(pstruct.to_binary, (), keys)
 
780
        value = pstruct.to_binary(*(), **keys)
788
781
 
789
782
        self.change_property(pname, ptype, 32, value, onerror = onerror)
790
783
 
800
793
        self.display.free_resource_id(self.id)
801
794
 
802
795
    def create_cursor(self, mask,
803
 
                      (fore_red, fore_green, fore_blue),
804
 
                      (back_red, back_green, back_blue),
 
796
                      f_rgb, b_rgb,
805
797
                      x, y):
 
798
        fore_red, fore_green, fore_blue = f_rgb
 
799
        back_red, back_green, back_blue = b_rgb
806
800
        cid = self.display.allocate_resource_id()
807
801
        request.CreateCursor(display = self.display,
808
802
                             cid = cid,