Changeset 7823:b343bf9d8b41 in orange


Ignore:
Timestamp:
04/08/11 14:45:24 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
ab31bba441b7a69dd9ca678bc322c73571ebff5b
Message:

Validate input for entered continuous values (ticket #727).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Data/OWSelectData.py

    r7039 r7823  
    106106        self.boxIndices[orange.VarTypes.Continuous] = boxVal 
    107107        self.valuesStack.addWidget(boxVal) 
    108         self.leNum1 = OWGUI.lineEdit(boxVal, self, "Num1") 
     108        self.leNum1 = OWGUI.lineEdit(boxVal, self, "Num1", validator=QDoubleValidator(self)) 
    109109        self.lblAndCon = OWGUI.widgetLabel(boxVal, "and") 
    110         self.leNum2 = OWGUI.lineEdit(boxVal, self, "Num2") 
     110        self.leNum2 = OWGUI.lineEdit(boxVal, self, "Num2", validator=QDoubleValidator(self)) 
    111111        boxAttrStat = OWGUI.widgetBox(boxVal, "Statistics") 
    112112        self.lblMin = OWGUI.widgetLabel(boxAttrStat, "Min: ") 
     
    602602        if self.currentVar: 
    603603            if self.currentVar.varType == orange.VarTypes.Continuous: 
    604                 val1 = float(self.Num1) 
    605                 val2 = float(self.Num2) 
     604                try: 
     605                    val1 = float(self.Num1) 
     606                    val2 = float(self.Num2) 
     607                except ValueError: 
     608                    return 
    606609            elif self.currentVar.varType == orange.VarTypes.String: 
    607610                val1 = self.Str1 
Note: See TracChangeset for help on using the changeset viewer.