Plugins/VcsPlugins/vcsPySvn/SvnMergeDialog.py

changeset 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
-1:000000000000 0:de9c2efb9d02
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2003 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to enter the data for a merge operation.
8 """
9
10 from PyQt4.QtCore import *
11 from PyQt4.QtGui import *
12
13 from Ui_SvnMergeDialog import Ui_SvnMergeDialog
14
15 class SvnMergeDialog(QDialog, Ui_SvnMergeDialog):
16 """
17 Class implementing a dialog to enter the data for a merge operation.
18 """
19 def __init__(self, mergelist1, mergelist2, targetlist, force = False, parent = None):
20 """
21 Constructor
22
23 @param mergelist1 list of previously entered URLs/revisions (list of strings)
24 @param mergelist2 list of previously entered URLs/revisions (list of strings)
25 @param targetlist list of previously entered targets (list of strings)
26 @param force flag indicating a forced merge (boolean)
27 @param parent parent widget (QWidget)
28 """
29 QDialog.__init__(self, parent)
30 self.setupUi(self)
31
32 self.forceCheckBox.setChecked(force)
33
34 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
35 self.okButton.setEnabled(False)
36
37 self.rx_url = QRegExp('(?:file:|svn:|svn+ssh:|http:|https:)//.+')
38 self.rx_rev = QRegExp('\\d+')
39
40 self.tag1Combo.clear()
41 self.tag1Combo.addItems(mergelist1)
42 self.tag2Combo.clear()
43 self.tag2Combo.addItems(mergelist2)
44 self.targetCombo.clear()
45 self.targetCombo.addItems(targetlist)
46
47 def __enableOkButton(self):
48 """
49 Private method used to enable/disable the OK-button.
50
51 @param text ignored
52 """
53 self.okButton.setDisabled(
54 self.tag1Combo.currentText() == "" or \
55 self.tag2Combo.currentText() == "" or \
56 not ((self.rx_url.exactMatch(self.tag1Combo.currentText()) and \
57 self.rx_url.exactMatch(self.tag2Combo.currentText())) or \
58 (self.rx_rev.exactMatch(self.tag1Combo.currentText()) and \
59 self.rx_rev.exactMatch(self.tag2Combo.currentText()))
60 )
61 )
62
63 def on_tag1Combo_editTextChanged(self, text):
64 """
65 Private slot to handle the tag1Combo editTextChanged signal.
66 """
67 self.__enableOkButton()
68
69 def on_tag2Combo_editTextChanged(self, text):
70 """
71 Private slot to handle the tag2Combo editTextChanged signal.
72 """
73 self.__enableOkButton()
74
75 def getParameters(self):
76 """
77 Public method to retrieve the tag data.
78
79 @return tuple naming two tag names or two revisions, a target and
80 a flag indicating a forced merge (string, string, string, boolean)
81 """
82 return (self.tag1Combo.currentText(),
83 self.tag2Combo.currentText(),
84 self.targetCombo.currentText(),
85 self.forceCheckBox.isChecked())

eric ide

mercurial