|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.UI.DiffDialog</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.UI.DiffDialog</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a dialog to compare two files. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#DiffDialog">DiffDialog</a></td> |
|
25 <td>Class implementing a dialog to compare two files.</td> |
|
26 </tr> |
|
27 <tr> |
|
28 <td><a href="#DiffWindow">DiffWindow</a></td> |
|
29 <td>Main window class for the standalone dialog.</td> |
|
30 </tr> |
|
31 </table> |
|
32 <h3>Functions</h3> |
|
33 |
|
34 <table> |
|
35 <tr><td>None</td></tr> |
|
36 </table> |
|
37 <hr /> |
|
38 <hr /> |
|
39 <a NAME="DiffDialog" ID="DiffDialog"></a> |
|
40 <h2>DiffDialog</h2> |
|
41 |
|
42 <p> |
|
43 Class implementing a dialog to compare two files. |
|
44 </p> |
|
45 <h3>Derived from</h3> |
|
46 QWidget, Ui_DiffDialog |
|
47 <h3>Class Attributes</h3> |
|
48 |
|
49 <table> |
|
50 <tr><td>None</td></tr> |
|
51 </table> |
|
52 <h3>Class Methods</h3> |
|
53 |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 |
|
59 <table> |
|
60 |
|
61 <tr> |
|
62 <td><a href="#DiffDialog.__init__">DiffDialog</a></td> |
|
63 <td>Constructor</td> |
|
64 </tr> |
|
65 <tr> |
|
66 <td><a href="#DiffDialog.__appendText">__appendText</a></td> |
|
67 <td>Private method to append text to the end of the contents pane.</td> |
|
68 </tr> |
|
69 <tr> |
|
70 <td><a href="#DiffDialog.__fileChanged">__fileChanged</a></td> |
|
71 <td>Private slot to enable/disable the Compare button.</td> |
|
72 </tr> |
|
73 <tr> |
|
74 <td><a href="#DiffDialog.__generateContextDiff">__generateContextDiff</a></td> |
|
75 <td>Private slot to generate a context diff output.</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#DiffDialog.__generateUnifiedDiff">__generateUnifiedDiff</a></td> |
|
79 <td>Private slot to generate a unified diff output.</td> |
|
80 </tr> |
|
81 <tr> |
|
82 <td><a href="#DiffDialog.on_buttonBox_clicked">on_buttonBox_clicked</a></td> |
|
83 <td>Private slot called by a button of the button box clicked.</td> |
|
84 </tr> |
|
85 <tr> |
|
86 <td><a href="#DiffDialog.on_diffButton_clicked">on_diffButton_clicked</a></td> |
|
87 <td>Private slot to handle the Compare button press.</td> |
|
88 </tr> |
|
89 <tr> |
|
90 <td><a href="#DiffDialog.on_saveButton_clicked">on_saveButton_clicked</a></td> |
|
91 <td>Private slot to handle the Save button press.</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#DiffDialog.show">show</a></td> |
|
95 <td>Public slot to show the dialog.</td> |
|
96 </tr> |
|
97 </table> |
|
98 <h3>Static Methods</h3> |
|
99 |
|
100 <table> |
|
101 <tr><td>None</td></tr> |
|
102 </table> |
|
103 |
|
104 <a NAME="DiffDialog.__init__" ID="DiffDialog.__init__"></a> |
|
105 <h4>DiffDialog (Constructor)</h4> |
|
106 <b>DiffDialog</b>(<i>parent=None</i>) |
|
107 |
|
108 <p> |
|
109 Constructor |
|
110 </p> |
|
111 <dl> |
|
112 |
|
113 <dt><i>parent</i></dt> |
|
114 <dd> |
|
115 reference to the parent widget (QWidget) |
|
116 </dd> |
|
117 </dl> |
|
118 <a NAME="DiffDialog.__appendText" ID="DiffDialog.__appendText"></a> |
|
119 <h4>DiffDialog.__appendText</h4> |
|
120 <b>__appendText</b>(<i>txt</i>) |
|
121 |
|
122 <p> |
|
123 Private method to append text to the end of the contents pane. |
|
124 </p> |
|
125 <dl> |
|
126 |
|
127 <dt><i>txt</i></dt> |
|
128 <dd> |
|
129 text to insert (string) |
|
130 </dd> |
|
131 </dl> |
|
132 <a NAME="DiffDialog.__fileChanged" ID="DiffDialog.__fileChanged"></a> |
|
133 <h4>DiffDialog.__fileChanged</h4> |
|
134 <b>__fileChanged</b>(<i></i>) |
|
135 |
|
136 <p> |
|
137 Private slot to enable/disable the Compare button. |
|
138 </p> |
|
139 <a NAME="DiffDialog.__generateContextDiff" ID="DiffDialog.__generateContextDiff"></a> |
|
140 <h4>DiffDialog.__generateContextDiff</h4> |
|
141 <b>__generateContextDiff</b>(<i>a, b, fromfile, tofile, fromfiledate, tofiledate</i>) |
|
142 |
|
143 <p> |
|
144 Private slot to generate a context diff output. |
|
145 </p> |
|
146 <dl> |
|
147 |
|
148 <dt><i>a</i></dt> |
|
149 <dd> |
|
150 first sequence of lines (list of strings) |
|
151 </dd> |
|
152 <dt><i>b</i></dt> |
|
153 <dd> |
|
154 second sequence of lines (list of strings) |
|
155 </dd> |
|
156 <dt><i>fromfile</i></dt> |
|
157 <dd> |
|
158 filename of the first file (string) |
|
159 </dd> |
|
160 <dt><i>tofile</i></dt> |
|
161 <dd> |
|
162 filename of the second file (string) |
|
163 </dd> |
|
164 <dt><i>fromfiledate</i></dt> |
|
165 <dd> |
|
166 modification time of the first file (string) |
|
167 </dd> |
|
168 <dt><i>tofiledate</i></dt> |
|
169 <dd> |
|
170 modification time of the second file (string) |
|
171 </dd> |
|
172 </dl> |
|
173 <a NAME="DiffDialog.__generateUnifiedDiff" ID="DiffDialog.__generateUnifiedDiff"></a> |
|
174 <h4>DiffDialog.__generateUnifiedDiff</h4> |
|
175 <b>__generateUnifiedDiff</b>(<i>a, b, fromfile, tofile, fromfiledate, tofiledate</i>) |
|
176 |
|
177 <p> |
|
178 Private slot to generate a unified diff output. |
|
179 </p> |
|
180 <dl> |
|
181 |
|
182 <dt><i>a</i></dt> |
|
183 <dd> |
|
184 first sequence of lines (list of strings) |
|
185 </dd> |
|
186 <dt><i>b</i></dt> |
|
187 <dd> |
|
188 second sequence of lines (list of strings) |
|
189 </dd> |
|
190 <dt><i>fromfile</i></dt> |
|
191 <dd> |
|
192 filename of the first file (string) |
|
193 </dd> |
|
194 <dt><i>tofile</i></dt> |
|
195 <dd> |
|
196 filename of the second file (string) |
|
197 </dd> |
|
198 <dt><i>fromfiledate</i></dt> |
|
199 <dd> |
|
200 modification time of the first file (string) |
|
201 </dd> |
|
202 <dt><i>tofiledate</i></dt> |
|
203 <dd> |
|
204 modification time of the second file (string) |
|
205 </dd> |
|
206 </dl> |
|
207 <a NAME="DiffDialog.on_buttonBox_clicked" ID="DiffDialog.on_buttonBox_clicked"></a> |
|
208 <h4>DiffDialog.on_buttonBox_clicked</h4> |
|
209 <b>on_buttonBox_clicked</b>(<i>button</i>) |
|
210 |
|
211 <p> |
|
212 Private slot called by a button of the button box clicked. |
|
213 </p> |
|
214 <dl> |
|
215 |
|
216 <dt><i>button</i></dt> |
|
217 <dd> |
|
218 button that was clicked (QAbstractButton) |
|
219 </dd> |
|
220 </dl> |
|
221 <a NAME="DiffDialog.on_diffButton_clicked" ID="DiffDialog.on_diffButton_clicked"></a> |
|
222 <h4>DiffDialog.on_diffButton_clicked</h4> |
|
223 <b>on_diffButton_clicked</b>(<i></i>) |
|
224 |
|
225 <p> |
|
226 Private slot to handle the Compare button press. |
|
227 </p> |
|
228 <a NAME="DiffDialog.on_saveButton_clicked" ID="DiffDialog.on_saveButton_clicked"></a> |
|
229 <h4>DiffDialog.on_saveButton_clicked</h4> |
|
230 <b>on_saveButton_clicked</b>(<i></i>) |
|
231 |
|
232 <p> |
|
233 Private slot to handle the Save button press. |
|
234 </p> |
|
235 <p> |
|
236 It saves the diff shown in the dialog to a file in the local |
|
237 filesystem. |
|
238 </p> |
|
239 <a NAME="DiffDialog.show" ID="DiffDialog.show"></a> |
|
240 <h4>DiffDialog.show</h4> |
|
241 <b>show</b>(<i>filename=None</i>) |
|
242 |
|
243 <p> |
|
244 Public slot to show the dialog. |
|
245 </p> |
|
246 <dl> |
|
247 |
|
248 <dt><i>filename</i></dt> |
|
249 <dd> |
|
250 name of a file to use as the first file (string) |
|
251 </dd> |
|
252 </dl> |
|
253 <div align="right"><a href="#top">Up</a></div> |
|
254 <hr /> |
|
255 <hr /> |
|
256 <a NAME="DiffWindow" ID="DiffWindow"></a> |
|
257 <h2>DiffWindow</h2> |
|
258 |
|
259 <p> |
|
260 Main window class for the standalone dialog. |
|
261 </p> |
|
262 <h3>Derived from</h3> |
|
263 EricMainWindow |
|
264 <h3>Class Attributes</h3> |
|
265 |
|
266 <table> |
|
267 <tr><td>None</td></tr> |
|
268 </table> |
|
269 <h3>Class Methods</h3> |
|
270 |
|
271 <table> |
|
272 <tr><td>None</td></tr> |
|
273 </table> |
|
274 <h3>Methods</h3> |
|
275 |
|
276 <table> |
|
277 |
|
278 <tr> |
|
279 <td><a href="#DiffWindow.__init__">DiffWindow</a></td> |
|
280 <td>Constructor</td> |
|
281 </tr> |
|
282 <tr> |
|
283 <td><a href="#DiffWindow.eventFilter">eventFilter</a></td> |
|
284 <td>Public method to filter events.</td> |
|
285 </tr> |
|
286 </table> |
|
287 <h3>Static Methods</h3> |
|
288 |
|
289 <table> |
|
290 <tr><td>None</td></tr> |
|
291 </table> |
|
292 |
|
293 <a NAME="DiffWindow.__init__" ID="DiffWindow.__init__"></a> |
|
294 <h4>DiffWindow (Constructor)</h4> |
|
295 <b>DiffWindow</b>(<i>parent=None</i>) |
|
296 |
|
297 <p> |
|
298 Constructor |
|
299 </p> |
|
300 <dl> |
|
301 |
|
302 <dt><i>parent</i></dt> |
|
303 <dd> |
|
304 reference to the parent widget (QWidget) |
|
305 </dd> |
|
306 </dl> |
|
307 <a NAME="DiffWindow.eventFilter" ID="DiffWindow.eventFilter"></a> |
|
308 <h4>DiffWindow.eventFilter</h4> |
|
309 <b>eventFilter</b>(<i>obj, event</i>) |
|
310 |
|
311 <p> |
|
312 Public method to filter events. |
|
313 </p> |
|
314 <dl> |
|
315 |
|
316 <dt><i>obj</i></dt> |
|
317 <dd> |
|
318 reference to the object the event is meant for (QObject) |
|
319 </dd> |
|
320 <dt><i>event</i></dt> |
|
321 <dd> |
|
322 reference to the event object (QEvent) |
|
323 </dd> |
|
324 </dl> |
|
325 <dl> |
|
326 <dt>Return:</dt> |
|
327 <dd> |
|
328 flag indicating, whether the event was handled (boolean) |
|
329 </dd> |
|
330 </dl> |
|
331 <div align="right"><a href="#top">Up</a></div> |
|
332 <hr /> |
|
333 </body></html> |