Skip to content

Commit

Permalink
add ValueNotSet to ControlCombo
Browse files Browse the repository at this point in the history
  • Loading branch information
UmSenhorQualquer committed Nov 7, 2018
1 parent 7793364 commit de6657f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pyforms_gui/controls/control_combo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from pyforms_gui.controls.control_base import ControlBase

class ValueNotSet: pass

class ControlCombo(ControlBase, QWidget):
"""This class represents a wrapper to the combo box"""
Expand Down Expand Up @@ -65,9 +66,10 @@ def clear(self):
self._value = None
self._combo.clear()

def add_item(self, label, value=None):
def add_item(self, label, value=ValueNotSet):
self._addingItem = True
if value is not None:

if value is not ValueNotSet:
if not (value in self._items.values()):
self._combo.addItem(label)
else:
Expand All @@ -78,7 +80,7 @@ def add_item(self, label, value=None):
if self._items == {}:
firstValue = True

if value is None:
if value is ValueNotSet:
self._items[str(label)] = label
else:
self._items[str(label)] = value
Expand Down

0 comments on commit de6657f

Please sign in to comment.