If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. SSH will work normally if you are using the VPN.

Commit a58a0653 authored by eric pellegrini's avatar eric pellegrini

Fix bug when checking items on checkable combobox on Windows

parent eafedbe8
import wx.combo
class ComboCheckbox(wx.combo.ComboPopup):
class ComboCheckbox(wx.CheckListBox,wx.combo.ComboPopup):
def __init__(self, items, maxNumberOfItems=None):
self.PostCreate(wx.PreCheckListBox())
wx.combo.ComboPopup.__init__(self)
self._items = items
self._maxNumberOfItems = maxNumberOfItems
self._currentItem = -1
@property
def items(self):
return self._items
......@@ -15,31 +19,48 @@ class ComboCheckbox(wx.combo.ComboPopup):
@property
def checklistbox(self):
return self._checklistbox
return self
def OnMotion(self, event):
item = self.HitTest(event.GetPosition())
if item >= 0:
self.Select(item)
self._currentItem = item
def Create(self, parent):
self._checklistbox = wx.CheckListBox(parent, -1, choices=self._items)
self._checklistbox.Bind(wx.EVT_CHECKLISTBOX, self.on_check_item)
if not self._checklistbox.IsEmpty():
self._checklistbox.Check(0)
def Create(self, parent):
wx.CheckListBox.Create(self,parent, -1, choices=self._items)
self.Bind(wx.EVT_MOTION, self.OnMotion)
self.Bind(wx.EVT_LEFT_DOWN, self.on_check_item)
if not self.IsEmpty():
self.Check(0)
return True
def GetControl(self):
return self._checklistbox
return self
def GetAdjustedSize(self, minWidth, prefHeight, maxHeight):
return self._checklistbox.GetSize()
return self.GetSize()
def GetStringValue(self):
return self._checklistbox.GetCheckedStrings()
return self.GetCheckedStrings()
def on_check_item(self, event):
if self._maxNumberOfItems is None:
return
nCheckedItems = len(self._checklistbox.GetChecked())
if nCheckedItems > self._maxNumberOfItems:
self._checklistbox.Check(event.GetInt(), False)
\ No newline at end of file
# Control only if ele;ent is checked
if not self.IsChecked(self._currentItem):
# Control max number of items
if self._maxNumberOfItems is None:
# Accept the event
self.Check(self._currentItem, True)
else:
# Control the number of checked items
nCheckedItems = len(self.GetChecked())
if nCheckedItems < self._maxNumberOfItems:
# Chech the item
self.Check(self._currentItem, True)
else:
self.Check(self._currentItem, False)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment