src/eric7/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardRepeatDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9653
e67609152c5e
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
15 15
16 class PyRegExpWizardRepeatDialog(QDialog, Ui_PyRegExpWizardRepeatDialog): 16 class PyRegExpWizardRepeatDialog(QDialog, Ui_PyRegExpWizardRepeatDialog):
17 """ 17 """
18 Class implementing a dialog for entering repeat counts. 18 Class implementing a dialog for entering repeat counts.
19 """ 19 """
20
20 def __init__(self, parent=None): 21 def __init__(self, parent=None):
21 """ 22 """
22 Constructor 23 Constructor
23 24
24 @param parent parent widget (QWidget) 25 @param parent parent widget (QWidget)
25 """ 26 """
26 super().__init__(parent) 27 super().__init__(parent)
27 self.setupUi(self) 28 self.setupUi(self)
28 29
29 self.unlimitedButton.setChecked(True) 30 self.unlimitedButton.setChecked(True)
30 31
31 msh = self.minimumSizeHint() 32 msh = self.minimumSizeHint()
32 self.resize(max(self.width(), msh.width()), msh.height()) 33 self.resize(max(self.width(), msh.width()), msh.height())
33 34
34 @pyqtSlot(int) 35 @pyqtSlot(int)
35 def on_lowerSpin_valueChanged(self, value): 36 def on_lowerSpin_valueChanged(self, value):
36 """ 37 """
37 Private slot to handle the lowerSpin valueChanged signal. 38 Private slot to handle the lowerSpin valueChanged signal.
38 39
39 @param value value of the spinbox (integer) 40 @param value value of the spinbox (integer)
40 """ 41 """
41 if self.upperSpin.value() < value: 42 if self.upperSpin.value() < value:
42 self.upperSpin.setValue(value) 43 self.upperSpin.setValue(value)
43 44
44 @pyqtSlot(int) 45 @pyqtSlot(int)
45 def on_upperSpin_valueChanged(self, value): 46 def on_upperSpin_valueChanged(self, value):
46 """ 47 """
47 Private slot to handle the upperSpin valueChanged signal. 48 Private slot to handle the upperSpin valueChanged signal.
48 49
49 @param value value of the spinbox (integer) 50 @param value value of the spinbox (integer)
50 """ 51 """
51 if self.lowerSpin.value() > value: 52 if self.lowerSpin.value() > value:
52 self.lowerSpin.setValue(value) 53 self.lowerSpin.setValue(value)
53 54
54 def getRepeat(self): 55 def getRepeat(self):
55 """ 56 """
56 Public method to retrieve the dialog's result. 57 Public method to retrieve the dialog's result.
57 58
58 @return ready formatted repeat string (string) 59 @return ready formatted repeat string (string)
59 """ 60 """
60 minimal = "?" if self.minimalCheckBox.isChecked() else "" 61 minimal = "?" if self.minimalCheckBox.isChecked() else ""
61 62
62 if self.unlimitedButton.isChecked(): 63 if self.unlimitedButton.isChecked():
63 return "*" + minimal 64 return "*" + minimal
64 elif self.minButton.isChecked(): 65 elif self.minButton.isChecked():
65 reps = self.minSpin.value() 66 reps = self.minSpin.value()
66 if reps == 1: 67 if reps == 1:
78 return "{{{0:d}}}{1}".format(reps, minimal) 79 return "{{{0:d}}}{1}".format(reps, minimal)
79 elif self.betweenButton.isChecked(): 80 elif self.betweenButton.isChecked():
80 repsMin = self.lowerSpin.value() 81 repsMin = self.lowerSpin.value()
81 repsMax = self.upperSpin.value() 82 repsMax = self.upperSpin.value()
82 return "{{{0:d},{1:d}}}{2}".format(repsMin, repsMax, minimal) 83 return "{{{0:d},{1:d}}}{2}".format(repsMin, repsMax, minimal)
83 84
84 return "" 85 return ""

eric ide

mercurial