# eric7.UI.DiffDialog

Module implementing a dialog to compare two files.

### Global Attributes

None

### Classes

DiffDialog | Class implementing a dialog to compare two files.
DiffWindow | Main window class for the standalone dialog.

### Functions

None

## DiffDialog

Class implementing a dialog to compare two files.

### Derived from

QWidget, Ui_DiffDialog

### Class Attributes

None

### Class Methods

None

### Methods

DiffDialog | Constructor
__appendText | Private method to append text to the end of the contents pane.
__fileChanged | Private slot to enable/disable the Compare button.
__generateContextDiff | Private slot to generate a context diff output.
__generateUnifiedDiff | Private slot to generate a unified diff output.
on_buttonBox_clicked | Private slot called by a button of the button box clicked.
on_diffButton_clicked | Private slot to handle the Compare button press.
on_saveButton_clicked | Private slot to handle the Save button press.
show | Public slot to show the dialog.

### Static Methods

None

#### DiffDialog (Constructor)

DiffDialog(parent=None)

Constructor

parent
  reference to the parent widget (QWidget)

#### DiffDialog.__appendText

__appendText(txt)

Private method to append text to the end of the contents pane.

txt
  text to insert (string)

#### DiffDialog.__fileChanged

__fileChanged()

Private slot to enable/disable the Compare button.

#### DiffDialog.__generateContextDiff

__generateContextDiff(a, b, fromfile, tofile, fromfiledate, tofiledate)

Private slot to generate a context diff output.

a
  first sequence of lines (list of strings)
b
  second sequence of lines (list of strings)
fromfile
  filename of the first file (string)
tofile
  filename of the second file (string)
fromfiledate
  modification time of the first file (string)
tofiledate
  modification time of the second file (string)

#### DiffDialog.__generateUnifiedDiff

__generateUnifiedDiff(a, b, fromfile, tofile, fromfiledate, tofiledate)

Private slot to generate a unified diff output.

a
  first sequence of lines (list of strings)
b
  second sequence of lines (list of strings)
fromfile
  filename of the first file (string)
tofile
  filename of the second file (string)
fromfiledate
  modification time of the first file (string)
tofiledate
  modification time of the second file (string)

#### DiffDialog.on_buttonBox_clicked

on_buttonBox_clicked(button)

Private slot called by a button of the button box clicked.

button
  button that was clicked (QAbstractButton)

#### DiffDialog.on_diffButton_clicked

on_diffButton_clicked()

Private slot to handle the Compare button press.

#### DiffDialog.on_saveButton_clicked

on_saveButton_clicked()

Private slot to handle the Save button press.

It saves the diff shown in the dialog to a file in the local filesystem.

#### DiffDialog.show

show(filename=None)

Public slot to show the dialog.

filename
  name of a file to use as the first file (string)

Up

## DiffWindow

Main window class for the standalone dialog.

### Derived from

EricMainWindow

### Class Attributes

None

### Class Methods

None

### Methods

DiffWindow | Constructor
eventFilter | Public method to filter events.

### Static Methods

None

#### DiffWindow (Constructor)

DiffWindow(parent=None)

Constructor

parent
  reference to the parent widget (QWidget)

#### DiffWindow.eventFilter

eventFilter(obj, event)

Public method to filter events.

obj
  reference to the object the event is meant for (QObject)
event
  reference to the event object (QEvent)

Return:
  flag indicating, whether the event was handled (boolean)

Up