controls/CustomTree.py
changeset 2459 21164625b393
parent 2437 105c20fdeb19
child 3303 0ffb41625592
equal deleted inserted replaced
2458:2a70d5240300 2459:21164625b393
    22 # along with this program; if not, write to the Free Software
    22 # along with this program; if not, write to the Free Software
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 
    24 
    25 
    25 
    26 from __future__ import absolute_import
    26 from __future__ import absolute_import
       
    27 from __future__ import division
    27 import wx
    28 import wx
    28 import wx.lib.agw.customtreectrl as CT
    29 import wx.lib.agw.customtreectrl as CT
    29 
    30 
    30 from util.BitmapLibrary import GetBitmap
    31 from util.BitmapLibrary import GetBitmap
    31 
    32 
    98         bitmap_size = self.BackgroundBitmap.GetSize()
    99         bitmap_size = self.BackgroundBitmap.GetSize()
    99 
   100 
   100         if self.BackgroundAlign & wx.ALIGN_RIGHT:
   101         if self.BackgroundAlign & wx.ALIGN_RIGHT:
   101             x = client_size[0] - bitmap_size[0]
   102             x = client_size[0] - bitmap_size[0]
   102         elif self.BackgroundAlign & wx.ALIGN_CENTER_HORIZONTAL:
   103         elif self.BackgroundAlign & wx.ALIGN_CENTER_HORIZONTAL:
   103             x = (client_size[0] - bitmap_size[0]) / 2
   104             x = (client_size[0] - bitmap_size[0]) // 2
   104         else:
   105         else:
   105             x = 0
   106             x = 0
   106 
   107 
   107         if self.BackgroundAlign & wx.ALIGN_BOTTOM:
   108         if self.BackgroundAlign & wx.ALIGN_BOTTOM:
   108             y = client_size[1] - bitmap_size[1]
   109             y = client_size[1] - bitmap_size[1]
   109         elif self.BackgroundAlign & wx.ALIGN_CENTER_VERTICAL:
   110         elif self.BackgroundAlign & wx.ALIGN_CENTER_VERTICAL:
   110             y = (client_size[1] - bitmap_size[1]) / 2
   111             y = (client_size[1] - bitmap_size[1]) // 2
   111         else:
   112         else:
   112             y = 0
   113             y = 0
   113 
   114 
   114         return wx.Rect(x, y, bitmap_size[0], bitmap_size[1])
   115         return wx.Rect(x, y, bitmap_size[0], bitmap_size[1])
   115 
   116