~bennabiy/+junk/python-xlib

« back to all changes in this revision

Viewing changes to examples/shapewin.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:
41
41
 
42
42
        # print version
43
43
        r = self.d.shape_query_version()
44
 
        print 'SHAPE version %d.%d' % (r.major_version, r.minor_version)
 
44
        print('SHAPE version %d.%d' % (r.major_version, r.minor_version))
45
45
 
46
46
 
47
47
        # Find which screen to open the window on
59
59
 
60
60
        bggc.change(foreground = self.screen.white_pixel)
61
61
 
62
 
        bgpm.arc(bggc, -bgsize / 2, 0, bgsize, bgsize, 0, 360 * 64)
63
 
        bgpm.arc(bggc, bgsize / 2, 0, bgsize, bgsize, 0, 360 * 64)
64
 
        bgpm.arc(bggc, 0, -bgsize / 2, bgsize, bgsize, 0, 360 * 64)
65
 
        bgpm.arc(bggc, 0, bgsize / 2, bgsize, bgsize, 0, 360 * 64)
 
62
        bgpm.arc(bggc, -bgsize // 2, 0, bgsize, bgsize, 0, 360 * 64)
 
63
        bgpm.arc(bggc, bgsize // 2, 0, bgsize, bgsize, 0, 360 * 64)
 
64
        bgpm.arc(bggc, 0, -bgsize // 2, bgsize, bgsize, 0, 360 * 64)
 
65
        bgpm.arc(bggc, 0, bgsize // 2, bgsize, bgsize, 0, 360 * 64)
66
66
 
67
67
        # Actual window
68
68
        self.window = self.screen.root.create_window(
112
112
        self.sub_pm.fill_rectangle(gc, 0, 0, self.sub_size, self.sub_size)
113
113
        gc.change(foreground = 1)
114
114
        self.sub_pm.fill_poly(gc, X.Convex, X.CoordModeOrigin,
115
 
                              [(self.sub_size / 2, 0),
116
 
                               (self.sub_size, self.sub_size / 2),
117
 
                               (self.sub_size / 2, self.sub_size),
118
 
                               (0, self.sub_size / 2)])
 
115
                              [(self.sub_size // 2, 0),
 
116
                               (self.sub_size, self.sub_size // 2),
 
117
                               (self.sub_size // 2, self.sub_size),
 
118
                               (0, self.sub_size // 2)])
119
119
        gc.free()
120
120
 
121
121
        # Set initial mask
151
151
                if e.detail == 1:
152
152
                    self.window.shape_mask(shape.ShapeUnion,
153
153
                                           shape.ShapeBounding,
154
 
                                           e.event_x - self.add_size / 2,
155
 
                                           e.event_y - self.add_size / 2,
 
154
                                           e.event_x - self.add_size // 2,
 
155
                                           e.event_y - self.add_size // 2,
156
156
                                           self.add_pm)
157
157
                elif e.detail == 3:
158
158
                    self.window.shape_mask(shape.ShapeSubtract,
159
159
                                           shape.ShapeBounding,
160
 
                                           e.event_x - self.sub_size / 2,
161
 
                                           e.event_y - self.sub_size / 2,
 
160
                                           e.event_x - self.sub_size // 2,
 
161
                                           e.event_y - self.sub_size // 2,
162
162
                                           self.sub_pm)
163
163
 
164
164
            # Shape has changed
165
165
            elif e.type == self.d.extension_event.ShapeNotify:
166
 
                print 'Shape change'
 
166
                print('Shape change')
167
167
 
168
168
            # Somebody wants to tell us something
169
169
            elif e.type == X.ClientMessage: