src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnMergeDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9653
e67609152c5e
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
16 16
17 class SvnMergeDialog(QDialog, Ui_SvnMergeDialog): 17 class SvnMergeDialog(QDialog, Ui_SvnMergeDialog):
18 """ 18 """
19 Class implementing a dialog to enter the data for a merge operation. 19 Class implementing a dialog to enter the data for a merge operation.
20 """ 20 """
21 def __init__(self, mergelist1, mergelist2, targetlist, force=False, 21
22 parent=None): 22 def __init__(self, mergelist1, mergelist2, targetlist, force=False, parent=None):
23 """ 23 """
24 Constructor 24 Constructor
25 25
26 @param mergelist1 list of previously entered URLs/revisions 26 @param mergelist1 list of previously entered URLs/revisions
27 (list of strings) 27 (list of strings)
28 @param mergelist2 list of previously entered URLs/revisions 28 @param mergelist2 list of previously entered URLs/revisions
29 (list of strings) 29 (list of strings)
30 @param targetlist list of previously entered targets (list of strings) 30 @param targetlist list of previously entered targets (list of strings)
31 @param force flag indicating a forced merge (boolean) 31 @param force flag indicating a forced merge (boolean)
32 @param parent parent widget (QWidget) 32 @param parent parent widget (QWidget)
33 """ 33 """
34 super().__init__(parent) 34 super().__init__(parent)
35 self.setupUi(self) 35 self.setupUi(self)
36 36
37 self.forceCheckBox.setChecked(force) 37 self.forceCheckBox.setChecked(force)
38 38
39 self.rx_url = re.compile('(?:file:|svn:|svn+ssh:|http:|https:)//.+') 39 self.rx_url = re.compile("(?:file:|svn:|svn+ssh:|http:|https:)//.+")
40 self.rx_rev = re.compile('\\d+') 40 self.rx_rev = re.compile("\\d+")
41 41
42 self.tag1Combo.clear() 42 self.tag1Combo.clear()
43 self.tag1Combo.addItems(mergelist1) 43 self.tag1Combo.addItems(mergelist1)
44 self.tag2Combo.clear() 44 self.tag2Combo.clear()
45 self.tag2Combo.addItems(mergelist2) 45 self.tag2Combo.addItems(mergelist2)
46 self.targetCombo.clear() 46 self.targetCombo.clear()
47 self.targetCombo.addItems(targetlist) 47 self.targetCombo.addItems(targetlist)
48 48
49 self.okButton = self.buttonBox.button( 49 self.okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
50 QDialogButtonBox.StandardButton.Ok)
51 self.okButton.setEnabled(False) 50 self.okButton.setEnabled(False)
52 51
53 msh = self.minimumSizeHint() 52 msh = self.minimumSizeHint()
54 self.resize(max(self.width(), msh.width()), msh.height()) 53 self.resize(max(self.width(), msh.width()), msh.height())
55 54
56 def __enableOkButton(self): 55 def __enableOkButton(self):
57 """ 56 """
58 Private method used to enable/disable the OK-button. 57 Private method used to enable/disable the OK-button.
59 """ 58 """
60 self.okButton.setDisabled( 59 self.okButton.setDisabled(
61 self.tag1Combo.currentText() != "" or 60 self.tag1Combo.currentText() != ""
62 self.tag2Combo.currentText() != "" or 61 or self.tag2Combo.currentText() != ""
63 not ( 62 or not (
64 (bool(self.rx_url.fullmatch(self.tag1Combo.currentText())) and 63 (
65 bool(self.rx_url.fullmatch(self.tag2Combo.currentText()))) or 64 bool(self.rx_url.fullmatch(self.tag1Combo.currentText()))
66 (bool(self.rx_rev.fullmatch(self.tag1Combo.currentText())) and 65 and bool(self.rx_url.fullmatch(self.tag2Combo.currentText()))
67 bool(self.rx_rev.fullmatch(self.tag2Combo.currentText()))) 66 )
67 or (
68 bool(self.rx_rev.fullmatch(self.tag1Combo.currentText()))
69 and bool(self.rx_rev.fullmatch(self.tag2Combo.currentText()))
70 )
68 ) 71 )
69 ) 72 )
70 73
71 def on_tag1Combo_editTextChanged(self, text): 74 def on_tag1Combo_editTextChanged(self, text):
72 """ 75 """
73 Private slot to handle the tag1Combo editTextChanged signal. 76 Private slot to handle the tag1Combo editTextChanged signal.
74 77
75 @param text text of the combo (string) 78 @param text text of the combo (string)
76 """ 79 """
77 self.__enableOkButton() 80 self.__enableOkButton()
78 81
79 def on_tag2Combo_editTextChanged(self, text): 82 def on_tag2Combo_editTextChanged(self, text):
80 """ 83 """
81 Private slot to handle the tag2Combo editTextChanged signal. 84 Private slot to handle the tag2Combo editTextChanged signal.
82 85
83 @param text text of the combo (string) 86 @param text text of the combo (string)
84 """ 87 """
85 self.__enableOkButton() 88 self.__enableOkButton()
86 89
87 def getParameters(self): 90 def getParameters(self):
88 """ 91 """
89 Public method to retrieve the merge data. 92 Public method to retrieve the merge data.
90 93
91 @return tuple naming two tag names or two revisions, a target and 94 @return tuple naming two tag names or two revisions, a target and
92 a flag indicating a forced merge (string, string, string, boolean) 95 a flag indicating a forced merge (string, string, string, boolean)
93 """ 96 """
94 return (self.tag1Combo.currentText(), 97 return (
95 self.tag2Combo.currentText(), 98 self.tag1Combo.currentText(),
96 self.targetCombo.currentText(), 99 self.tag2Combo.currentText(),
97 self.forceCheckBox.isChecked()) 100 self.targetCombo.currentText(),
101 self.forceCheckBox.isChecked(),
102 )

eric ide

mercurial