eric7.UI.NumbersWidget

Module implementing a widget to show numbers in different formats.

Global Attributes

None

Classes

BinaryModel Class implementing a model for entering binary numbers.
NumbersWidget Class implementing a widget to show numbers in different formats.

Functions

None


BinaryModel

Class implementing a model for entering binary numbers.

Derived from

QAbstractTableModel

Class Attributes

None

Class Methods

None

Methods

BinaryModel Constructor
columnCount Public method to get the number of columns of the model.
data Public method to get data from the model.
flags Public method to get flags from the model.
getValue Public slot to get the current value.
headerData Public method to get header data from the model.
rowCount Public method to get the number of rows of the model.
setBits Public slot to set the number of bits.
setBitsAndValue Public slot to set the number of bits and the value to show.
setData Public method to set the data of a node cell.
setValue Public slot to set the value to show.

Static Methods

None

BinaryModel (Constructor)

BinaryModel(parent=None)

Constructor

parent (QWidget)
reference to the parent widget

BinaryModel.columnCount

columnCount(_parent)

Public method to get the number of columns of the model.

_parent (QModelIndex)
parent index (unused)
Return:
number of columns
Return Type:
int

BinaryModel.data

data(index, role=Qt.ItemDataRole.DisplayRole)

Public method to get data from the model.

index (QModelIndex)
index to get data for
role (int)
role of the data to retrieve
Return:
requested data
Return Type:
Any

BinaryModel.flags

flags(_index)

Public method to get flags from the model.

_index (QModelIndex)
index to get flags for (unused)
Return:
flags
Return Type:
Qt.ItemFlags

BinaryModel.getValue

getValue()

Public slot to get the current value.

Return:
current value of the model
Return Type:
int

BinaryModel.headerData

headerData(section, orientation, role=Qt.ItemDataRole.DisplayRole)

Public method to get header data from the model.

section (int)
section number
orientation (Qt.Orientation)
orientation
role (Qt.ItemDataRole)
role of the data to retrieve
Return:
requested data
Return Type:
Any

BinaryModel.rowCount

rowCount(_parent)

Public method to get the number of rows of the model.

_parent (QModelIndex)
parent index (unused)
Return:
number of columns
Return Type:
int

BinaryModel.setBits

setBits(bits)

Public slot to set the number of bits.

bits (int)
number of bits to show

BinaryModel.setBitsAndValue

setBitsAndValue(bits, value)

Public slot to set the number of bits and the value to show.

bits (int)
number of bits to show
value (int)
value to show

BinaryModel.setData

setData(index, value, role=Qt.ItemDataRole.EditRole)

Public method to set the data of a node cell.

index (QModelIndex)
index of the node cell
value (Any)
value to be set
role (int)
role of the data
Return:
flag indicating success
Return Type:
boolean)

BinaryModel.setValue

setValue(value)

Public slot to set the value to show.

value (int)
value to show
Up


NumbersWidget

Class implementing a widget to show numbers in different formats.

Signals

insertNumber(str)
emitted after the user has entered a number and selected the number format

Derived from

QWidget, Ui_NumbersWidget

Class Attributes

None

Class Methods

None

Methods

NumbersWidget Constructor
__binModelDataChanged Private slot to handle a change of the binary model value by the user.
__block Private slot to block some signals.
__formatNumbers Private method to format the various number inputs.
on_binEdit_textChanged Private slot to handle input of a binary number.
on_binInButton_clicked Private slot to retrieve a binary number from the current editor.
on_binOutButton_clicked Private slot to send a binary number.
on_byteOrderButton_clicked Private slot to swap the byte order.
on_decEdit_textChanged Private slot to handle input of a decimal number.
on_decInButton_clicked Private slot to retrieve a decimal number from the current editor.
on_decOutButton_clicked Private slot to send a decimal number.
on_hexEdit_textChanged Private slot to handle input of a hexadecimal number.
on_hexInButton_clicked Private slot to retrieve a hexadecimal number from the current editor.
on_hexOutButton_clicked Private slot to send a hexadecimal number.
on_octEdit_textChanged Private slot to handle input of an octal number.
on_octInButton_clicked Private slot to retrieve an octal number from the current editor.
on_octOutButton_clicked Private slot to send an octal number.
on_sizeBox_valueChanged Private slot handling a change of the bit size.

Static Methods

None

NumbersWidget (Constructor)

NumbersWidget(parent=None)

Constructor

parent (QWidget)
reference to the parent widget

NumbersWidget.__binModelDataChanged

__binModelDataChanged(_start, _end)

Private slot to handle a change of the binary model value by the user.

_start (QModelIndex)
start index (unused)
_end (QModelIndex)
end index (unused)

NumbersWidget.__block

__block(b)

Private slot to block some signals.

b (bool)
flah indicating the blocking state

NumbersWidget.__formatNumbers

__formatNumbers(numberFormat)

Private method to format the various number inputs.

numberFormat (int)
number format indicator

NumbersWidget.on_binEdit_textChanged

on_binEdit_textChanged(txt)

Private slot to handle input of a binary number.

txt (str)
text entered

NumbersWidget.on_binInButton_clicked

on_binInButton_clicked()

Private slot to retrieve a binary number from the current editor.

NumbersWidget.on_binOutButton_clicked

on_binOutButton_clicked()

Private slot to send a binary number.

NumbersWidget.on_byteOrderButton_clicked

on_byteOrderButton_clicked()

Private slot to swap the byte order.

NumbersWidget.on_decEdit_textChanged

on_decEdit_textChanged(txt)

Private slot to handle input of a decimal number.

txt (str)
text entered

NumbersWidget.on_decInButton_clicked

on_decInButton_clicked()

Private slot to retrieve a decimal number from the current editor.

NumbersWidget.on_decOutButton_clicked

on_decOutButton_clicked()

Private slot to send a decimal number.

NumbersWidget.on_hexEdit_textChanged

on_hexEdit_textChanged(txt)

Private slot to handle input of a hexadecimal number.

txt (str)
text entered

NumbersWidget.on_hexInButton_clicked

on_hexInButton_clicked()

Private slot to retrieve a hexadecimal number from the current editor.

NumbersWidget.on_hexOutButton_clicked

on_hexOutButton_clicked()

Private slot to send a hexadecimal number.

NumbersWidget.on_octEdit_textChanged

on_octEdit_textChanged(txt)

Private slot to handle input of an octal number.

txt (str)
text entered

NumbersWidget.on_octInButton_clicked

on_octInButton_clicked()

Private slot to retrieve an octal number from the current editor.

NumbersWidget.on_octOutButton_clicked

on_octOutButton_clicked()

Private slot to send an octal number.

NumbersWidget.on_sizeBox_valueChanged

on_sizeBox_valueChanged(value)

Private slot handling a change of the bit size.

value (int)
selected bit size
Up