Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgShelveDataDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3408
b6e6a7062d12
child 3656
441956d8fce5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgShelveDataDialog.py	Thu Apr 03 23:05:31 2014 +0200
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to enter the data for a shelve operation.
+"""
+
+from __future__ import unicode_literals
+
+from PyQt4.QtCore import QDateTime
+from PyQt4.QtGui import QDialog
+
+from .Ui_HgShelveDataDialog import Ui_HgShelveDataDialog
+
+
+class HgShelveDataDialog(QDialog, Ui_HgShelveDataDialog):
+    """
+    Class implementing a dialog to enter the data for a shelve operation.
+    """
+    def __init__(self, parent=None):
+        """
+        Constructor
+        
+        @param parent reference to the parent widget (QWidget)
+        """
+        super(HgShelveDataDialog, self).__init__(parent)
+        self.setupUi(self)
+        
+        self.__initialDateTime = QDateTime.currentDateTime()
+        self.dateTimeEdit.setDateTime(self.__initialDateTime)
+        
+        msh = self.minimumSizeHint()
+        self.resize(max(self.width(), msh.width()), msh.height())
+    
+    def getData(self):
+        """
+        Public method to get the user data.
+        
+        @return tuple containing the name (string), date (QDateTime),
+            message (string) and a flag indicating to add/remove
+            new/missing files (boolean)
+        """
+        if self.dateTimeEdit.dateTime() != self.__initialDateTime:
+            dateTime = self.dateTimeEdit.dateTime()
+        else:
+            dateTime = QDateTime()
+        return (
+            self.nameEdit.text().replace(" ", "_"),
+            dateTime,
+            self.messageEdit.text(),
+            self.addRemoveCheckBox.isChecked(),
+        )

eric ide

mercurial