Wed, 31 Jul 2013 18:34:43 +0200
Extended the side-by-side diff dialog to allow to pass in strings to compare and regenerated the source docu.
--- a/APIs/Python3/eric5.api Sun Jul 28 14:22:01 2013 +0200 +++ b/APIs/Python3/eric5.api Wed Jul 31 18:34:43 2013 +0200 @@ -7638,6 +7638,7 @@ eric5.UI.BrowserSortFilterProxyModel.BrowserSortFilterProxyModel.preferencesChanged?4() eric5.UI.BrowserSortFilterProxyModel.BrowserSortFilterProxyModel.sort?4(column, order) eric5.UI.BrowserSortFilterProxyModel.BrowserSortFilterProxyModel?1(parent=None) +eric5.UI.CompareDialog.CompareDialog.compare?4(lines1, lines2, name1="", name2="") eric5.UI.CompareDialog.CompareDialog.on_buttonBox_clicked?4(button) eric5.UI.CompareDialog.CompareDialog.on_diffButton_clicked?4() eric5.UI.CompareDialog.CompareDialog.on_downButton_clicked?4()
--- a/Documentation/Help/source.qhp Sun Jul 28 14:22:01 2013 +0200 +++ b/Documentation/Help/source.qhp Wed Jul 31 18:34:43 2013 +0200 @@ -2199,10 +2199,12 @@ <keyword name="CompareDialog (Constructor)" id="CompareDialog (Constructor)" ref="eric5.UI.CompareDialog.html#CompareDialog.__init__" /> <keyword name="CompareDialog (Module)" id="CompareDialog (Module)" ref="eric5.UI.CompareDialog.html" /> <keyword name="CompareDialog.__appendText" id="CompareDialog.__appendText" ref="eric5.UI.CompareDialog.html#CompareDialog.__appendText" /> + <keyword name="CompareDialog.__compare" id="CompareDialog.__compare" ref="eric5.UI.CompareDialog.html#CompareDialog.__compare" /> <keyword name="CompareDialog.__fileChanged" id="CompareDialog.__fileChanged" ref="eric5.UI.CompareDialog.html#CompareDialog.__fileChanged" /> <keyword name="CompareDialog.__moveTextToCurrentDiffPos" id="CompareDialog.__moveTextToCurrentDiffPos" ref="eric5.UI.CompareDialog.html#CompareDialog.__moveTextToCurrentDiffPos" /> <keyword name="CompareDialog.__scrollBarMoved" id="CompareDialog.__scrollBarMoved" ref="eric5.UI.CompareDialog.html#CompareDialog.__scrollBarMoved" /> <keyword name="CompareDialog.__selectFile" id="CompareDialog.__selectFile" ref="eric5.UI.CompareDialog.html#CompareDialog.__selectFile" /> + <keyword name="CompareDialog.compare" id="CompareDialog.compare" ref="eric5.UI.CompareDialog.html#CompareDialog.compare" /> <keyword name="CompareDialog.on_buttonBox_clicked" id="CompareDialog.on_buttonBox_clicked" ref="eric5.UI.CompareDialog.html#CompareDialog.on_buttonBox_clicked" /> <keyword name="CompareDialog.on_diffButton_clicked" id="CompareDialog.on_diffButton_clicked" ref="eric5.UI.CompareDialog.html#CompareDialog.on_diffButton_clicked" /> <keyword name="CompareDialog.on_downButton_clicked" id="CompareDialog.on_downButton_clicked" ref="eric5.UI.CompareDialog.html#CompareDialog.on_downButton_clicked" />
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgArchiveDialog.html Wed Jul 31 18:34:43 2013 +0200 @@ -0,0 +1,128 @@ +<!DOCTYPE html> +<html><head> +<title>eric5.Plugins.VcsPlugins.vcsMercurial.HgArchiveDialog</title> +<meta charset="UTF-8"> +<style> +body { + background: #EDECE6; + margin: 0em 1em 10em 1em; + color: black; +} + +h1 { color: white; background: #85774A; } +h2 { color: white; background: #85774A; } +h3 { color: white; background: #9D936E; } +h4 { color: white; background: #9D936E; } + +a { color: #BA6D36; } + +</style> +</head> +<body><a NAME="top" ID="top"></a> +<h1>eric5.Plugins.VcsPlugins.vcsMercurial.HgArchiveDialog</h1> +<p> +Module implementing a dialog to enter the archive data. +</p> +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Classes</h3> +<table> +<tr> +<td><a href="#HgArchiveDialog">HgArchiveDialog</a></td> +<td>Class implementing a dialog to enter the archive data.</td> +</tr> +</table> +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> +<hr /><hr /> +<a NAME="HgArchiveDialog" ID="HgArchiveDialog"></a> +<h2>HgArchiveDialog</h2> +<p> + Class implementing a dialog to enter the archive data. +</p> +<h3>Derived from</h3> +QDialog, Ui_HgArchiveDialog +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> +<table> +<tr> +<td><a href="#HgArchiveDialog.__init__">HgArchiveDialog</a></td> +<td>Constructor</td> +</tr><tr> +<td><a href="#HgArchiveDialog.getData">getData</a></td> +<td>Public method to retrieve the data.</td> +</tr><tr> +<td><a href="#HgArchiveDialog.on_archiveButton_clicked">on_archiveButton_clicked</a></td> +<td>Private slot to select the archive name via a file selection dialog.</td> +</tr><tr> +<td><a href="#HgArchiveDialog.on_archiveEdit_textChanged">on_archiveEdit_textChanged</a></td> +<td>Private slot to handle changes of the archive name.</td> +</tr><tr> +<td><a href="#HgArchiveDialog.on_typeComboBox_activated">on_typeComboBox_activated</a></td> +<td>Private slot to react on changes of the selected archive type.</td> +</tr> +</table> +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<a NAME="HgArchiveDialog.__init__" ID="HgArchiveDialog.__init__"></a> +<h4>HgArchiveDialog (Constructor)</h4> +<b>HgArchiveDialog</b>(<i>vcs, parent=None</i>) +<p> + Constructor +</p><dl> +<dt><i>vcs</i></dt> +<dd> +reference to the Mercurial object (Hg) +</dd><dt><i>parent</i></dt> +<dd> +reference to the parent widget (QWidget) +</dd> +</dl><a NAME="HgArchiveDialog.getData" ID="HgArchiveDialog.getData"></a> +<h4>HgArchiveDialog.getData</h4> +<b>getData</b>(<i></i>) +<p> + Public method to retrieve the data. +</p><dl> +<dt>Returns:</dt> +<dd> +tuple giving the archive name (string), the archive type (string), + the directory prefix 8string) and a flag indicating to recurse into + subrepositories (boolean) +</dd> +</dl><a NAME="HgArchiveDialog.on_archiveButton_clicked" ID="HgArchiveDialog.on_archiveButton_clicked"></a> +<h4>HgArchiveDialog.on_archiveButton_clicked</h4> +<b>on_archiveButton_clicked</b>(<i></i>) +<p> + Private slot to select the archive name via a file selection dialog. +</p><a NAME="HgArchiveDialog.on_archiveEdit_textChanged" ID="HgArchiveDialog.on_archiveEdit_textChanged"></a> +<h4>HgArchiveDialog.on_archiveEdit_textChanged</h4> +<b>on_archiveEdit_textChanged</b>(<i>archive</i>) +<p> + Private slot to handle changes of the archive name. +</p><a NAME="HgArchiveDialog.on_typeComboBox_activated" ID="HgArchiveDialog.on_typeComboBox_activated"></a> +<h4>HgArchiveDialog.on_typeComboBox_activated</h4> +<b>on_typeComboBox_activated</b>(<i>index</i>) +<p> + Private slot to react on changes of the selected archive type. +</p><dl> +<dt><i>index</i></dt> +<dd> +index of the selected type (integer) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html> \ No newline at end of file
--- a/Documentation/Source/eric5.UI.CompareDialog.html Sun Jul 28 14:22:01 2013 +0200 +++ b/Documentation/Source/eric5.UI.CompareDialog.html Wed Jul 31 18:34:43 2013 +0200 @@ -72,6 +72,9 @@ <td><a href="#CompareDialog.__appendText">__appendText</a></td> <td>Private method to append text to the end of the contents pane.</td> </tr><tr> +<td><a href="#CompareDialog.__compare">__compare</a></td> +<td>Private method to compare two lists of text.</td> +</tr><tr> <td><a href="#CompareDialog.__fileChanged">__fileChanged</a></td> <td>Private slot to enable/disable the Compare button.</td> </tr><tr> @@ -84,6 +87,9 @@ <td><a href="#CompareDialog.__selectFile">__selectFile</a></td> <td>Private slot to display a file selection dialog.</td> </tr><tr> +<td><a href="#CompareDialog.compare">compare</a></td> +<td>Public method to compare two lists of text.</td> +</tr><tr> <td><a href="#CompareDialog.on_buttonBox_clicked">on_buttonBox_clicked</a></td> <td>Private slot called by a button of the button box clicked.</td> </tr><tr> @@ -155,6 +161,19 @@ <dd> flag indicating interline changes (boolean) </dd> +</dl><a NAME="CompareDialog.__compare" ID="CompareDialog.__compare"></a> +<h4>CompareDialog.__compare</h4> +<b>__compare</b>(<i>lines1, lines2</i>) +<p> + Private method to compare two lists of text. +</p><dl> +<dt><i>lines1</i></dt> +<dd> +text to compare against (list of strings) +</dd><dt><i>lines2</i></dt> +<dd> +text to compare (list of strings) +</dd> </dl><a NAME="CompareDialog.__fileChanged" ID="CompareDialog.__fileChanged"></a> <h4>CompareDialog.__fileChanged</h4> <b>__fileChanged</b>(<i></i>) @@ -187,6 +206,25 @@ field for the display of the selected filename (QLineEdit) </dd> +</dl><a NAME="CompareDialog.compare" ID="CompareDialog.compare"></a> +<h4>CompareDialog.compare</h4> +<b>compare</b>(<i>lines1, lines2, name1="", name2=""</i>) +<p> + Public method to compare two lists of text. +</p><dl> +<dt><i>lines1</i></dt> +<dd> +text to compare against (string or list of strings) +</dd><dt><i>lines2</i></dt> +<dd> +text to compare (string or list of strings) +</dd><dt><i>name1=</i></dt> +<dd> +name to be shown for the first text (string) +</dd><dt><i>name2=</i></dt> +<dd> +name to be shown for the second text (string) +</dd> </dl><a NAME="CompareDialog.on_buttonBox_clicked" ID="CompareDialog.on_buttonBox_clicked"></a> <h4>CompareDialog.on_buttonBox_clicked</h4> <b>on_buttonBox_clicked</b>(<i>button</i>)
--- a/UI/CompareDialog.py Sun Jul 28 14:22:01 2013 +0200 +++ b/UI/CompareDialog.py Wed Jul 31 18:34:43 2013 +0200 @@ -242,6 +242,43 @@ .format(filename2)) return + self.__compare(lines1, lines2) + + def compare(self, lines1, lines2, name1="", name2=""): + """ + Public method to compare two lists of text. + + @param lines1 text to compare against (string or list of strings) + @param lines2 text to compare (string or list of strings) + @keyparam name1 name to be shown for the first text (string) + @keyparam name2 name to be shown for the second text (string) + """ + if name1 == "" or name2 == "": + self.filesGroup.hide() + else: + self.file1Button.hide() + self.file2Button.hide() + self.file1Edit.setText(name1) + self.file1Edit.setReadOnly(True) + self.file2Edit.setText(name2) + self.file2Edit.setReadOnly(True) + self.diffButton.setEnabled(False) + self.diffButton.hide() + + if type(lines1) == type(""): + lines1 = lines1.splitlines(True) + if type(lines2) == type(""): + lines2 = lines2.splitlines(True) + + self.__compare(lines1, lines2) + + def __compare(self, lines1, lines2): + """ + Private method to compare two lists of text. + + @param lines1 text to compare against (list of strings) + @param lines2 text to compare (list of strings) + """ self.contents_1.clear() self.contents_2.clear()