# eric3.UI.CompareDialog

Module implementing a dialog to compare two files and show the result side by side.

### Classes

CompareDialog | Class implementing a dialog to compare two files and show the result side by side.

### Functions

sbsdiff | Compare two sequences of lines; generate the delta for display side by side.

## CompareDialog

Class implementing a dialog to compare two files and show the result side by side.

### Derived from

CompareForm

### Methods

CompareDialog | Constructor
handleDiff | Private slot to handle the Compare button press.
handleFileChanged | Private slot to enable/disable the Compare button.
handleSelectFile | Private slot to display a file selection dialog.
handleSelectFile1 | Private slot to handle the file 1 file selection button press.
handleSelectFile2 | Private slot to handle the file 2 file selection button press.
handleSync | Private slot to connect or disconnect the scrollbars of the displays.

### CompareDialog (Constructor)

CompareDialog(parent = None)

Constructor

### CompareDialog.handleDiff

handleDiff()

Private slot to handle the Compare button press.

### CompareDialog.handleFileChanged

handleFileChanged()

Private slot to enable/disable the Compare button.

### CompareDialog.handleSelectFile

handleSelectFile(lineEdit)

Private slot to display a file selection dialog.

lineEdit
  field for the display of the selected filename (QLineEdit)

### CompareDialog.handleSelectFile1

handleSelectFile1()

Private slot to handle the file 1 file selection button press.

### CompareDialog.handleSelectFile2

handleSelectFile2()

Private slot to handle the file 2 file selection button press.

### CompareDialog.handleSync

handleSync(sync)

Private slot to connect or disconnect the scrollbars of the displays.

sync
  flag indicating synchronisation status (boolean)

Up

## sbsdiff

sbsdiff(a, b, linenumberwidth = 4)

Compare two sequences of lines; generate the delta for display side by side.

a
  first sequence of lines (list of strings)
b
  second sequence of lines (list of strings)
linenumberwidth
  width (in characters) of the linenumbers (integer)

Returns:
  a generator yielding tuples of differences. The tuple is composed of strings as follows.
  - opcode -- one of e, d, i, r for equal, delete, insert, replace
  - lineno a -- linenumber of sequence a
  - line a -- line of sequence a
  - lineno b -- linenumber of sequence b
  - line b -- line of sequence b

Up