Changed the Mercurial Log Browser dialog to maintain its position after being closed.

Tue, 18 Feb 2014 19:05:53 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 18 Feb 2014 19:05:53 +0100
changeset 3283
2079b76a738b
parent 3282
85177748df4d
child 3284
8f7d97997243

Changed the Mercurial Log Browser dialog to maintain its position after being closed.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Mon Feb 17 19:08:54 2014 +0100
+++ b/APIs/Python3/eric5.api	Tue Feb 18 19:05:53 2014 +0100
@@ -4571,8 +4571,9 @@
 eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.HgLogBrowserDialog.on_sendButton_clicked?4()
 eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.HgLogBrowserDialog.on_stopCheckBox_clicked?4(checked)
 eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.HgLogBrowserDialog.on_toDate_dateChanged?4(date)
-eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.HgLogBrowserDialog.start?4(fn)
-eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.HgLogBrowserDialog?1(vcs, mode="log", bundle=None, isFile=False, parent=None)
+eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.HgLogBrowserDialog.show?4()
+eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.HgLogBrowserDialog.start?4(fn, bundle=None, isFile=False)
+eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.HgLogBrowserDialog?1(vcs, mode="log", parent=None)
 eric5.Plugins.VcsPlugins.vcsMercurial.HgLogDialog.HgLogDialog.closeEvent?4(e)
 eric5.Plugins.VcsPlugins.vcsMercurial.HgLogDialog.HgLogDialog.keyPressEvent?4(evt)
 eric5.Plugins.VcsPlugins.vcsMercurial.HgLogDialog.HgLogDialog.on_input_returnPressed?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Mon Feb 17 19:08:54 2014 +0100
+++ b/Documentation/Help/source.qhp	Tue Feb 18 19:05:53 2014 +0100
@@ -6119,6 +6119,7 @@
       <keyword name="HgLogBrowserDialog.__processBuffer" id="HgLogBrowserDialog.__processBuffer" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.__processBuffer" />
       <keyword name="HgLogBrowserDialog.__readStderr" id="HgLogBrowserDialog.__readStderr" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.__readStderr" />
       <keyword name="HgLogBrowserDialog.__readStdout" id="HgLogBrowserDialog.__readStdout" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.__readStdout" />
+      <keyword name="HgLogBrowserDialog.__resetUI" id="HgLogBrowserDialog.__resetUI" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.__resetUI" />
       <keyword name="HgLogBrowserDialog.__resizeColumnsFiles" id="HgLogBrowserDialog.__resizeColumnsFiles" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.__resizeColumnsFiles" />
       <keyword name="HgLogBrowserDialog.__resizeColumnsLog" id="HgLogBrowserDialog.__resizeColumnsLog" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.__resizeColumnsLog" />
       <keyword name="HgLogBrowserDialog.__resortFiles" id="HgLogBrowserDialog.__resortFiles" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.__resortFiles" />
@@ -6148,6 +6149,7 @@
       <keyword name="HgLogBrowserDialog.on_sendButton_clicked" id="HgLogBrowserDialog.on_sendButton_clicked" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.on_sendButton_clicked" />
       <keyword name="HgLogBrowserDialog.on_stopCheckBox_clicked" id="HgLogBrowserDialog.on_stopCheckBox_clicked" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.on_stopCheckBox_clicked" />
       <keyword name="HgLogBrowserDialog.on_toDate_dateChanged" id="HgLogBrowserDialog.on_toDate_dateChanged" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.on_toDate_dateChanged" />
+      <keyword name="HgLogBrowserDialog.show" id="HgLogBrowserDialog.show" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.show" />
       <keyword name="HgLogBrowserDialog.start" id="HgLogBrowserDialog.start" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html#HgLogBrowserDialog.start" />
       <keyword name="HgLogDialog" id="HgLogDialog" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogDialog.html#HgLogDialog" />
       <keyword name="HgLogDialog (Constructor)" id="HgLogDialog (Constructor)" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgLogDialog.html#HgLogDialog.__init__" />
--- a/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html	Mon Feb 17 19:08:54 2014 +0100
+++ b/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html	Tue Feb 18 19:05:53 2014 +0100
@@ -120,6 +120,9 @@
 <td><a href="#HgLogBrowserDialog.__readStdout">__readStdout</a></td>
 <td>Private slot to handle the readyReadStandardOutput signal.</td>
 </tr><tr>
+<td><a href="#HgLogBrowserDialog.__resetUI">__resetUI</a></td>
+<td>Private method to reset the user interface.</td>
+</tr><tr>
 <td><a href="#HgLogBrowserDialog.__resizeColumnsFiles">__resizeColumnsFiles</a></td>
 <td>Private method to resize the changed files tree columns.</td>
 </tr><tr>
@@ -207,6 +210,9 @@
 <td><a href="#HgLogBrowserDialog.on_toDate_dateChanged">on_toDate_dateChanged</a></td>
 <td>Private slot called, when the from date changes.</td>
 </tr><tr>
+<td><a href="#HgLogBrowserDialog.show">show</a></td>
+<td>Public slot to show the dialog.</td>
+</tr><tr>
 <td><a href="#HgLogBrowserDialog.start">start</a></td>
 <td>Public slot to start the hg log command.</td>
 </tr>
@@ -217,7 +223,7 @@
 </table>
 <a NAME="HgLogBrowserDialog.__init__" ID="HgLogBrowserDialog.__init__"></a>
 <h4>HgLogBrowserDialog (Constructor)</h4>
-<b>HgLogBrowserDialog</b>(<i>vcs, mode="log", bundle=None, isFile=False, parent=None</i>)
+<b>HgLogBrowserDialog</b>(<i>vcs, mode="log", parent=None</i>)
 <p>
         Constructor
 </p><dl>
@@ -227,12 +233,6 @@
 </dd><dt><i>mode</i></dt>
 <dd>
 mode of the dialog (string; one of log, incoming, outgoing)
-</dd><dt><i>bundle</i></dt>
-<dd>
-name of a bundle file (string)
-</dd><dt><i>isFile</i></dt>
-<dd>
-flag indicating log for a file is to be shown (boolean)
 </dd><dt><i>parent</i></dt>
 <dd>
 parent widget (QWidget)
@@ -498,6 +498,11 @@
         Private slot to handle the readyReadStandardOutput signal.
 </p><p>
         It reads the output of the process and inserts it into a buffer.
+</p><a NAME="HgLogBrowserDialog.__resetUI" ID="HgLogBrowserDialog.__resetUI"></a>
+<h4>HgLogBrowserDialog.__resetUI</h4>
+<b>__resetUI</b>(<i></i>)
+<p>
+        Private method to reset the user interface.
 </p><a NAME="HgLogBrowserDialog.__resizeColumnsFiles" ID="HgLogBrowserDialog.__resizeColumnsFiles"></a>
 <h4>HgLogBrowserDialog.__resizeColumnsFiles</h4>
 <b>__resizeColumnsFiles</b>(<i></i>)
@@ -722,15 +727,27 @@
 <dd>
 new date (QDate)
 </dd>
-</dl><a NAME="HgLogBrowserDialog.start" ID="HgLogBrowserDialog.start"></a>
+</dl><a NAME="HgLogBrowserDialog.show" ID="HgLogBrowserDialog.show"></a>
+<h4>HgLogBrowserDialog.show</h4>
+<b>show</b>(<i></i>)
+<p>
+        Public slot to show the dialog.
+</p><a NAME="HgLogBrowserDialog.start" ID="HgLogBrowserDialog.start"></a>
 <h4>HgLogBrowserDialog.start</h4>
-<b>start</b>(<i>fn</i>)
+<b>start</b>(<i>fn, bundle=None, isFile=False</i>)
 <p>
         Public slot to start the hg log command.
 </p><dl>
 <dt><i>fn</i></dt>
 <dd>
 filename to show the log for (string)
+</dd><dt><i>bundle=</i></dt>
+<dd>
+name of a bundle file (string)
+</dd><dt><i>isFile=</i></dt>
+<dd>
+flag indicating log for a file is to be shown
+            (boolean)
 </dd>
 </dl>
 <div align="right"><a href="#top">Up</a></div>
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Mon Feb 17 19:08:54 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Tue Feb 18 19:05:53 2014 +0100
@@ -42,20 +42,19 @@
     MessageColumn = 6
     TagsColumn = 7
     
-    def __init__(self, vcs, mode="log", bundle=None, isFile=False,
-                 parent=None):
+    def __init__(self, vcs, mode="log", parent=None):
         """
         Constructor
         
         @param vcs reference to the vcs object
         @param mode mode of the dialog (string; one of log, incoming, outgoing)
-        @param bundle name of a bundle file (string)
-        @param isFile flag indicating log for a file is to be shown (boolean)
         @param parent parent widget (QWidget)
         """
         super().__init__(parent)
         self.setupUi(self)
         
+        self.__position = QPoint()
+        
         if mode == "log":
             self.setWindowTitle(self.tr("Mercurial Log"))
         elif mode == "incoming":
@@ -75,16 +74,13 @@
             self.tr("Press to refresh the list of changesets"))
         self.refreshButton.setEnabled(False)
         
-        self.sbsCheckBox.setEnabled(isFile)
-        self.sbsCheckBox.setVisible(isFile)
-        
         self.vcs = vcs
         if mode in ("log", "incoming", "outgoing"):
             self.commandMode = mode
             self.initialCommandMode = mode
         else:
             self.commandMode = "log"
-        self.bundle = bundle
+        self.bundle = ""
         self.__hgClient = vcs.getClient()
         
         self.__initData()
@@ -210,8 +206,43 @@
                 QTimer.singleShot(2000, self.process.kill)
                 self.process.waitForFinished(3000)
         
+        self.__position = self.pos()
+        
         e.accept()
     
+    def show(self):
+        """
+        Public slot to show the dialog.
+        """
+        if not self.__position.isNull():
+            self.move(self.__position)
+        self.__resetUI()
+        
+        super().show()
+    
+    def __resetUI(self):
+        """
+        Private method to reset the user interface.
+        """
+        self.branchCombo.clear()
+        self.fromDate.setDate(QDate.currentDate())
+        self.toDate.setDate(QDate.currentDate())
+        self.fieldCombo.setCurrentIndex(self.fieldCombo.findText(
+            self.tr("Message")))
+        self.limitSpinBox.setValue(self.vcs.getPlugin().getPreferences(
+            "LogLimit"))
+        self.stopCheckBox.setChecked(self.vcs.getPlugin().getPreferences(
+            "StopLogOnCopy"))
+        
+        if self.initialCommandMode in ("incoming", "outgoing"):
+            self.nextButton.setEnabled(False)
+            self.limitSpinBox.setEnabled(False)
+        
+        self.logTree.clear()
+        
+        self.commandMode = self.initialCommandMode
+
+    
     def __resizeColumnsLog(self):
         """
         Private method to resize the log tree columns.
@@ -776,15 +807,25 @@
             else:
                 self.__finish()
     
-    def start(self, fn):
+    def start(self, fn, bundle=None, isFile=False):
         """
         Public slot to start the hg log command.
         
         @param fn filename to show the log for (string)
+        @keyparam bundle name of a bundle file (string)
+        @keyparam isFile flag indicating log for a file is to be shown
+            (boolean)
         """
+        self.bundle = bundle
+        
+        self.sbsCheckBox.setEnabled(isFile)
+        self.sbsCheckBox.setVisible(isFile)
+        
         self.errorGroup.hide()
         QApplication.processEvents()
         
+        self.__initData()
+        
         self.filename = fn
         self.dname, self.fname = self.vcs.splitPath(fn)
         
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Mon Feb 17 19:08:54 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Tue Feb 18 19:05:53 2014 +0100
@@ -90,6 +90,8 @@
         
         self.log = None
         self.logBrowser = None
+        self.logBrowserIncoming = None
+        self.logBrowserOutgoing = None
         self.diff = None
         self.sbsDiff = None
         self.status = None
@@ -160,6 +162,10 @@
             self.log.close()
         if self.logBrowser is not None:
             self.logBrowser.close()
+        if self.logBrowserIncoming is not None:
+            self.logBrowserIncoming.close()
+        if self.logBrowserOutgoing is not None:
+            self.logBrowserOutgoing.close()
         if self.diff is not None:
             self.diff.close()
         if self.sbsDiff is not None:
@@ -1870,10 +1876,11 @@
         @keyparam isFile flag indicating log for a file is to be shown
             (boolean)
         """
-        from .HgLogBrowserDialog import HgLogBrowserDialog
-        self.logBrowser = HgLogBrowserDialog(self, isFile=isFile)
+        if self.logBrowser is None:
+            from .HgLogBrowserDialog import HgLogBrowserDialog
+            self.logBrowser = HgLogBrowserDialog(self)
         self.logBrowser.show()
-        self.logBrowser.start(path)
+        self.logBrowser.start(path, isFile=isFile)
     
     def hgIncoming(self, name):
         """
@@ -1883,10 +1890,11 @@
         @param name file/directory name to show the log of (string)
         """
         if self.getPlugin().getPreferences("UseLogBrowser"):
-            from .HgLogBrowserDialog import HgLogBrowserDialog
-            self.logBrowser = HgLogBrowserDialog(self, mode="incoming")
-            self.logBrowser.show()
-            self.logBrowser.start(name)
+            if self.logBrowserIncoming is None:
+                from .HgLogBrowserDialog import HgLogBrowserDialog
+                self.logBrowserIncoming = HgLogBrowserDialog(self, mode="incoming")
+            self.logBrowserIncoming.show()
+            self.logBrowserIncoming.start(name)
         else:
             from .HgLogDialog import HgLogDialog
             self.log = HgLogDialog(self, mode="incoming")
@@ -1901,10 +1909,11 @@
         @param name file/directory name to show the log of (string)
         """
         if self.getPlugin().getPreferences("UseLogBrowser"):
-            from .HgLogBrowserDialog import HgLogBrowserDialog
-            self.logBrowser = HgLogBrowserDialog(self, mode="outgoing")
-            self.logBrowser.show()
-            self.logBrowser.start(name)
+            if self.logBrowserOutgoing is None:
+                from .HgLogBrowserDialog import HgLogBrowserDialog
+                self.logBrowserOutgoing = HgLogBrowserDialog(self, mode="outgoing")
+            self.logBrowserOutgoing.show()
+            self.logBrowserOutgoing.start(name)
         else:
             from .HgLogDialog import HgLogDialog
             self.log = HgLogDialog(self, mode="outgoing")
@@ -2529,11 +2538,12 @@
             self.__lastChangeGroupPath = os.path.dirname(file)
             
             if self.getPlugin().getPreferences("UseLogBrowser"):
-                from .HgLogBrowserDialog import HgLogBrowserDialog
-                self.logBrowser = \
-                    HgLogBrowserDialog(self, mode="incoming", bundle=file)
-                self.logBrowser.show()
-                self.logBrowser.start(name)
+                if self.logBrowserIncoming is None:
+                    from .HgLogBrowserDialog import HgLogBrowserDialog
+                    self.logBrowserIncoming = \
+                        HgLogBrowserDialog(self, mode="incoming")
+                self.logBrowserIncoming.show()
+                self.logBrowserIncoming.start(name, bundle=file)
             else:
                 from .HgLogDialog import HgLogDialog
                 self.log = HgLogDialog(self, mode="incoming", bundle=file)

eric ide

mercurial