gui.util package

Submodules

gui.util.Modules module

class gui.util.Modules.Modules[source]

Bases: object

Modules class that UI modules will inherit from.

*Note: Rigorous prototyping is still occurring So, naturally, assume that something in this class is always getting changed or added to better serve all cases in each UI class.

Since Modules is shared among all the UI classes it would make sense that we would have some variables, that are necessary among all these classes, be put here in a high place where they can be referenced often.

static changeComboListVars(obj, newchoices)[source]

Function changes combo boxes or list widgets This function does not need to be overridden.

Parameters:
  • obj

  • newchoices

Returns:

checkMinAndMax()[source]

Go through the entire UI and set the maximums and minimums of each widget

Returns:

connectWidgets()[source]

Connect the necessary widgets.

Returns:

data = {}
data_count = -1
datafiles = {}
datakeys = []
static defaultComboItem(obj, item)[source]

Set the default selected item in a box.

Parameters:
  • obj

  • item

Returns:

delete()[source]

In some particular cases, the UI needs to have some information dumped. This is a chance to do that.

Returns:

dimred = {}
dimredkeys = []
disconnectWidgets()[source]

Disconnect the widgets that way we don’t run into this problem https://stackoverflow.com/questions/3530590/qt-signals-and-slot -connected-twice-what-happens#_=_

Returns:

figname = []
figs = {}
static getChangedValues(input_dictionary, algorithm)[source]

Check symmetrically if the values in the dictionary match with values in the algorithm If they don’t, then we will want to record those changed values.

Example input: getChangedValues(methodParameters, AirPLS())

Parameters:
  • input_dictionary

  • algorithm

Returns:

getGuiParams()[source]

Return the contents from lineEdits, comboBoxes, etc.

Returns:

getMainWindowParent()[source]
get_widget()[source]

This function specifies the variable that holds the styling. Use this function to get the variable

Returns:

guiChanged()[source]
isEnabled()[source]

Checks to see if current widget isEnabled or not :return:

static list_amend(list_, count_, input_)[source]

In some cases a list is never actually instantiated. To fix this, we want to first try and see if we can access a particular count If that doesn’t work due to an IndexError then we’ll just settle for appending

Parameters:
  • list

  • count

  • input

Returns:

model_count = -1
model_xvars = {}
model_yvars = {}
modelkeys = []
models = {}
mousePressEvent(QMouseEvent)[source]

TODO: Add right click event The hope is that we can add a right click dialogue for users The dialogue would give the option to delete particular modules from the UI, or insert modules, or copy modules.

outpath = './'
parent = []
predictkeys = []
run()[source]

Each Module’s functionality will be ran in this function. You will define what will happen to the data and parameters in here :return:

selectiveSetGuiParams(dict)[source]

Selectively restore the UI. We don’t want to lose the content we have selected but we don’t want to override crucial information either

Parameters:

dict

Returns:

static setComboBox(comboBox, keyValues)[source]

Sets up the information inside comboBox widgets This function does not need to be overridden.

Parameters:
  • comboBox – QtWidgets.QComboBox

  • keyValues – []

Returns:

setDisabled(bool)[source]

After every execution we want to prevent the user from changing something. So, disable the layout by greying it out

Parameters:

bool

Returns:

setGuiParams(dict)[source]

Using a dictionary, restore the UI

Parameters:

dict

Returns:

static setListWidget(obj, choices)[source]

Function changes lists This function does not need to be overridden

Parameters:
  • obj

  • choices

Returns:

setProgressBar(progressBar)[source]

This function makes it possible to reference the progress bar in MainWindow

Parameters:

progressBar

Returns:

setup()[source]

This is a stripped down version of run() Each Module’s functionality will be quickly ran through, so we have at least something in the UI to work with

Returns:

setupUi(Form)[source]

gui.util.PandasModel module

class gui.util.PandasModel.PandasModel(data, parent=None)[source]

Bases: QAbstractTableModel

Class to populate a table view with a pandas dataframe

columnCount(self, parent: QModelIndex = QModelIndex()) int[source]
data(self, index: QModelIndex, role: int = Qt.ItemDataRole.DisplayRole) Any[source]
headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.ItemDataRole.DisplayRole) Any[source]
rowCount(self, parent: QModelIndex = QModelIndex()) int[source]

gui.util.Qtickle module

class gui.util.Qtickle.Qtickle(ui)[source]

Bases: object

A script designed to aid in saving values inside Qt objects. It works by inspecting for objectnames and then collecting their values.

The name is a portmanteau of Qt and pickle. Originally the script utilized pickle to save data. Now data is returned in the form of a dictionary. This way the user gets to choose what happens to the data

guiChanged(functionCall)[source]

when the UI changes run the parameter functionCall

Parameters:

functionCall

Returns:

guiDisonnect()[source]

This is mainly a problem with the buttons that were opening file dialogs, but if there are other cases, please consider adding those cases to this method.

https://stackoverflow.com/questions/3530590/qt-signals-and-slot -connected-twice-what-happens#_=_ Just like in this stackoverflow question, there are some instances where the UI will call connects more than once… this is dangerous as it causes dialog boxes to display also more than once. This method is an attempt to cull this problem.

Returns:

guiRestore(dict)[source]

Restore the GUI. This is a hard restore, meaning that everything will be overwritten

Parameters:

dict

Returns:

guiSave()[source]

Save all values in a particular UI

Returns:

selectiveGuiRestore(dict)[source]

Restore the GUI. This is a softer restore in regards to comboboxes. Comboboxes will not be overwritten but instead will be given an index to set themselves to. Everything else will continue to be overwritten, be careful.

Parameters:

dict

Returns:

gui.util.Worker module

class gui.util.Worker.Worker(func, parent=None)[source]

Bases: QThread

run(self)[source]
taskFinished

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

gui.util.colormaps module

gui.util.delete module

gui.util.delete.del_layout(qlayout, idx)[source]

This method will delete the n - idxed layout that exists in qlayout

indexed by qlayout | | | | You can reference the index of these inner layouts by using | +—————-+ | the method takeAt() | +—————-+ | In this case if I want to access Layout 2 | | 1 | | I use qlayout.takeAt(1) | | | | | +—————-+ | +——————–+

Parameters:
  • qlayout

  • idx

Returns:

gui.util.delete.del_qwidget(QWidget)[source]

gui.util.excepthook module

gui.util.excepthook.my_exception_hook(exctype, value, traceback)[source]

gui.util.plots module

gui.util.plots.make_plot(x, y, figpath, figfile=None, xrange=None, yrange=None, xtitle='Reference (wt.%)', colorvar='None', colorval=None, ytitle='Prediction (wt.%)', title=None, lbl='', one_to_one=False, rmse=True, dpi=1000, color=None, annot_mask=None, cmap=None, colortitle='', loadfig=None, masklabel='', marker='o', linestyle='None', hline=None, hlinelabel=None, hlinestyle='--', yzero=False, linewidth=0.2, vlines=None)[source]
gui.util.plots.pca_ica_plot(data, x_component, y_component, dimred_obj, colorvar=None, cmap='viridis', method='PCA', figpath=None, figfile=None)[source]

gui.util.themes module

gui.util.themes.braceyourself(MainWindow)[source]
gui.util.themes.default(MainWindow)[source]

Module contents