~ubuntu-branches/debian/stretch/phatch/stretch

« back to all changes in this revision

Viewing changes to phatch/pyWx/lib/paint.py

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Ożarowski, Stani M, Piotr Ożarowski
  • Date: 2008-07-21 12:53:17 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080721125317-sqk2sdl3pwl2u4gl
Tags: 0.1.5-1
[ Stani M ]
* New upstream release(Closes LP: #228259, #232436, #236282, #236462, #237359)
* debian/control:
  - Added pkg-config and python-nautilus to build-depends, as
    setup.py uses nautilus-python.pc to look for the nautilus
    extensions path. Closes: #475233.
* debian/patches:
  - All patches of Ubuntu and Debian are implemented upstream and are removed
    from the package

[ Piotr Ożarowski ]
* Bump Standards-Version to 3.8.0 (no changes needed)
* debian/copyright wrapped at column 80 (where possible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
            _dc.SetClippingRect(rect)
42
42
        dc = GCDC(_dc)
43
43
        dc.Clear()
44
 
        #save brush and pen
 
44
        #calculate text extents
 
45
        paint_message   = self.GetPaintMessage()
 
46
        if paint_message:
 
47
            tw, th = self.GetClientSize()
 
48
            cw, ch      = tw-MARGIN,th-MARGIN
 
49
            font_size   = FONT_SIZE+1
 
50
            while (tw >= cw or th >= ch) and font_size > 5:
 
51
                font_size   -= 1
 
52
                font        = wx.Font(font_size,wx.FONTFAMILY_SWISS,
 
53
                                wx.FONTSTYLE_NORMAL, wx.FONTSTYLE_NORMAL)
 
54
                dc.SetFont(font)
 
55
                tw, th      = dc.GetTextExtent(paint_message)
 
56
            td          = font_size/2
 
57
            twd         = tw+2*td
 
58
            thd         = th+2*td
 
59
        else:
 
60
            tw = th = 0
 
61
        #draw logo
45
62
        ew, eh          = paint_object.GetSize()
46
63
        if self.paint_logo:
47
64
            #draw logo
48
65
            lw, lh      = self._paint_logo.GetSize()
49
 
            lx, ly      = (ew-lw)/2, (eh-lh)/2
 
66
            lx, ly      = (ew-lw)/2, (eh-lh+2*thd)/2
50
67
            dc.DrawBitmap(self._paint_logo, lx, ly, True)
51
68
        else:
52
69
            #skip logo
53
70
            lx, ly      = ew/2, eh/2
54
71
        #check if text is necessary too
55
 
        paint_message   = self.GetPaintMessage()
56
 
        if not paint_message:
57
 
            return
58
 
        #calculate text extents
59
 
        tw, th = self.GetClientSize()
60
 
        cw, ch      = tw-MARGIN,th-MARGIN
61
 
        font_size   = FONT_SIZE+1
62
 
        while (tw >= cw or th >= ch) and font_size > 5:
63
 
            font_size   -= 1
64
 
            font        = wx.Font(font_size,wx.FONTFAMILY_SWISS,
65
 
                            wx.FONTSTYLE_NORMAL, wx.FONTSTYLE_NORMAL)
66
 
            dc.SetFont(font)
67
 
            tw, th      = dc.GetTextExtent(paint_message)
 
72
        if not paint_message: return
68
73
        #draw rounded rectangle
69
 
        td          = font_size/2
70
 
        twd         = tw+2*td
71
 
        thd         = th+2*td
72
74
        if self.paint_logo:
73
75
            rx, ry  = (ew-twd)/2,ly-2*thd
74
76
        else: