WindowClasses

Contains all the window classes

class WindowClasses.AboutMenuDialog(parent, id)

This dialog is called when the about button is pressed in the main UI. Not much to say here. Nobody ever needs this aside from a future TIPP developer.

Parameters:
  • parent (NoneType) – 99% of the time this should be None
  • id (int) – 99% of the time this should be wx.ID_ANY
Return type:

None

class WindowClasses.ChangeHSIMetadata(parent, id, FileName, MetaData, DRTChoices)

This dialog box is called when the user opts to change the metadata of a hyperspectral imaging file. It displays all the metadata present for the file and allows the user to modify it.

Parameters:
  • parent (NoneType) – 99% of the time this should be None
  • id (int) – 99% of the time this should be wx.ID_ANY
  • FileName (String) – The name of the file of which the metadata needs to be changed.
  • MetaData (Dictionary) – MetaData dictionary
  • DRTChoices (List with Strings) – List with all the possible DRT’s that are in the DRT folder in the project.
Return type:

None

GetExt()

Get the extension of the file of which the metadata was changed. (i.e. TIPPHSI) This is required because some files dont have a type in their metadata.

Returns:A string with the file extension
Return type:String
GetMetaData()

Gets the metadata that was created when OnOk was called.

Returns:MetaData dictionary
Return type:Dictionary
OnOk(event)

When the OK button is pressed all the metadata that has been filled in is read and stored in a new dictionary, then the panel is destroyed. The variable self.ok is set to true to be used later on, and the frame is closed.

class WindowClasses.CoordinateDialog(parent, id, Xmax=1000000000, Ymax=1000000000)

This small dialog is used in the visualization module. It is used when “Add Point” is pressed. It creates a panel with x and y options an the options to fill in integer values.

Parameters:
  • parent (wx.Window (wx.Frame or wx.Panel etc)) – wx.Window type, should be None
  • max (int) – the maximum value the values in the frame can be set to.
Return type:

None

GetCoords()

Gets the filled in values and returns them. :returns: The values filled in in the spinners :rtype: list of int

class WindowClasses.DisplayChoiceDialog(parent, id, Plugins)
Parameters:
  • Plugins (list) – The list with plugin names
  • parent (NoneType) – 99% of the time this should be None
  • id (int) – 99% of the time this should be wx.ID_ANY
Return type:

None

class WindowClasses.FringeMetadataDialog(parent, id, FileNames, CurrentProject, Bands)

This is the dialog box that is showed when AIDO images are imported. It allows the user to enter the metadata and sort the files.

Parameters:
  • parent (wx.Window) – The parent of the panel. Should be None.
  • id (int) – Should be wx.ID_ANY
  • FileNames (List of String) – List with all the files to be imported. (Contains only their filenames, not paths)
  • CurrentProject (String) – Directory to current project folder where the images should be imported to.
  • Bands (int) – The amount of images.
Return type:

None

GetFileName()

Returns the filename set by the user.

Return type:String
GetMetadata()

Extracts the metadata from everything that is filled in on the metadata panel and adds it to a dictionary.

Return type:Dictionary
GetSortLst()

Returns the list of all the strings in the sorting panel. (The panel on the right)

Return type:list of String
MakeLayout()

Makes the layout.

MakePanels()

Makes all the panels.

OnOk(event)

This function gets all the information from the function panel and saves it into a variable. It also checks wether the filled in wavelength range and steps match with the amount of images present.

Parameters:event (wx.EVT) – Not used event.
Return type:None
class WindowClasses.GaugeInputDialog(parent, id, parent_conn, CloseEvent, PauseEvent, FilePath, FileName, CurrentProject, MaxGaugeValue=100, NameSuggestion='_', Text='Please Wait', FileType='.Tipp', **kwargs)
A gauge dialog consist of three classes:
  • The (Gauge)Dialog class. This class is the visual part (the gauge and all the input from the user). Run by the main thread.
  • The (Running)Thread class. In this class all the calculation are done. Run by a new thread.
  • The Catclass class. This class makes the thread, the dialog and the communication from the dialog to the thread. Run by the main thread.

The idea is that the dialog class controls the (calculation thread). The communication is as follows. The dialog can pauze the thread with event (explained later) and can sent objects with the pipe. The Thread uses pup.subscribes to tell the dialog where it is with the calculations or can sent a messages that is needs input from the user

So in code first the dialog gets build then at last he sent a signal (pup.subscribe) to start the thread. Then the calculation starts and sent often a signal where they are. When input is required a singal is sent to the dialog and the thread is pauzed. This signal enables inputs fields in the dialog. When next is clicked the dialog disalbes those field, sent the python object through the pipe and then unpauzes the thread. The thread catch the object and continues. This can be done as many times as you like.

The cancel button pauzes the thread (make sure there are enough event.wait() in the thread),removes if nessary the partly saved files and closes the gaugedialog. At this point the thread becomes a “Ghost” thread and is properly closed when tipp is closed.

CloseGauge(evt=None, ErrorMessage=['', ''])

Handles the events if the dialog gets closed

Parameters:
  • evt (None or wx.event) – This tells the user with which event this defintions is called. (default is None)
  • ErrorMessage (list) – list with two strings. First string is the message the second the tile of the warningdialog.
FileNameInput(FileName)

The thread asks for the filename so the part of the dialog that handels the filename gets enabled

InformationDialog(msg=['Something went wrong', 'Error'])

An information dialog. This can be used if the error is not fatal for the (whole) plugin.

Parameters:msg (list) – list with two strings. First string is the message the second the tile of the InformationDialog. Default is [“Something went wrong”,”Error”].
MakeLayout()

Here is the layout of the dialog created

MakePanels()

Here all the extra panels are created. That are used for user input.

OnFileName(event)

Test if the Filename already exist. This is an internal function that is called when text is typed in the FileNamePanel.

OnNext(evt)

This def is called if the user clicks next and handles all the communication with the thread and disables the input fields

QuestionCloseGauge(msg=['Maximum Allowable RAM that can be used by the Program is reached. Do you want to close the plugin?', 'RAM Overload'])

A warningdialog with which the user has a choise to close the plugin

Parameters:msg (list) – list with two strings. First string is the message the second the tile of the warningdialog. Default is [“Maximum Allowable RAM that can be used by the Program is reached. Do you want to close the plugin? ”,”RAN Overload”].
UpdateGauge(msg=None, Text=None)

Updates the gauge by setting the value to the value sent in msg. If the value is greater or equal to/than the maximum value the panel is destroyed.

Parameters:
  • msg (int) – Integer with gauge value to set to.
  • Text (string or None) – Sets a new text under the gauge.
class WindowClasses.GenerateDRT(parent, id, FileName, Wavelengths, Col, WavelengthInfo)

This dialog is used to obtain DRT files from datasets. It allows the user to fill in some relevant information and select the column to be imported.

Parameters:
  • parent (wx.Window or NoneType) – Parent of the dialog (should be None)
  • id (int) – id of dialog (should be wx.ID_ANY)
  • FileName (Str) – Filename of the file of which the DRT is being imported
  • Wavelengths (list of int) – The input range for which the DRT is generated. (The default, can be changed in the dialog)
  • Col (int) – amount of columns in the loaded sample. (Maximum amount of columns)
Returns:

Nothing

Type:

NoneType

GetMetaData()
Returns:The Metadata
Return type:Dictionary
OnOk(event)

When ok is called it loads all the variables from the panels and puts them into metadata, sets the self.ok value to true so it can be checked.

Parameters:event (Unimportant) – Unused
Returns:Nothing
class WindowClasses.MakingNewShuttertimeDialog(parent, id)

This dialog is called when the user wants to use the make new shuttertime dialog. It asks the user to input a shuttertime (very simple dialog)

Parameters:
  • parent (wx.Window or NoneType) – Parent of the dialog (should be None)
  • id (int) – id of dialog (should be wx.ID_ANY)
OnClose(event)

When the window is closed by not pressing ok sets the shuttertime to “-1” as a failsafe mechanism. (This was before we used self.ok for everything) and destroys the window. :param event: :return:

OnOk(event)

Stores the selected shuttertime in a vlue and closes the window. :param event: Unused :returns: Nothing

class WindowClasses.NameFile(parent, id, FileName, Defaultname, CurrentProject, Ext)

This dialog generates a list of the filenames and allows the user to change them. This will then in turn return the list of new filenames. Useful for bulk importing images. :param parent: Parent of the dialog (should be None) :type parent: wx.Window or NoneType :param id: id of dialog (should be wx.ID_ANY) :type id: int :param FileName: List with filenames to change. :type FileName: list of Str :param Defaultname: If a default suffix is used this can be set. (for example _100%white) :type Defaultname: Str :param CurrentProject: The current opened project :type CurrentProject: Str :param Ext: The extensies of the file(s) :type Ext: list

Returns:Nothing
Return type:NoneType
GetFileNames()
Returns:All the filenames in the panel. (the new ones)
OnFileName(event, FileNumber)

This looks if the file exist and changes the button name accordingly.

class WindowClasses.PCADialog(parent, id, Shape, FileName)
Parameters:
  • FileName (string) – The filename
  • Shape (tuple) – The shape of the image
  • parent (NoneType) – 99% of the time this should be None
  • id (int) – 99% of the time this should be wx.ID_ANY
Return type:

None

class WindowClasses.PluginInfoDialog(parent, id, PluginName, PluginInfoDic)

This dialog dislays information when the user clicks ‘info’ on the plugin in the plugin selector.

Parameters:
  • parent (wx.Window or NoneType) – Parent of the dialog (should be None)
  • id (int) – id of dialog (should be wx.ID_ANY)
  • PluginName (string) – Currently selected plugin name
  • PluginInfo (dictionary) – Plugin Information Data (of all plugins currently loaded)
Return type:

None

class WindowClasses.RCAOptionDialog(parent, id, Metadata)

This Dialog gives the RCA options.

Parameters:
  • parent (wx.Window or NoneType) – Parent of the dialog (should be None)
  • id (int) – id of dialog (should be wx.ID_ANY)
  • Metadata (dir) – The metadata of the Normalized_HSI file
Returns:

Nothing

Return type:

NoneType

GetValues()

Gives the values of the inputs :returns: A list with the selected radiobutton and the spinner values

class WindowClasses.RunningThread(child_conn, CloseEvent, PauseEvent, FilePath, FileName, CurrentProject, Plugin=' ', **kwargs)

This class must be used in combination with the GaugeDialog and provides a new thread for the calculations.

Parameters:
  • child_conn (multiprocessing Pipe) – With this variables you are able to resive object (list,string,int, ect.) from the Gauge dialog to the calculation thread.
  • event (multiprocessing event) – With event you can pauze (IDLE) this thread class. This is done by putting the line event.clear() in the gauge dialog. When you want to continue put the line event.set() in the code. The thread only can be pauzed at the lines event.wait() (those lines should be in the calcualtion thread).
  • FilePath (list with strings) – A list with all the selected filepaths
  • FileName (list with strings) – A list with all the selected filenames
  • CurrentProject (string) – The current opened project
  • **kwargs (dict) – **kwargs can be used to add more variables to the thread (for example Stetting=self.Settings)
Return type:

None

CheckClose(Multiprocessed=False)

Checks if the thread is closed or RAM is overloaded

Parameters:Multiprocessed (boolean) – If this boolean is True it also closes self.OutputFile and self.pool
class WindowClasses.SettingsPanel(parent, id, FullScreen=False, Start=False)

The settings panel used in the program. :param parent: None :type parent: None :param id: wx.ID_ANY :type id: int :param FullScreen: Whether the program is currently in fullscreen mode :type FullScreen: bool :param Start: Whether this is the first boot of the program. :type Start: bool :returns: Nothing :rtype: NoneType

MakeLayout()

Uses the WindowConstuctor layout algorithm to do the layout for the panel. Complex function that takes into account many possibilities in the panel.

Returns:
MakePanels()

Makes all the panels. For a detailed explanation please see some other frames to get the hang of wxPython, this is by far one of the most difficult ones.

:returns:Nothing

OnClose(event)

When the window is closed this way no new variables will be selected. However a check will be performed to see if the current workfolder exists. If it does not the program will ask for it. (A workfolder is required) Then at the end calles the pubsub message “framelistener” to indicate that the main frame needs to be built. This occurs when it is the first boot.

Parameters:event – Unused
Returns:Nothing
OnOk(event)

This extracts all the variables from the panels and puts them back into the metadata. Then at the end calles the pubsub message “framelistener” to indicate that the main frame needs to be built. This occurs when it is the first boot.

Parameters:event – Unused
Returns:Nothing
OnRadioButton()

If the radiobutton that indicates the resolution is selected this will set the new resolution variable. :returns: Nothing

OnResolution(event)

If the resolution “^” is pressed this will open up the resolution options panel. :param event: Unused :returns: Nothing

class WindowClasses.StDialog(parent, id)

The standard dialog that was created. It is just a small extended wx.Dialog with an ok and cancel button. It contains a variable (self.ok) that can be checked to see wether the user clicked ok or cancel.

Parameters:
  • parent (NoneType) – 99% of the time this should be None
  • id (int) – 99% of the time this should be wx.ID_ANY
Return type:

None

OnClose(event)

Sets self.ok to false and closes window.

OnOk(event)

Sets self.ok to True and closes window.