~mvo/software-center/dataprovider-desktop-dependency-property

« back to all changes in this revision

Viewing changes to softwarecenter/ui/gtk3/widgets/buttons.py

  • Committer: Gary Lasker
  • Date: 2012-09-14 06:05:43 UTC
  • mfrom: (3168.2.1 some-drawing-cleanup)
  • Revision ID: gary.lasker@canonical.com-20120914060543-k062gpqqb483aioy
* lp:~mvo/software-center/some-drawing-cleanups:
  - improvements to insure good practices when dealing
    with the cairo context

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
                             cr,
109
109
                             3, 3,
110
110
                             A.width - 6, A.height - 6)
111
 
 
 
111
        cr.restore()
112
112
        for child in self:
113
113
            self.propagate_draw(child, cr)
114
114
 
115
 
        cr.restore()
116
 
 
117
115
    def on_enter(self, widget, event):
118
116
        window = self.get_window()
119
117
        window.set_cursor(_HAND)
149
147
                             cr,
150
148
                             3, 3,
151
149
                             A.width - 6, A.height - 6)
152
 
 
 
150
        cr.restore()
153
151
        for child in self:
154
152
            self.propagate_draw(child, cr)
155
153
 
156
 
        cr.restore()
157
 
 
158
154
    def on_enter(self, widget, event):
159
155
        window = self.get_window()
160
156
        window.set_cursor(_HAND)
300
296
                             3, 3,
301
297
                             A.width - 6, A.height - 6)
302
298
 
303
 
        for child in self:
304
 
            self.propagate_draw(child, cr)
305
 
 
306
299
        if self.is_installed:
307
300
            # paint installed tick overlay
308
301
            if self.get_direction() != Gtk.TextDirection.RTL:
313
306
 
314
307
            Gdk.cairo_set_source_pixbuf(cr, self._overlay, x, y)
315
308
            cr.paint()
316
 
 
317
309
        cr.restore()
 
310
        for child in self:
 
311
            self.propagate_draw(child, cr)
318
312
 
319
313
    def on_transaction_finished(self, backend, result, helper, doc):
320
314
        trans_pkgname = str(result.pkgname)
527
521
        self._bg_cache[state] = surf
528
522
 
529
523
    def do_draw(self, cr):
 
524
        cr.save()
530
525
        state = self.get_state_flags()
531
526
        if self.get_active():
532
527
            if state not in self._bg_cache:
534
529
 
535
530
            cr.set_source_surface(self._bg_cache[state], 0, 0)
536
531
            cr.paint()
537
 
 
 
532
        cr.restore()
538
533
        for child in self:
539
534
            self.propagate_draw(child, cr)
540
535