eric6/Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2011 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to enter data for the Mercurial import command.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtCore import pyqtSlot, QDateTime
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
14
15 from E5Gui.E5PathPicker import E5PathPickerModes
16
17 from .Ui_HgImportDialog import Ui_HgImportDialog
18
19
20 class HgImportDialog(QDialog, Ui_HgImportDialog):
21 """
22 Class implementing a dialog to enter data for the Mercurial import command.
23 """
24 def __init__(self, parent=None):
25 """
26 Constructor
27
28 @param parent reference to the parent widget (QWidget)
29 """
30 super(HgImportDialog, self).__init__(parent)
31 self.setupUi(self)
32
33 self.patchFilePicker.setMode(E5PathPickerModes.OpenFileMode)
34 self.patchFilePicker.setFilters(self.tr(
35 "Patch Files (*.diff *.patch);;All Files (*)"))
36
37 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
38
39 self.__initDateTime = QDateTime.currentDateTime()
40 self.dateEdit.setDateTime(self.__initDateTime)
41
42 def __updateOK(self):
43 """
44 Private slot to update the OK button.
45 """
46 enabled = True
47 if self.patchFilePicker.text() == "":
48 enabled = False
49
50 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled)
51
52 @pyqtSlot(str)
53 def on_patchFilePicker_textChanged(self, txt):
54 """
55 Private slot to react on changes of the patch file edit.
56
57 @param txt contents of the line edit (string)
58 """
59 self.__updateOK()
60
61 def getParameters(self):
62 """
63 Public method to retrieve the import data.
64
65 @return tuple naming the patch file, a flag indicating to not commit,
66 a commit message, a commit date, a commit user, a strip count and
67 a flag indicating to enforce the import
68 (string, boolean, string, string, string, integer, boolean)
69 """
70 if self.dateEdit.dateTime() != self.__initDateTime:
71 date = self.dateEdit.dateTime().toString("yyyy-MM-dd hh:mm")
72 else:
73 date = ""
74
75 return (self.patchFilePicker.text(), self.noCommitCheckBox.isChecked(),
76 self.messageEdit.toPlainText(), date, self.userEdit.text(),
77 self.stripSpinBox.value(), self.forceCheckBox.isChecked())

eric ide

mercurial