lintrans.gui.dialogs package
Module contents
This package provides separate dialogs for the main GUI.
These dialogs are for defining new matrices in different ways and editing settings.
Submodules
lintrans.gui.dialogs.define_new_matrix module
This module provides an abstract DefineMatrixDialog
class and subclasses.
- class lintrans.gui.dialogs.define_new_matrix.DefineAsExpressionDialog
Bases:
DefineMatrixDialog
The dialog class that allows the user to define a matrix as an expression of other matrices.
- __init__(*args, matrix_wrapper: MatrixWrapper, **kwargs)
Create the widgets and layout of the dialog.
- Parameters
matrix_wrapper (MatrixWrapper) – The MatrixWrapper that this dialog will mutate
- _confirm_matrix() None
Evaluate the matrix expression and assign its value to the name in the combo box.
- class lintrans.gui.dialogs.define_new_matrix.DefineMatrixDialog
Bases:
FixedSizeDialog
An abstract superclass for definitions dialogs.
Warning
This class should never be directly instantiated, only subclassed.
- __init__(*args, matrix_wrapper: MatrixWrapper, **kwargs)
Create the widgets and layout of the dialog.
Note
*args
and**kwargs
are passed to the super constructor (QDialog
).- Parameters
matrix_wrapper (MatrixWrapper) – The MatrixWrapper that this dialog will mutate
- abstract _confirm_matrix() None
Confirm the inputted matrix and assign it.
Note
When subclassing, this method should mutate
self.matrix_wrapper
and then callself.accept()
.
- _load_matrix(index: int) None
Load the selected matrix into the dialog.
This method is optionally able to be overridden. If it is not overridden, then no matrix is loaded when selecting a name.
We have this method in the superclass so that we can define it as the slot for the
QComboBox.activated()
signal in this constructor, rather than having to define that in the constructor of every subclass.
- class lintrans.gui.dialogs.define_new_matrix.DefineNumericallyDialog
Bases:
DefineMatrixDialog
The dialog class that allows the user to define a new matrix numerically.
- __init__(*args, matrix_wrapper: MatrixWrapper, **kwargs)
Create the widgets and layout of the dialog.
- Parameters
matrix_wrapper (MatrixWrapper) – The MatrixWrapper that this dialog will mutate
- class lintrans.gui.dialogs.define_new_matrix.DefineVisuallyDialog
Bases:
DefineMatrixDialog
The dialog class that allows the user to define a matrix visually.
- __init__(*args, matrix_wrapper: MatrixWrapper, display_settings: DisplaySettings, polygon_points: List[Tuple[float, float]], **kwargs)
Create the widgets and layout of the dialog.
- Parameters
matrix_wrapper (MatrixWrapper) – The MatrixWrapper that this dialog will mutate
lintrans.gui.dialogs.misc module
This module provides miscellaneous dialog classes like AboutDialog
.
- class lintrans.gui.dialogs.misc.AboutDialog
Bases:
FixedSizeDialog
A simple dialog class to display information about the app to the user.
It only has an
__init__()
method because it only has label widgets, so no other methods are necessary here.- __init__(*args, **kwargs)
Create an
AboutDialog
object with all the label widgets.
- class lintrans.gui.dialogs.misc.DefinePolygonDialog
Bases:
FixedSizeDialog
This dialog class allows the use to define a polygon with
DefinePolygonWidget
.
- class lintrans.gui.dialogs.misc.FileSelectDialog
Bases:
QFileDialog
A subclass of
QFileDialog
that fixes an issue with the default suffix on UNIX platforms.- selectedFiles() List[str]
Return a list of strings containing the absolute paths of the selected files in the dialog.
There is an issue on UNIX platforms where a hidden directory will be recognised as a suffix. For example,
/home/dyson/.lintrans/saves/test
should have.lt
appended, but.lintrans/saves/test
gets recognised as the suffix, so the default suffix is not added.To fix this, we just look at the basename and see if it needs a suffix added. We do this for every name in the list, but there should be just one name, since this class is only intended to be used for saving files. We still return the full list of filenames.
- class lintrans.gui.dialogs.misc.FixedSizeDialog
Bases:
QDialog
A simple superclass to create modal dialog boxes with fixed size.
We override the
open()
method to set the fixed size as soon as the dialog is opened modally.- __init__(*args, **kwargs) None
Set the
Qt::WA_DeleteOnClose
attribute to ensure deletion of dialog.
- open() None
Override
QDialog.open()
to set the dialog to a fixed size.
- class lintrans.gui.dialogs.misc.InfoPanelDialog
Bases:
FixedSizeDialog
A simple dialog class to display an info panel that shows all currently defined matrices.
- __init__(matrix_wrapper: MatrixWrapper, *args, **kwargs)
Create the dialog box with all the widgets needed to show the information.
lintrans.gui.dialogs.settings module
This module provides dialogs to edit settings within the app.
- class lintrans.gui.dialogs.settings.DisplaySettingsDialog
Bases:
SettingsDialog
The dialog to allow the user to edit the display settings.
- __init__(*args, display_settings: DisplaySettings, **kwargs)
Create the widgets and layout of the dialog.
- Parameters
display_settings (DisplaySettings) – The
DisplaySettings
object to mutate
- _confirm_settings() None
Build a
DisplaySettings
object and assign it.
- class lintrans.gui.dialogs.settings.SettingsDialog
Bases:
FixedSizeDialog
An abstract superclass for other simple dialogs.
- __init__(*args, resettable: bool, **kwargs)
Create the widgets and layout of the dialog, passing
*args
and**kwargs
to super.
- _reset_settings() None
Reset the settings.
Note
This method is empty but not abstract because not all subclasses will need to implement it.
- _setup_layout(options_layout: QLayout) None
Set the layout of the settings widget.
Note
This method must be called at the end of
__init__()
in subclasses to setup the layout properly.