src/eric7/Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
18 18
19 class HgImportDialog(QDialog, Ui_HgImportDialog): 19 class HgImportDialog(QDialog, Ui_HgImportDialog):
20 """ 20 """
21 Class implementing a dialog to enter data for the Mercurial import command. 21 Class implementing a dialog to enter data for the Mercurial import command.
22 """ 22 """
23
23 def __init__(self, vcs, parent=None): 24 def __init__(self, vcs, parent=None):
24 """ 25 """
25 Constructor 26 Constructor
26 27
27 @param vcs reference to the VCS object 28 @param vcs reference to the VCS object
28 @type Hg 29 @type Hg
29 @param parent reference to the parent widget 30 @param parent reference to the parent widget
30 @type QWidget 31 @type QWidget
31 """ 32 """
32 super().__init__(parent) 33 super().__init__(parent)
33 self.setupUi(self) 34 self.setupUi(self)
34 35
35 self.patchFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) 36 self.patchFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
36 self.patchFilePicker.setFilters(self.tr( 37 self.patchFilePicker.setFilters(
37 "Patch Files (*.diff *.patch);;All Files (*)")) 38 self.tr("Patch Files (*.diff *.patch);;All Files (*)")
38 39 )
40
39 self.secretCheckBox.setEnabled(vcs.version >= (5, 3, 0)) 41 self.secretCheckBox.setEnabled(vcs.version >= (5, 3, 0))
40 42
41 self.buttonBox.button( 43 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
42 QDialogButtonBox.StandardButton.Ok).setEnabled(False) 44
43
44 project = ericApp().getObject("Project") 45 project = ericApp().getObject("Project")
45 pwl, pel = project.getProjectDictionaries() 46 pwl, pel = project.getProjectDictionaries()
46 language = project.getProjectSpellLanguage() 47 language = project.getProjectSpellLanguage()
47 self.messageEdit.setLanguageWithPWL( 48 self.messageEdit.setLanguageWithPWL(language, pwl or None, pel or None)
48 language, pwl or None, pel or None) 49
49
50 self.__initDateTime = QDateTime.currentDateTime() 50 self.__initDateTime = QDateTime.currentDateTime()
51 self.dateEdit.setDateTime(self.__initDateTime) 51 self.dateEdit.setDateTime(self.__initDateTime)
52 52
53 def __updateOK(self): 53 def __updateOK(self):
54 """ 54 """
55 Private slot to update the OK button. 55 Private slot to update the OK button.
56 """ 56 """
57 enabled = True 57 enabled = True
58 if self.patchFilePicker.text() == "": 58 if self.patchFilePicker.text() == "":
59 enabled = False 59 enabled = False
60 60
61 self.buttonBox.button( 61 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enabled)
62 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) 62
63
64 @pyqtSlot(str) 63 @pyqtSlot(str)
65 def on_patchFilePicker_textChanged(self, txt): 64 def on_patchFilePicker_textChanged(self, txt):
66 """ 65 """
67 Private slot to react on changes of the patch file edit. 66 Private slot to react on changes of the patch file edit.
68 67
69 @param txt contents of the line edit (string) 68 @param txt contents of the line edit (string)
70 """ 69 """
71 self.__updateOK() 70 self.__updateOK()
72 71
73 def getParameters(self): 72 def getParameters(self):
74 """ 73 """
75 Public method to retrieve the import data. 74 Public method to retrieve the import data.
76 75
77 @return tuple naming the patch file, a flag indicating to not commit, 76 @return tuple naming the patch file, a flag indicating to not commit,
78 a commit message, a commit date, a commit user, a flag indicating 77 a commit message, a commit date, a commit user, a flag indicating
79 to commit with the secret phase, a strip count and a flag 78 to commit with the secret phase, a strip count and a flag
80 indicating to enforce the import 79 indicating to enforce the import
81 @rtype tuple of (str, bool, str, str, str, bool, int, bool) 80 @rtype tuple of (str, bool, str, str, str, bool, int, bool)
82 """ 81 """
83 date = ( 82 date = (
84 self.dateEdit.dateTime().toString("yyyy-MM-dd hh:mm") 83 self.dateEdit.dateTime().toString("yyyy-MM-dd hh:mm")
85 if self.dateEdit.dateTime() != self.__initDateTime else 84 if self.dateEdit.dateTime() != self.__initDateTime
86 "" 85 else ""
87 ) 86 )
88 87
89 return (self.patchFilePicker.text(), self.noCommitCheckBox.isChecked(), 88 return (
90 self.messageEdit.toPlainText(), date, self.userEdit.text(), 89 self.patchFilePicker.text(),
91 self.secretCheckBox.isChecked(), self.stripSpinBox.value(), 90 self.noCommitCheckBox.isChecked(),
92 self.forceCheckBox.isChecked()) 91 self.messageEdit.toPlainText(),
92 date,
93 self.userEdit.text(),
94 self.secretCheckBox.isChecked(),
95 self.stripSpinBox.value(),
96 self.forceCheckBox.isChecked(),
97 )

eric ide

mercurial