eric6/Documentation/Source/eric6.UI.CompareDialog.html

branch
maintenance
changeset 6989
8b8cadf8d7e9
parent 6942
2602857055c5
child 7273
391d6b7b1eff
equal deleted inserted replaced
6938:7926553b7509 6989:8b8cadf8d7e9
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.UI.CompareDialog</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.UI.CompareDialog</h1>
23 <p>
24 Module implementing a dialog to compare two files and show the result side by
25 side.
26 </p>
27 <h3>Global Attributes</h3>
28 <table>
29 <tr><td>None</td></tr>
30 </table>
31 <h3>Classes</h3>
32 <table>
33 <tr>
34 <td><a href="#CompareDialog">CompareDialog</a></td>
35 <td>Class implementing a dialog to compare two files and show the result side by side.</td>
36 </tr><tr>
37 <td><a href="#CompareWindow">CompareWindow</a></td>
38 <td>Main window class for the standalone dialog.</td>
39 </tr>
40 </table>
41 <h3>Functions</h3>
42 <table>
43 <tr>
44 <td><a href="#removeMarkers">removeMarkers</a></td>
45 <td>Internal function to remove all diff markers.</td>
46 </tr><tr>
47 <td><a href="#sbsdiff">sbsdiff</a></td>
48 <td>Compare two sequences of lines; generate the delta for display side by side.</td>
49 </tr>
50 </table>
51 <hr /><hr />
52 <a NAME="CompareDialog" ID="CompareDialog"></a>
53 <h2>CompareDialog</h2>
54 <p>
55 Class implementing a dialog to compare two files and show the result side
56 by side.
57 </p>
58 <h3>Derived from</h3>
59 QWidget, Ui_CompareDialog
60 <h3>Class Attributes</h3>
61 <table>
62 <tr><td>None</td></tr>
63 </table>
64 <h3>Class Methods</h3>
65 <table>
66 <tr><td>None</td></tr>
67 </table>
68 <h3>Methods</h3>
69 <table>
70 <tr>
71 <td><a href="#CompareDialog.__init__">CompareDialog</a></td>
72 <td>Constructor</td>
73 </tr><tr>
74 <td><a href="#CompareDialog.__appendText">__appendText</a></td>
75 <td>Private method to append text to the end of the contents pane.</td>
76 </tr><tr>
77 <td><a href="#CompareDialog.__compare">__compare</a></td>
78 <td>Private method to compare two lists of text.</td>
79 </tr><tr>
80 <td><a href="#CompareDialog.__fileChanged">__fileChanged</a></td>
81 <td>Private slot to enable/disable the Compare button.</td>
82 </tr><tr>
83 <td><a href="#CompareDialog.__generateFormats">__generateFormats</a></td>
84 <td>Private method to generate the various text formats.</td>
85 </tr><tr>
86 <td><a href="#CompareDialog.__moveTextToCurrentDiffPos">__moveTextToCurrentDiffPos</a></td>
87 <td>Private slot to move the text display to the current diff position.</td>
88 </tr><tr>
89 <td><a href="#CompareDialog.__scrollBarMoved">__scrollBarMoved</a></td>
90 <td>Private slot to enable the buttons and set the current diff position depending on scrollbar position.</td>
91 </tr><tr>
92 <td><a href="#CompareDialog.compare">compare</a></td>
93 <td>Public method to compare two lists of text.</td>
94 </tr><tr>
95 <td><a href="#CompareDialog.on_buttonBox_clicked">on_buttonBox_clicked</a></td>
96 <td>Private slot called by a button of the button box clicked.</td>
97 </tr><tr>
98 <td><a href="#CompareDialog.on_diffButton_clicked">on_diffButton_clicked</a></td>
99 <td>Private slot to handle the Compare button press.</td>
100 </tr><tr>
101 <td><a href="#CompareDialog.on_downButton_clicked">on_downButton_clicked</a></td>
102 <td>Private slot to go to the next difference.</td>
103 </tr><tr>
104 <td><a href="#CompareDialog.on_firstButton_clicked">on_firstButton_clicked</a></td>
105 <td>Private slot to go to the first difference.</td>
106 </tr><tr>
107 <td><a href="#CompareDialog.on_lastButton_clicked">on_lastButton_clicked</a></td>
108 <td>Private slot to go to the last difference.</td>
109 </tr><tr>
110 <td><a href="#CompareDialog.on_synchronizeCheckBox_toggled">on_synchronizeCheckBox_toggled</a></td>
111 <td>Private slot to connect or disconnect the scrollbars of the displays.</td>
112 </tr><tr>
113 <td><a href="#CompareDialog.on_upButton_clicked">on_upButton_clicked</a></td>
114 <td>Private slot to go to the previous difference.</td>
115 </tr><tr>
116 <td><a href="#CompareDialog.show">show</a></td>
117 <td>Public slot to show the dialog.</td>
118 </tr>
119 </table>
120 <h3>Static Methods</h3>
121 <table>
122 <tr><td>None</td></tr>
123 </table>
124 <a NAME="CompareDialog.__init__" ID="CompareDialog.__init__"></a>
125 <h4>CompareDialog (Constructor)</h4>
126 <b>CompareDialog</b>(<i>files=None, parent=None</i>)
127 <p>
128 Constructor
129 </p><dl>
130 <dt><i>files</i></dt>
131 <dd>
132 list of files to compare and their label
133 (list of two tuples of two strings)
134 </dd><dt><i>parent</i></dt>
135 <dd>
136 parent widget (QWidget)
137 </dd>
138 </dl><a NAME="CompareDialog.__appendText" ID="CompareDialog.__appendText"></a>
139 <h4>CompareDialog.__appendText</h4>
140 <b>__appendText</b>(<i>pane, linenumber, line, charFormat, interLine=False</i>)
141 <p>
142 Private method to append text to the end of the contents pane.
143 </p><dl>
144 <dt><i>pane</i></dt>
145 <dd>
146 text edit widget to append text to (QTextedit)
147 </dd><dt><i>linenumber</i></dt>
148 <dd>
149 number of line to insert (string)
150 </dd><dt><i>line</i></dt>
151 <dd>
152 text to insert (string)
153 </dd><dt><i>charFormat</i></dt>
154 <dd>
155 text format to be used (QTextCharFormat)
156 </dd><dt><i>interLine</i></dt>
157 <dd>
158 flag indicating interline changes (boolean)
159 </dd>
160 </dl><a NAME="CompareDialog.__compare" ID="CompareDialog.__compare"></a>
161 <h4>CompareDialog.__compare</h4>
162 <b>__compare</b>(<i>lines1, lines2</i>)
163 <p>
164 Private method to compare two lists of text.
165 </p><dl>
166 <dt><i>lines1</i></dt>
167 <dd>
168 text to compare against (list of strings)
169 </dd><dt><i>lines2</i></dt>
170 <dd>
171 text to compare (list of strings)
172 </dd>
173 </dl><a NAME="CompareDialog.__fileChanged" ID="CompareDialog.__fileChanged"></a>
174 <h4>CompareDialog.__fileChanged</h4>
175 <b>__fileChanged</b>(<i></i>)
176 <p>
177 Private slot to enable/disable the Compare button.
178 </p><a NAME="CompareDialog.__generateFormats" ID="CompareDialog.__generateFormats"></a>
179 <h4>CompareDialog.__generateFormats</h4>
180 <b>__generateFormats</b>(<i></i>)
181 <p>
182 Private method to generate the various text formats.
183 </p><a NAME="CompareDialog.__moveTextToCurrentDiffPos" ID="CompareDialog.__moveTextToCurrentDiffPos"></a>
184 <h4>CompareDialog.__moveTextToCurrentDiffPos</h4>
185 <b>__moveTextToCurrentDiffPos</b>(<i></i>)
186 <p>
187 Private slot to move the text display to the current diff position.
188 </p><a NAME="CompareDialog.__scrollBarMoved" ID="CompareDialog.__scrollBarMoved"></a>
189 <h4>CompareDialog.__scrollBarMoved</h4>
190 <b>__scrollBarMoved</b>(<i>value</i>)
191 <p>
192 Private slot to enable the buttons and set the current diff position
193 depending on scrollbar position.
194 </p><dl>
195 <dt><i>value</i></dt>
196 <dd>
197 scrollbar position (integer)
198 </dd>
199 </dl><a NAME="CompareDialog.compare" ID="CompareDialog.compare"></a>
200 <h4>CompareDialog.compare</h4>
201 <b>compare</b>(<i>lines1, lines2, name1="", name2=""</i>)
202 <p>
203 Public method to compare two lists of text.
204 </p><dl>
205 <dt><i>lines1</i></dt>
206 <dd>
207 text to compare against (string or list of strings)
208 </dd><dt><i>lines2</i></dt>
209 <dd>
210 text to compare (string or list of strings)
211 </dd><dt><i>name1=</i></dt>
212 <dd>
213 name to be shown for the first text (string)
214 </dd><dt><i>name2=</i></dt>
215 <dd>
216 name to be shown for the second text (string)
217 </dd>
218 </dl><a NAME="CompareDialog.on_buttonBox_clicked" ID="CompareDialog.on_buttonBox_clicked"></a>
219 <h4>CompareDialog.on_buttonBox_clicked</h4>
220 <b>on_buttonBox_clicked</b>(<i>button</i>)
221 <p>
222 Private slot called by a button of the button box clicked.
223 </p><dl>
224 <dt><i>button</i></dt>
225 <dd>
226 button that was clicked (QAbstractButton)
227 </dd>
228 </dl><a NAME="CompareDialog.on_diffButton_clicked" ID="CompareDialog.on_diffButton_clicked"></a>
229 <h4>CompareDialog.on_diffButton_clicked</h4>
230 <b>on_diffButton_clicked</b>(<i></i>)
231 <p>
232 Private slot to handle the Compare button press.
233 </p><a NAME="CompareDialog.on_downButton_clicked" ID="CompareDialog.on_downButton_clicked"></a>
234 <h4>CompareDialog.on_downButton_clicked</h4>
235 <b>on_downButton_clicked</b>(<i></i>)
236 <p>
237 Private slot to go to the next difference.
238 </p><a NAME="CompareDialog.on_firstButton_clicked" ID="CompareDialog.on_firstButton_clicked"></a>
239 <h4>CompareDialog.on_firstButton_clicked</h4>
240 <b>on_firstButton_clicked</b>(<i></i>)
241 <p>
242 Private slot to go to the first difference.
243 </p><a NAME="CompareDialog.on_lastButton_clicked" ID="CompareDialog.on_lastButton_clicked"></a>
244 <h4>CompareDialog.on_lastButton_clicked</h4>
245 <b>on_lastButton_clicked</b>(<i></i>)
246 <p>
247 Private slot to go to the last difference.
248 </p><a NAME="CompareDialog.on_synchronizeCheckBox_toggled" ID="CompareDialog.on_synchronizeCheckBox_toggled"></a>
249 <h4>CompareDialog.on_synchronizeCheckBox_toggled</h4>
250 <b>on_synchronizeCheckBox_toggled</b>(<i>sync</i>)
251 <p>
252 Private slot to connect or disconnect the scrollbars of the displays.
253 </p><dl>
254 <dt><i>sync</i></dt>
255 <dd>
256 flag indicating synchronisation status (boolean)
257 </dd>
258 </dl><a NAME="CompareDialog.on_upButton_clicked" ID="CompareDialog.on_upButton_clicked"></a>
259 <h4>CompareDialog.on_upButton_clicked</h4>
260 <b>on_upButton_clicked</b>(<i></i>)
261 <p>
262 Private slot to go to the previous difference.
263 </p><a NAME="CompareDialog.show" ID="CompareDialog.show"></a>
264 <h4>CompareDialog.show</h4>
265 <b>show</b>(<i>filename=None</i>)
266 <p>
267 Public slot to show the dialog.
268 </p><dl>
269 <dt><i>filename</i></dt>
270 <dd>
271 name of a file to use as the first file (string)
272 </dd>
273 </dl>
274 <div align="right"><a href="#top">Up</a></div>
275 <hr /><hr />
276 <a NAME="CompareWindow" ID="CompareWindow"></a>
277 <h2>CompareWindow</h2>
278 <p>
279 Main window class for the standalone dialog.
280 </p>
281 <h3>Derived from</h3>
282 E5MainWindow
283 <h3>Class Attributes</h3>
284 <table>
285 <tr><td>None</td></tr>
286 </table>
287 <h3>Class Methods</h3>
288 <table>
289 <tr><td>None</td></tr>
290 </table>
291 <h3>Methods</h3>
292 <table>
293 <tr>
294 <td><a href="#CompareWindow.__init__">CompareWindow</a></td>
295 <td>Constructor</td>
296 </tr><tr>
297 <td><a href="#CompareWindow.eventFilter">eventFilter</a></td>
298 <td>Public method to filter events.</td>
299 </tr>
300 </table>
301 <h3>Static Methods</h3>
302 <table>
303 <tr><td>None</td></tr>
304 </table>
305 <a NAME="CompareWindow.__init__" ID="CompareWindow.__init__"></a>
306 <h4>CompareWindow (Constructor)</h4>
307 <b>CompareWindow</b>(<i>files=None, parent=None</i>)
308 <p>
309 Constructor
310 </p><dl>
311 <dt><i>files</i></dt>
312 <dd>
313 list of files to compare and their label
314 (list of two tuples of two strings)
315 </dd><dt><i>parent</i></dt>
316 <dd>
317 reference to the parent widget (QWidget)
318 </dd>
319 </dl><a NAME="CompareWindow.eventFilter" ID="CompareWindow.eventFilter"></a>
320 <h4>CompareWindow.eventFilter</h4>
321 <b>eventFilter</b>(<i>obj, event</i>)
322 <p>
323 Public method to filter events.
324 </p><dl>
325 <dt><i>obj</i></dt>
326 <dd>
327 reference to the object the event is meant for (QObject)
328 </dd><dt><i>event</i></dt>
329 <dd>
330 reference to the event object (QEvent)
331 </dd>
332 </dl><dl>
333 <dt>Returns:</dt>
334 <dd>
335 flag indicating, whether the event was handled (boolean)
336 </dd>
337 </dl>
338 <div align="right"><a href="#top">Up</a></div>
339 <hr /><hr />
340 <a NAME="removeMarkers" ID="removeMarkers"></a>
341 <h2>removeMarkers</h2>
342 <b>removeMarkers</b>(<i>line</i>)
343 <p>
344 Internal function to remove all diff markers.
345 </p><dl>
346 <dt><i>line</i></dt>
347 <dd>
348 line to work on (string)
349 </dd>
350 </dl><dl>
351 <dt>Returns:</dt>
352 <dd>
353 line without diff markers (string)
354 </dd>
355 </dl>
356 <div align="right"><a href="#top">Up</a></div>
357 <hr /><hr />
358 <a NAME="sbsdiff" ID="sbsdiff"></a>
359 <h2>sbsdiff</h2>
360 <b>sbsdiff</b>(<i>a, b, linenumberwidth=4</i>)
361 <p>
362 Compare two sequences of lines; generate the delta for display side by
363 side.
364 </p><dl>
365 <dt><i>a</i></dt>
366 <dd>
367 first sequence of lines (list of strings)
368 </dd><dt><i>b</i></dt>
369 <dd>
370 second sequence of lines (list of strings)
371 </dd><dt><i>linenumberwidth</i></dt>
372 <dd>
373 width (in characters) of the linenumbers (integer)
374 </dd>
375 </dl><dl>
376 <dt>Returns:</dt>
377 <dd>
378 a generator yielding tuples of differences. The tuple is composed
379 of strings as follows.
380 <ul>
381 <li>opcode -- one of e, d, i, r for equal, delete, insert,
382 replace</li>
383 <li>lineno a -- linenumber of sequence a</li>
384 <li>line a -- line of sequence a</li>
385 <li>lineno b -- linenumber of sequence b</li>
386 <li>line b -- line of sequence b</li>
387 </ul>
388 </dd>
389 </dl>
390 <div align="right"><a href="#top">Up</a></div>
391 <hr />
392 </body></html>

eric ide

mercurial