BF-UI-SCIUI - SciUI Framework

../../../../../../../_images/MLPro-SciUI_class_diagram.drawio.png

Ver. 1.1.1 (2022-01-06)

SciUI framework classes to be reused in own SciUI scenarios. Needs Matplotlib 3.3 or higher.

class mlpro.bf.ui.sciui.framework.SciUISharedDB(p_root=None)

Bases: object

Container for scenario-internal data exchange and communication. Can be extended while runtime by consuming classes.

start_global_refresh()
class mlpro.bf.ui.sciui.framework.SciUIRoot(p_logging=True)

Bases: Log

SciUI root class with overarching properties.

class mlpro.bf.ui.sciui.framework.SciUIWindow(p_logging=False)

Bases: SciUIRoot, Tk

Root class for SciUI window apllications.

C_TYPE = 'SciUI Window'
C_NAME = '????'
start()
class mlpro.bf.ui.sciui.framework.SciUICursor(ax, horizOn=True, vertOn=True, useblit=False, **lineprops)

Bases: SciUIRoot, Cursor

Enriched matplotlib cursor widget.

connect_event(event, callback)

Connect a callback function with an event.

This should be used in lieu of figure.canvas.mpl_connect since this function stores callback ids for later clean up.

set_event_status(event, status)
onmove(event)

Internal event handler to draw the cursor when the mouse moves.

onbuttonpressed(event)
onbuttonreleased(event)
class mlpro.bf.ui.sciui.framework.SciUITooltip(widget, text='widget info')

Bases: object

Enriched tooltip class.

enter(event=None)
leave(event=None)
schedule()
unschedule()
showtip(event=None)
hidetip()
class mlpro.bf.ui.sciui.framework.SciUIComponent(p_shared_db: SciUISharedDB, p_logging=True)

Bases: SciUIRoot

Elementry screen object in SciUI framework.

C_TYPE = 'SciUI Component'
C_NAME = ''
init_component()

Initialization of component-specific elements at instance creation time. To be redefined.

get_name()
refresh(p_parent_frame=None)

Refresh of all component-specific elements. To be redefined. Please call super().refresh() at the beginning of your own implementation.

Parameters:

object (p_parent_frame Parent frame)

class mlpro.bf.ui.sciui.framework.SciUIFrame(p_shared_db: SciUISharedDB, p_row, p_col, p_title=None, p_width_perc=0.0, p_height_perc=0.0, p_visible=False, p_padx=5, p_pady=0, p_sticky='NW', p_logging=True)

Bases: SciUIComponent

Enriched wrapper class for the Tkinter (Label-)Frame class, based on the Tkinter grid positioning model.

C_TYPE = 'SciUI Frame'
C_NAME = ''
init_popup_menu()

Initializes popup menu of the component. To be redefined.

init_component()

Initialization of component-specific elements at instance creation time. To be redefined.

cb_popup_menu(p_event)
determine_frame_size()
refresh(p_parent_frame=None)

Refresh of all component-specific elements. To be redefined. Please call super().refresh() at the beginning of your own implementation.

Parameters:

object (p_parent_frame Parent frame)

add_component(p_component: SciUIComponent)
class mlpro.bf.ui.sciui.framework.SciUITabCTRL(p_shared_db: SciUISharedDB, p_row, p_col, p_title=None, p_width_perc=0.0, p_height_perc=0.0, p_visible=False, p_padx=5, p_pady=0, p_sticky='NW', p_logging=True)

Bases: SciUIFrame

Enriched wrapper class for the Tkinter tab control.

C_TYPE = 'SciUI Tabs'
init_component()

Initialization of component-specific elements at instance creation time. To be redefined.

refresh(p_parent_frame)

Refresh of all component-specific elements. To be redefined. Please call super().refresh() at the beginning of your own implementation.

Parameters:

object (p_parent_frame Parent frame)

add_component(p_component: SciUIComponent)
add_tab(p_tab_name, p_component: SciUIComponent)
class mlpro.bf.ui.sciui.framework.SciUISubplotSaveDLG(p_fname=None, p_xpos=500, p_ypos=300, p_logging=False)

Bases: SciUIWindow

Small SciUI window application to choose folder and file name for saving a SciUI subplot.

C_NAME = 'Save Plot'
C_FONT_FAMILY = 'Lucida Grande'
C_FONT_SIZE = 10
C_FILENAME = 'myplot'
C_SUFFIXES = ['.pdf', '.png', '.svg']
get_filename()
__cb_button_ok()
__cb_button_cancel()
__cb_button_folder()
class mlpro.bf.ui.sciui.framework.SciUISubplotRoot(p_shared_db: SciUISharedDB, p_row, p_col, p_title=None, p_width_perc=0.0, p_height_perc=0.0, p_visible=False, p_padx=5, p_pady=0, p_sticky='NW', p_logging=True)

Bases: SciUIFrame

Root class for specialized frame classes that embedd a matplotlib figure with one subplot into a Tkinter frame. Not intended for direct reuse. Please use inherited classes SciUISubplot2D, SciUISubplot3D instead.

C_TYPE = 'SciUI Subplot'
C_BACKEND = 'TkAgg'
C_FIG_FACECOLOR = 'white'
C_AX_RECTANGLE = [0.1, 0.1, 0.85, 0.85]
C_AX_FRAME = True
C_AX_FACECOLOR = 'white'
create_subplot()

Internally used to create a suitable subplot. New subplot needs to be bound to self.ax. To be redefined.

init_popup_menu()

Initializes popup menu of the component. To be redefined.

init_component()

Initialization of component-specific elements at instance creation time. To be redefined. Please call super().init_component() at beginning of your implementation.

determine_frame_size()
set_flush_events(p_flush: bool)
refresh(p_parent_frame)

Refresh of all component-specific elements. To be redefined. Please call super().refresh() at the beginning of your own implementation.

Parameters:

object (p_parent_frame Parent frame)

refresh_custom()

Additional refresh activities. To be redefined.

add_component(p_component)

Adding further subcomponents is disabled here.

cb_save_plot()
class mlpro.bf.ui.sciui.framework.SciUISubplot2D(p_shared_db: SciUISharedDB, p_row, p_col, p_title=None, p_width_perc=0.0, p_height_perc=0.0, p_visible=False, p_padx=5, p_pady=0, p_sticky='NW', p_logging=True)

Bases: SciUISubplotRoot

Specialized frame class that embedds a 2D matplotlib figure with one subplot into a Tkinter frame. A cross hair cursor functinality with mouse event handling can be switched on/off via class constant C_AX_CURSOR.

C_TYPE = 'SciUI 2D Subplot'
C_AX_RECTANGLE = [0.1, 0.1, 0.85, 0.85]
C_AX_CURSOR = False
C_AX_CURSOR_COLOR = 'blue'
create_subplot()

Internally used to create a suitable subplot. New subplot needs to be bound to self.ax. To be redefined.

__init_cursor()
cb_mbutton_pressed(event)
cb_mouse_moved(event)
cb_mbutton_released(event)
class mlpro.bf.ui.sciui.framework.SciUISubplot3D(p_shared_db: SciUISharedDB, p_row, p_col, p_title=None, p_width_perc=0.0, p_height_perc=0.0, p_visible=False, p_padx=5, p_pady=0, p_sticky='NW', p_logging=True)

Bases: SciUISubplotRoot

Specialized frame class that embedds a 3D matplotlib figure with one subplot into a Tkinter frame.

C_TYPE = 'SciUI 3D Subplot'
C_AX_RECTANGLE = [0.1, 0.1, 0.85, 0.85]
create_subplot()

Internally used to create a suitable subplot. New subplot needs to be bound to self.ax. To be redefined.

class mlpro.bf.ui.sciui.framework.SciUIFrameParam(p_shared_db: SciUISharedDB, p_row, p_col, p_title=None, p_width_perc=0.0, p_height_perc=0.0, p_visible=False, p_padx=5, p_pady=0, p_sticky='NW', p_logging=True)

Bases: SciUIFrame

Class for parameter/text frames.

C_TYPE = 'SciUI Parameter Frame'
C_NAME = ''
C_FONT_FAMILY = 'Lucida Grande'
C_FONT_SIZE = 10
init_component()

Initialization of component-specific elements at instance creation time. To be redefined.

class mlpro.bf.ui.sciui.framework.SciUIScenario(p_shared_db: SciUISharedDB, p_logging=True)

Bases: SciUIFrame

Top level class for an entire SciUI scenario that can be registered by the SciUI application class. SciUI scenarios are visible and chooseable if the switches C_RELEASED and C_VISIBLE are set to True.

C_TYPE = 'SciUI Scenario'
C_NAME = '????'
C_VERSION = '0.0.0'
C_RELEASED = False
C_VISIBLE = False