eric4.UI.CompareDialog

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

Global Attributes

None

Classes

CompareDialog Class implementing a dialog to compare two files and show the result side by side.
CompareWindow Main window class for the standalone dialog.

Functions

removeMarkers Internal function to remove all diff markers.
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

QWidget, Ui_CompareDialog

Class Attributes

None

Methods

CompareDialog Constructor
__appendText Private method to append text to the end of the contents pane.
__fileChanged Private slot to enable/disable the Compare button.
__moveTextToCurrentDiffPos Private slot to move the text display to the current diff position.
__scrollBarMoved Private slot to enable the buttons and set the current diff position depending on scrollbar position.
__selectFile Private slot to display a file selection dialog.
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_downButton_clicked Private slot to go to the next difference.
on_file1Button_clicked Private slot to handle the file 1 file selection button press.
on_file2Button_clicked Private slot to handle the file 2 file selection button press.
on_firstButton_clicked Private slot to go to the first difference.
on_lastButton_clicked Private slot to go to the last difference.
on_synchronizeCheckBox_toggled Private slot to connect or disconnect the scrollbars of the displays.
on_upButton_clicked Private slot to go to the previous difference.
show Public slot to show the dialog.

CompareDialog (Constructor)

CompareDialog(files = [], parent = None)

Constructor

files
list of files to compare and their label (list of two tuples of two strings)
parent
parent widget (QWidget)

CompareDialog.__appendText

__appendText(pane, linenumber, line, format, interLine = False)

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

pane
text edit widget to append text to (QTextedit)
linenumber
number of line to insert (string)
line
text to insert (string)
format
text format to be used (QTextCharFormat)
interLine
flag indicating interline changes (boolean)

CompareDialog.__fileChanged

__fileChanged()

Private slot to enable/disable the Compare button.

CompareDialog.__moveTextToCurrentDiffPos

__moveTextToCurrentDiffPos()

Private slot to move the text display to the current diff position.

CompareDialog.__scrollBarMoved

__scrollBarMoved(value)

Private slot to enable the buttons and set the current diff position depending on scrollbar position.

value
scrollbar position (integer)

CompareDialog.__selectFile

__selectFile(lineEdit)

Private slot to display a file selection dialog.

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

CompareDialog.on_buttonBox_clicked

on_buttonBox_clicked(button)

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

button
button that was clicked (QAbstractButton)

CompareDialog.on_diffButton_clicked

on_diffButton_clicked()

Private slot to handle the Compare button press.

CompareDialog.on_downButton_clicked

on_downButton_clicked()

Private slot to go to the next difference.

CompareDialog.on_file1Button_clicked

on_file1Button_clicked()

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

CompareDialog.on_file2Button_clicked

on_file2Button_clicked()

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

CompareDialog.on_firstButton_clicked

on_firstButton_clicked()

Private slot to go to the first difference.

CompareDialog.on_lastButton_clicked

on_lastButton_clicked()

Private slot to go to the last difference.

CompareDialog.on_synchronizeCheckBox_toggled

on_synchronizeCheckBox_toggled(sync)

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

sync
flag indicating synchronisation status (boolean)

CompareDialog.on_upButton_clicked

on_upButton_clicked()

Private slot to go to the previous difference.

CompareDialog.show

show(filename = None)

Public slot to show the dialog.

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


CompareWindow

Main window class for the standalone dialog.

Derived from

KQMainWindow

Class Attributes

None

Methods

CompareWindow Constructor
eventFilter Public method to filter events.

CompareWindow (Constructor)

CompareWindow(files = [], parent = None)

Constructor

files
list of files to compare and their label (list of two tuples of two strings)
parent
reference to the parent widget (QWidget)

CompareWindow.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)
Returns:
flag indicating, whether the event was handled (boolean)
Up


removeMarkers

removeMarkers(line)

Internal function to remove all diff markers.

line
line to work on (string)
Returns:
line without diff markers (string)
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.
Up