controls/PouInstanceVariablesPanel.py
changeset 2437 105c20fdeb19
parent 1948 b9a3f771aaab
child 3303 0ffb41625592
child 3649 61fa60130ad6
equal deleted inserted replaced
2436:82bfc75bcd9d 2437:105c20fdeb19
    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 from collections import namedtuple
    28 from collections import namedtuple
    28 
    29 
    29 import wx
    30 import wx
    30 import wx.lib.agw.customtreectrl as CT
    31 import wx.lib.agw.customtreectrl as CT
    31 import wx.lib.buttons
    32 import wx.lib.buttons
    74             r_image_w, r_image_h = self._imageListRight.GetSize(rightimages[0])
    75             r_image_w, r_image_h = self._imageListRight.GetSize(rightimages[0])
    75 
    76 
    76             bbox_width = (r_image_w + 4) * len(rightimages) + 4
    77             bbox_width = (r_image_w + 4) * len(rightimages) + 4
    77             bbox_height = r_image_h + 8
    78             bbox_height = r_image_h + 8
    78             bbox_x = w - bbox_width
    79             bbox_x = w - bbox_width
    79             bbox_y = item.GetY() + ((total_h > r_image_h) and [(total_h-r_image_h)/2] or [0])[0]
    80             bbox_y = item.GetY() + ((total_h > r_image_h) and [(total_h-r_image_h)//2] or [0])[0]
    80 
    81 
    81             return wx.Rect(bbox_x, bbox_y, bbox_width, bbox_height)
    82             return wx.Rect(bbox_x, bbox_y, bbox_width, bbox_height)
    82 
    83 
    83         return None
    84         return None
    84 
    85 
   367 
   368 
   368     def ShowInstanceChoicePopup(self):
   369     def ShowInstanceChoicePopup(self):
   369         self.InstanceChoice.SetFocusFromKbd()
   370         self.InstanceChoice.SetFocusFromKbd()
   370         size = self.InstanceChoice.GetSize()
   371         size = self.InstanceChoice.GetSize()
   371         event = wx.MouseEvent(wx.EVT_LEFT_DOWN._getEvtType())
   372         event = wx.MouseEvent(wx.EVT_LEFT_DOWN._getEvtType())
   372         event.x = size.width / 2
   373         event.x = size.width // 2
   373         event.y = size.height / 2
   374         event.y = size.height // 2
   374         event.SetEventObject(self.InstanceChoice)
   375         event.SetEventObject(self.InstanceChoice)
   375         # event = wx.KeyEvent(wx.EVT_KEY_DOWN._getEvtType())
   376         # event = wx.KeyEvent(wx.EVT_KEY_DOWN._getEvtType())
   376         # event.m_keyCode = wx.WXK_SPACE
   377         # event.m_keyCode = wx.WXK_SPACE
   377         self.InstanceChoice.GetEventHandler().ProcessEvent(event)
   378         self.InstanceChoice.GetEventHandler().ProcessEvent(event)
   378 
   379