|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric4.UI.CompareDialog</title> |
|
6 <style> |
|
7 body { |
|
8 background:white; |
|
9 margin: 0em 1em 10em 1em; |
|
10 color: black; |
|
11 } |
|
12 |
|
13 h1 { color: white; background: #4FA4FF; } |
|
14 h2 { color: white; background: #4FA4FF; } |
|
15 h3 { color: white; background: #00557F; } |
|
16 h4 { color: white; background: #00557F; } |
|
17 |
|
18 a { color: #AA5500; } |
|
19 |
|
20 </style> |
|
21 </head> |
|
22 <body><a NAME="top" ID="top"></a> |
|
23 <h1>eric4.UI.CompareDialog</h1> |
|
24 <p> |
|
25 Module implementing a dialog to compare two files and show the result side by 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 by side. |
|
56 </p> |
|
57 <h3>Derived from</h3> |
|
58 QWidget, Ui_CompareDialog |
|
59 <h3>Class Attributes</h3> |
|
60 <table> |
|
61 <tr><td>None</td></tr> |
|
62 </table> |
|
63 <h3>Methods</h3> |
|
64 <table> |
|
65 <tr> |
|
66 <td><a href="#CompareDialog.__init__">CompareDialog</a></td> |
|
67 <td>Constructor</td> |
|
68 </tr><tr> |
|
69 <td><a href="#CompareDialog.__appendText">__appendText</a></td> |
|
70 <td>Private method to append text to the end of the contents pane.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#CompareDialog.__fileChanged">__fileChanged</a></td> |
|
73 <td>Private slot to enable/disable the Compare button.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#CompareDialog.__moveTextToCurrentDiffPos">__moveTextToCurrentDiffPos</a></td> |
|
76 <td>Private slot to move the text display to the current diff position.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#CompareDialog.__scrollBarMoved">__scrollBarMoved</a></td> |
|
79 <td>Private slot to enable the buttons and set the current diff position depending on scrollbar position.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#CompareDialog.__selectFile">__selectFile</a></td> |
|
82 <td>Private slot to display a file selection dialog.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#CompareDialog.on_buttonBox_clicked">on_buttonBox_clicked</a></td> |
|
85 <td>Private slot called by a button of the button box clicked.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#CompareDialog.on_diffButton_clicked">on_diffButton_clicked</a></td> |
|
88 <td>Private slot to handle the Compare button press.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#CompareDialog.on_downButton_clicked">on_downButton_clicked</a></td> |
|
91 <td>Private slot to go to the next difference.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#CompareDialog.on_file1Button_clicked">on_file1Button_clicked</a></td> |
|
94 <td>Private slot to handle the file 1 file selection button press.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#CompareDialog.on_file2Button_clicked">on_file2Button_clicked</a></td> |
|
97 <td>Private slot to handle the file 2 file selection button press.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#CompareDialog.on_firstButton_clicked">on_firstButton_clicked</a></td> |
|
100 <td>Private slot to go to the first difference.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#CompareDialog.on_lastButton_clicked">on_lastButton_clicked</a></td> |
|
103 <td>Private slot to go to the last difference.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#CompareDialog.on_synchronizeCheckBox_toggled">on_synchronizeCheckBox_toggled</a></td> |
|
106 <td>Private slot to connect or disconnect the scrollbars of the displays.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#CompareDialog.on_upButton_clicked">on_upButton_clicked</a></td> |
|
109 <td>Private slot to go to the previous difference.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#CompareDialog.show">show</a></td> |
|
112 <td>Public slot to show the dialog.</td> |
|
113 </tr> |
|
114 </table> |
|
115 <a NAME="CompareDialog.__init__" ID="CompareDialog.__init__"></a> |
|
116 <h4>CompareDialog (Constructor)</h4> |
|
117 <b>CompareDialog</b>(<i>files = [], parent = None</i>) |
|
118 <p> |
|
119 Constructor |
|
120 </p><dl> |
|
121 <dt><i>files</i></dt> |
|
122 <dd> |
|
123 list of files to compare and their label |
|
124 (list of two tuples of two strings) |
|
125 </dd><dt><i>parent</i></dt> |
|
126 <dd> |
|
127 parent widget (QWidget) |
|
128 </dd> |
|
129 </dl><a NAME="CompareDialog.__appendText" ID="CompareDialog.__appendText"></a> |
|
130 <h4>CompareDialog.__appendText</h4> |
|
131 <b>__appendText</b>(<i>pane, linenumber, line, format, interLine = False</i>) |
|
132 <p> |
|
133 Private method to append text to the end of the contents pane. |
|
134 </p><dl> |
|
135 <dt><i>pane</i></dt> |
|
136 <dd> |
|
137 text edit widget to append text to (QTextedit) |
|
138 </dd><dt><i>linenumber</i></dt> |
|
139 <dd> |
|
140 number of line to insert (string) |
|
141 </dd><dt><i>line</i></dt> |
|
142 <dd> |
|
143 text to insert (string) |
|
144 </dd><dt><i>format</i></dt> |
|
145 <dd> |
|
146 text format to be used (QTextCharFormat) |
|
147 </dd><dt><i>interLine</i></dt> |
|
148 <dd> |
|
149 flag indicating interline changes (boolean) |
|
150 </dd> |
|
151 </dl><a NAME="CompareDialog.__fileChanged" ID="CompareDialog.__fileChanged"></a> |
|
152 <h4>CompareDialog.__fileChanged</h4> |
|
153 <b>__fileChanged</b>(<i></i>) |
|
154 <p> |
|
155 Private slot to enable/disable the Compare button. |
|
156 </p><a NAME="CompareDialog.__moveTextToCurrentDiffPos" ID="CompareDialog.__moveTextToCurrentDiffPos"></a> |
|
157 <h4>CompareDialog.__moveTextToCurrentDiffPos</h4> |
|
158 <b>__moveTextToCurrentDiffPos</b>(<i></i>) |
|
159 <p> |
|
160 Private slot to move the text display to the current diff position. |
|
161 </p><a NAME="CompareDialog.__scrollBarMoved" ID="CompareDialog.__scrollBarMoved"></a> |
|
162 <h4>CompareDialog.__scrollBarMoved</h4> |
|
163 <b>__scrollBarMoved</b>(<i>value</i>) |
|
164 <p> |
|
165 Private slot to enable the buttons and set the current diff position |
|
166 depending on scrollbar position. |
|
167 </p><dl> |
|
168 <dt><i>value</i></dt> |
|
169 <dd> |
|
170 scrollbar position (integer) |
|
171 </dd> |
|
172 </dl><a NAME="CompareDialog.__selectFile" ID="CompareDialog.__selectFile"></a> |
|
173 <h4>CompareDialog.__selectFile</h4> |
|
174 <b>__selectFile</b>(<i>lineEdit</i>) |
|
175 <p> |
|
176 Private slot to display a file selection dialog. |
|
177 </p><dl> |
|
178 <dt><i>lineEdit</i></dt> |
|
179 <dd> |
|
180 field for the display of the selected filename |
|
181 (QLineEdit) |
|
182 </dd> |
|
183 </dl><a NAME="CompareDialog.on_buttonBox_clicked" ID="CompareDialog.on_buttonBox_clicked"></a> |
|
184 <h4>CompareDialog.on_buttonBox_clicked</h4> |
|
185 <b>on_buttonBox_clicked</b>(<i>button</i>) |
|
186 <p> |
|
187 Private slot called by a button of the button box clicked. |
|
188 </p><dl> |
|
189 <dt><i>button</i></dt> |
|
190 <dd> |
|
191 button that was clicked (QAbstractButton) |
|
192 </dd> |
|
193 </dl><a NAME="CompareDialog.on_diffButton_clicked" ID="CompareDialog.on_diffButton_clicked"></a> |
|
194 <h4>CompareDialog.on_diffButton_clicked</h4> |
|
195 <b>on_diffButton_clicked</b>(<i></i>) |
|
196 <p> |
|
197 Private slot to handle the Compare button press. |
|
198 </p><a NAME="CompareDialog.on_downButton_clicked" ID="CompareDialog.on_downButton_clicked"></a> |
|
199 <h4>CompareDialog.on_downButton_clicked</h4> |
|
200 <b>on_downButton_clicked</b>(<i></i>) |
|
201 <p> |
|
202 Private slot to go to the next difference. |
|
203 </p><a NAME="CompareDialog.on_file1Button_clicked" ID="CompareDialog.on_file1Button_clicked"></a> |
|
204 <h4>CompareDialog.on_file1Button_clicked</h4> |
|
205 <b>on_file1Button_clicked</b>(<i></i>) |
|
206 <p> |
|
207 Private slot to handle the file 1 file selection button press. |
|
208 </p><a NAME="CompareDialog.on_file2Button_clicked" ID="CompareDialog.on_file2Button_clicked"></a> |
|
209 <h4>CompareDialog.on_file2Button_clicked</h4> |
|
210 <b>on_file2Button_clicked</b>(<i></i>) |
|
211 <p> |
|
212 Private slot to handle the file 2 file selection button press. |
|
213 </p><a NAME="CompareDialog.on_firstButton_clicked" ID="CompareDialog.on_firstButton_clicked"></a> |
|
214 <h4>CompareDialog.on_firstButton_clicked</h4> |
|
215 <b>on_firstButton_clicked</b>(<i></i>) |
|
216 <p> |
|
217 Private slot to go to the first difference. |
|
218 </p><a NAME="CompareDialog.on_lastButton_clicked" ID="CompareDialog.on_lastButton_clicked"></a> |
|
219 <h4>CompareDialog.on_lastButton_clicked</h4> |
|
220 <b>on_lastButton_clicked</b>(<i></i>) |
|
221 <p> |
|
222 Private slot to go to the last difference. |
|
223 </p><a NAME="CompareDialog.on_synchronizeCheckBox_toggled" ID="CompareDialog.on_synchronizeCheckBox_toggled"></a> |
|
224 <h4>CompareDialog.on_synchronizeCheckBox_toggled</h4> |
|
225 <b>on_synchronizeCheckBox_toggled</b>(<i>sync</i>) |
|
226 <p> |
|
227 Private slot to connect or disconnect the scrollbars of the displays. |
|
228 </p><dl> |
|
229 <dt><i>sync</i></dt> |
|
230 <dd> |
|
231 flag indicating synchronisation status (boolean) |
|
232 </dd> |
|
233 </dl><a NAME="CompareDialog.on_upButton_clicked" ID="CompareDialog.on_upButton_clicked"></a> |
|
234 <h4>CompareDialog.on_upButton_clicked</h4> |
|
235 <b>on_upButton_clicked</b>(<i></i>) |
|
236 <p> |
|
237 Private slot to go to the previous difference. |
|
238 </p><a NAME="CompareDialog.show" ID="CompareDialog.show"></a> |
|
239 <h4>CompareDialog.show</h4> |
|
240 <b>show</b>(<i>filename = None</i>) |
|
241 <p> |
|
242 Public slot to show the dialog. |
|
243 </p><dl> |
|
244 <dt><i>filename</i></dt> |
|
245 <dd> |
|
246 name of a file to use as the first file (string) |
|
247 </dd> |
|
248 </dl> |
|
249 <div align="right"><a href="#top">Up</a></div> |
|
250 <hr /><hr /> |
|
251 <a NAME="CompareWindow" ID="CompareWindow"></a> |
|
252 <h2>CompareWindow</h2> |
|
253 <p> |
|
254 Main window class for the standalone dialog. |
|
255 </p> |
|
256 <h3>Derived from</h3> |
|
257 QMainWindow |
|
258 <h3>Class Attributes</h3> |
|
259 <table> |
|
260 <tr><td>None</td></tr> |
|
261 </table> |
|
262 <h3>Methods</h3> |
|
263 <table> |
|
264 <tr> |
|
265 <td><a href="#CompareWindow.__init__">CompareWindow</a></td> |
|
266 <td>Constructor</td> |
|
267 </tr><tr> |
|
268 <td><a href="#CompareWindow.eventFilter">eventFilter</a></td> |
|
269 <td>Public method to filter events.</td> |
|
270 </tr> |
|
271 </table> |
|
272 <a NAME="CompareWindow.__init__" ID="CompareWindow.__init__"></a> |
|
273 <h4>CompareWindow (Constructor)</h4> |
|
274 <b>CompareWindow</b>(<i>files = [], parent = None</i>) |
|
275 <p> |
|
276 Constructor |
|
277 </p><dl> |
|
278 <dt><i>files</i></dt> |
|
279 <dd> |
|
280 list of files to compare and their label |
|
281 (list of two tuples of two strings) |
|
282 </dd><dt><i>parent</i></dt> |
|
283 <dd> |
|
284 reference to the parent widget (QWidget) |
|
285 </dd> |
|
286 </dl><a NAME="CompareWindow.eventFilter" ID="CompareWindow.eventFilter"></a> |
|
287 <h4>CompareWindow.eventFilter</h4> |
|
288 <b>eventFilter</b>(<i>obj, event</i>) |
|
289 <p> |
|
290 Public method to filter events. |
|
291 </p><dl> |
|
292 <dt><i>obj</i></dt> |
|
293 <dd> |
|
294 reference to the object the event is meant for (QObject) |
|
295 </dd><dt><i>event</i></dt> |
|
296 <dd> |
|
297 reference to the event object (QEvent) |
|
298 </dd> |
|
299 </dl><dl> |
|
300 <dt>Returns:</dt> |
|
301 <dd> |
|
302 flag indicating, whether the event was handled (boolean) |
|
303 </dd> |
|
304 </dl> |
|
305 <div align="right"><a href="#top">Up</a></div> |
|
306 <hr /><hr /> |
|
307 <a NAME="removeMarkers" ID="removeMarkers"></a> |
|
308 <h2>removeMarkers</h2> |
|
309 <b>removeMarkers</b>(<i>line</i>) |
|
310 <p> |
|
311 Internal function to remove all diff markers. |
|
312 </p><dl> |
|
313 <dt><i>line</i></dt> |
|
314 <dd> |
|
315 line to work on (string) |
|
316 </dd> |
|
317 </dl><dl> |
|
318 <dt>Returns:</dt> |
|
319 <dd> |
|
320 line without diff markers (string) |
|
321 </dd> |
|
322 </dl> |
|
323 <div align="right"><a href="#top">Up</a></div> |
|
324 <hr /><hr /> |
|
325 <a NAME="sbsdiff" ID="sbsdiff"></a> |
|
326 <h2>sbsdiff</h2> |
|
327 <b>sbsdiff</b>(<i>a, b, linenumberwidth = 4</i>) |
|
328 <p> |
|
329 Compare two sequences of lines; generate the delta for display side by side. |
|
330 </p><dl> |
|
331 <dt><i>a</i></dt> |
|
332 <dd> |
|
333 first sequence of lines (list of strings) |
|
334 </dd><dt><i>b</i></dt> |
|
335 <dd> |
|
336 second sequence of lines (list of strings) |
|
337 </dd><dt><i>linenumberwidth</i></dt> |
|
338 <dd> |
|
339 width (in characters) of the linenumbers (integer) |
|
340 </dd> |
|
341 </dl><dl> |
|
342 <dt>Returns:</dt> |
|
343 <dd> |
|
344 a generator yielding tuples of differences. The tuple is composed |
|
345 of strings as follows. |
|
346 <ul> |
|
347 <li>opcode -- one of e, d, i, r for equal, delete, insert, replace</li> |
|
348 <li>lineno a -- linenumber of sequence a</li> |
|
349 <li>line a -- line of sequence a</li> |
|
350 <li>lineno b -- linenumber of sequence b</li> |
|
351 <li>line b -- line of sequence b</li> |
|
352 </ul> |
|
353 </dd> |
|
354 </dl> |
|
355 <div align="right"><a href="#top">Up</a></div> |
|
356 <hr /> |
|
357 </body></html> |