--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.UI.CompareDialog.html Thu Jul 07 11:23:56 2022 +0200 @@ -0,0 +1,502 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.UI.CompareDialog</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.UI.CompareDialog</h1> + +<p> +Module implementing a dialog to compare two files and show the result side by +side. +</p> +<h3>Global Attributes</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Classes</h3> + +<table> + +<tr> +<td><a href="#CompareDialog">CompareDialog</a></td> +<td>Class implementing a dialog to compare two files and show the result side by side.</td> +</tr> +<tr> +<td><a href="#CompareWindow">CompareWindow</a></td> +<td>Main window class for the standalone dialog.</td> +</tr> +</table> +<h3>Functions</h3> + +<table> + +<tr> +<td><a href="#removeMarkers">removeMarkers</a></td> +<td>Internal function to remove all diff markers.</td> +</tr> +<tr> +<td><a href="#sbsdiff">sbsdiff</a></td> +<td>Compare two sequences of lines; generate the delta for display side by side.</td> +</tr> +</table> +<hr /> +<hr /> +<a NAME="CompareDialog" ID="CompareDialog"></a> +<h2>CompareDialog</h2> + +<p> + Class implementing a dialog to compare two files and show the result side + by side. +</p> +<h3>Derived from</h3> +QWidget, Ui_CompareDialog +<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="#CompareDialog.__init__">CompareDialog</a></td> +<td>Constructor</td> +</tr> +<tr> +<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> +<td><a href="#CompareDialog.__generateFormats">__generateFormats</a></td> +<td>Private method to generate the various text formats.</td> +</tr> +<tr> +<td><a href="#CompareDialog.__moveTextToCurrentDiffPos">__moveTextToCurrentDiffPos</a></td> +<td>Private slot to move the text display to the current diff position.</td> +</tr> +<tr> +<td><a href="#CompareDialog.__scrollBarMoved">__scrollBarMoved</a></td> +<td>Private slot to enable the buttons and set the current diff position depending on scrollbar position.</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> +<td><a href="#CompareDialog.on_diffButton_clicked">on_diffButton_clicked</a></td> +<td>Private slot to handle the Compare button press.</td> +</tr> +<tr> +<td><a href="#CompareDialog.on_downButton_clicked">on_downButton_clicked</a></td> +<td>Private slot to go to the next difference.</td> +</tr> +<tr> +<td><a href="#CompareDialog.on_firstButton_clicked">on_firstButton_clicked</a></td> +<td>Private slot to go to the first difference.</td> +</tr> +<tr> +<td><a href="#CompareDialog.on_lastButton_clicked">on_lastButton_clicked</a></td> +<td>Private slot to go to the last difference.</td> +</tr> +<tr> +<td><a href="#CompareDialog.on_synchronizeCheckBox_toggled">on_synchronizeCheckBox_toggled</a></td> +<td>Private slot to connect or disconnect the scrollbars of the displays.</td> +</tr> +<tr> +<td><a href="#CompareDialog.on_upButton_clicked">on_upButton_clicked</a></td> +<td>Private slot to go to the previous difference.</td> +</tr> +<tr> +<td><a href="#CompareDialog.show">show</a></td> +<td>Public slot to show the dialog.</td> +</tr> +</table> +<h3>Static Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> + +<a NAME="CompareDialog.__init__" ID="CompareDialog.__init__"></a> +<h4>CompareDialog (Constructor)</h4> +<b>CompareDialog</b>(<i>files=None, parent=None</i>) + +<p> + Constructor +</p> +<dl> + +<dt><i>files</i></dt> +<dd> +list of files to compare and their label + (list of two tuples of two strings) +</dd> +<dt><i>parent</i></dt> +<dd> +parent widget (QWidget) +</dd> +</dl> +<a NAME="CompareDialog.__appendText" ID="CompareDialog.__appendText"></a> +<h4>CompareDialog.__appendText</h4> +<b>__appendText</b>(<i>pane, linenumber, line, charFormat, interLine=False</i>) + +<p> + Private method to append text to the end of the contents pane. +</p> +<dl> + +<dt><i>pane</i></dt> +<dd> +text edit widget to append text to (QTextedit) +</dd> +<dt><i>linenumber</i></dt> +<dd> +number of line to insert (string) +</dd> +<dt><i>line</i></dt> +<dd> +text to insert (string) +</dd> +<dt><i>charFormat</i></dt> +<dd> +text format to be used (QTextCharFormat) +</dd> +<dt><i>interLine</i></dt> +<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>) + +<p> + Private slot to enable/disable the Compare button. +</p> +<a NAME="CompareDialog.__generateFormats" ID="CompareDialog.__generateFormats"></a> +<h4>CompareDialog.__generateFormats</h4> +<b>__generateFormats</b>(<i></i>) + +<p> + Private method to generate the various text formats. +</p> +<a NAME="CompareDialog.__moveTextToCurrentDiffPos" ID="CompareDialog.__moveTextToCurrentDiffPos"></a> +<h4>CompareDialog.__moveTextToCurrentDiffPos</h4> +<b>__moveTextToCurrentDiffPos</b>(<i></i>) + +<p> + Private slot to move the text display to the current diff position. +</p> +<a NAME="CompareDialog.__scrollBarMoved" ID="CompareDialog.__scrollBarMoved"></a> +<h4>CompareDialog.__scrollBarMoved</h4> +<b>__scrollBarMoved</b>(<i>value</i>) + +<p> + Private slot to enable the buttons and set the current diff position + depending on scrollbar position. +</p> +<dl> + +<dt><i>value</i></dt> +<dd> +scrollbar position (integer) +</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>) + +<p> + Private slot called by a button of the button box clicked. +</p> +<dl> + +<dt><i>button</i></dt> +<dd> +button that was clicked (QAbstractButton) +</dd> +</dl> +<a NAME="CompareDialog.on_diffButton_clicked" ID="CompareDialog.on_diffButton_clicked"></a> +<h4>CompareDialog.on_diffButton_clicked</h4> +<b>on_diffButton_clicked</b>(<i></i>) + +<p> + Private slot to handle the Compare button press. +</p> +<a NAME="CompareDialog.on_downButton_clicked" ID="CompareDialog.on_downButton_clicked"></a> +<h4>CompareDialog.on_downButton_clicked</h4> +<b>on_downButton_clicked</b>(<i></i>) + +<p> + Private slot to go to the next difference. +</p> +<a NAME="CompareDialog.on_firstButton_clicked" ID="CompareDialog.on_firstButton_clicked"></a> +<h4>CompareDialog.on_firstButton_clicked</h4> +<b>on_firstButton_clicked</b>(<i></i>) + +<p> + Private slot to go to the first difference. +</p> +<a NAME="CompareDialog.on_lastButton_clicked" ID="CompareDialog.on_lastButton_clicked"></a> +<h4>CompareDialog.on_lastButton_clicked</h4> +<b>on_lastButton_clicked</b>(<i></i>) + +<p> + Private slot to go to the last difference. +</p> +<a NAME="CompareDialog.on_synchronizeCheckBox_toggled" ID="CompareDialog.on_synchronizeCheckBox_toggled"></a> +<h4>CompareDialog.on_synchronizeCheckBox_toggled</h4> +<b>on_synchronizeCheckBox_toggled</b>(<i>sync</i>) + +<p> + Private slot to connect or disconnect the scrollbars of the displays. +</p> +<dl> + +<dt><i>sync</i></dt> +<dd> +flag indicating synchronisation status (boolean) +</dd> +</dl> +<a NAME="CompareDialog.on_upButton_clicked" ID="CompareDialog.on_upButton_clicked"></a> +<h4>CompareDialog.on_upButton_clicked</h4> +<b>on_upButton_clicked</b>(<i></i>) + +<p> + Private slot to go to the previous difference. +</p> +<a NAME="CompareDialog.show" ID="CompareDialog.show"></a> +<h4>CompareDialog.show</h4> +<b>show</b>(<i>filename=None</i>) + +<p> + Public slot to show the dialog. +</p> +<dl> + +<dt><i>filename</i></dt> +<dd> +name of a file to use as the first file (string) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="CompareWindow" ID="CompareWindow"></a> +<h2>CompareWindow</h2> + +<p> + Main window class for the standalone dialog. +</p> +<h3>Derived from</h3> +EricMainWindow +<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="#CompareWindow.__init__">CompareWindow</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#CompareWindow.eventFilter">eventFilter</a></td> +<td>Public method to filter events.</td> +</tr> +</table> +<h3>Static Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> + +<a NAME="CompareWindow.__init__" ID="CompareWindow.__init__"></a> +<h4>CompareWindow (Constructor)</h4> +<b>CompareWindow</b>(<i>files=None, parent=None</i>) + +<p> + Constructor +</p> +<dl> + +<dt><i>files</i></dt> +<dd> +list of files to compare and their label + (list of two tuples of two strings) +</dd> +<dt><i>parent</i></dt> +<dd> +reference to the parent widget (QWidget) +</dd> +</dl> +<a NAME="CompareWindow.eventFilter" ID="CompareWindow.eventFilter"></a> +<h4>CompareWindow.eventFilter</h4> +<b>eventFilter</b>(<i>obj, event</i>) + +<p> + Public method to filter events. +</p> +<dl> + +<dt><i>obj</i></dt> +<dd> +reference to the object the event is meant for (QObject) +</dd> +<dt><i>event</i></dt> +<dd> +reference to the event object (QEvent) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating, whether the event was handled (boolean) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="removeMarkers" ID="removeMarkers"></a> +<h2>removeMarkers</h2> +<b>removeMarkers</b>(<i>line</i>) + +<p> + Internal function to remove all diff markers. +</p> +<dl> + +<dt><i>line</i></dt> +<dd> +line to work on (string) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +line without diff markers (string) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="sbsdiff" ID="sbsdiff"></a> +<h2>sbsdiff</h2> +<b>sbsdiff</b>(<i>a, b, linenumberwidth=4</i>) + +<p> + Compare two sequences of lines; generate the delta for display side by + side. +</p> +<dl> + +<dt><i>a</i></dt> +<dd> +first sequence of lines (list of strings) +</dd> +<dt><i>b</i></dt> +<dd> +second sequence of lines (list of strings) +</dd> +<dt><i>linenumberwidth</i></dt> +<dd> +width (in characters) of the linenumbers (integer) +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +tuples of differences. Each tuple is composed of strings as follows. + <ul> + <li>opcode -- one of e, d, i, r for equal, delete, insert, + replace</li> + <li>lineno a -- linenumber of sequence a</li> + <li>line a -- line of sequence a</li> + <li>lineno b -- linenumber of sequence b</li> + <li>line b -- line of sequence b</li> + </ul> +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +tuple of (str, str, str, str, str) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html> \ No newline at end of file