applications
python_files.app.mainFrame
- class python_files.app.mainFrame.MainApp(axis_names, title: str = '', wait_ack=True, *args, **kwargs)
Bases:
Tk
- __init__(axis_names, title: str = '', wait_ack=True, *args, **kwargs)
Return a new top level widget on screen SCREENNAME. A new Tcl interpreter will be created. BASENAME will be used for the identification of the profile file (see readprofile). It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME is the name of the widget class.
- absMove()
Disable movement buttons, then execute the absolute movement on model control for all axis. Add callbacks to enable back and update position after the move, and show error window if MissingValue is raised.
- afterMove(var=None, index=None, mode=None)
Enable movement buttons and update current position labels.
- applySettings()
Save and apply current settings selected in setting window to the model setting.
- apply_layout()
- changeStateMovementsButtons(state: str)
Change the state of movement buttons, state can be set as “normal”, “disabled” or “active”.
- closeSettings()
Close setting window and enable back to button to open it again.
- createAbsoluteFrame(master: Widget) Frame
Create the absolute control frame with axis position and speed values inputs and the button to execute the movement.
- createIncrementalFrame(master: Widget) Frame
Create the incremental control frame with axis position and speed values inputs and the buttons frame to execute the movements.
- goZeroAction()
Disable movement buttons, then execute the go to zero movement on model control for all axis. Add callbacks to enable back and update position after the move, and show error window if MissingValue is raised.
- incrMove(sign: str, axis: str)
Disable movement buttons, then execute the incremental movement on model control for a single axis. Add callbacks to enable back and update position after the move, and show error window if MissingValue is raised. Parameters: - sign : “+” or “-”, direction of the movement, - axis : axis on which the move need to be done.
- openSettings()
Create a setting window with the initial data from model setting.
- reset_layout()
- setZeroAction()
Set current position as zero in model control data and update current position.
- stopAction()
Execute stop from model control. Show an error window if MissingValue is raised.
- updateCurrentPosition()
Update current position labels from model control data.
python_files.app.guielements
- class python_files.app.guielements.AxisButtons(master, name)
Bases:
object
- Summary:
Class containing two buttons. One with positive sign as a text, an another with minus.
- Parameters:
name : name of the axis those buttons should control
btnPlus : button for positive direction
btnMinus : button for negative direction
- __init__(master, name)
- config_both(*args, **kwargs)
- class python_files.app.guielements.AxisButtonsFrame(master: Widget, axis_names=None, *args, **kwargs)
Bases:
Frame
- Summary:
Frame containing buttons from 1 axis up to 3. Create and position them.
- Parameters:
btnAxis : list, instances of AxisButton for each axis specified.
- __init__(master: Widget, axis_names=None, *args, **kwargs)
Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.
- apply_layout()
- reset_layout()
- reverseButtons(axis)
- class python_files.app.guielements.AxisFrame(master: Widget, axis_names=None, *args, **kwargs)
Bases:
Frame
- Summary:
Tkinter frame with axis value inputs. Create necessary widgets and apply them a layout for their positions. Additional button to reset inputs.
- Attributes:
axis: list, list of AxisLabeledEntry to have an input for each axis (label,input,unit).
btnReset: button, reset all axis inputs.
- __init__(master: Widget, axis_names=None, *args, **kwargs)
Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.
- apply_layout()
- reset_layout()
- class python_files.app.guielements.AxisLabeledEntry(master: Widget, label: str, unit: str = None, speed: bool = True)
Bases:
object
- Summary:
Bunch of tkinter widgets for axis. Used in AxisFrame class.
- Attributes:
name: axis name
lblAxis: label, title of the axis.
spbAxis: spinbox, input of the axis value.
inpAxis: doublevar, value from the input spbAxis.
lblUnit (optional): label, additional info like unit of the axis value.
spbSpeedAxis: spinbox, input of the axis speed value.
inpSpeedAxis: doublevar, value from the input spbSpeedAxis.
lblSpeedUnit (optional): label, additional info like unit of the axis speed value.
- __init__(master: Widget, label: str, unit: str = None, speed: bool = True)
- checkSpeed()
- checkValue()
- class python_files.app.guielements.ControlFrame(master: Widget, *args, **kwargs)
Bases:
Frame
- Summary:
Frame with navbar buttons to display frames/functionalities. For example to swap from absolute movement to absolute movement.
- __init__(master: Widget, *args, **kwargs)
Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.
- activateContent(button_key, event=None)
- apply_layout()
- reset_layout()
- setContent(frame: Frame, event=None)
- setOptions(options: dict)
- class python_files.app.guielements.ControlGeneralFrame(master, axis_names, *args, **kwargs)
Bases:
Frame
- Summary:
Frame that display axis values, with 3 buttons to do main actions quickly. Contain a button Stop, Set to zero and Go to zero plus labels for axis current values.
- Parameters:
btnStop : button, labeled “Stop movements”, meant to send a stop signal.
btnSetZero : button, labeled “Set as zero”, meant to set current axis values to zero.
btnGoZero : button, labeled “Go to zero”, meant send signals to get the current axis values to zero.
lblNames : list of Label, axis names in front of their current values.
inpAxisValues : dict of axis_names:DoubleVar, inputs containing current axis values.
lblAxisValues : list of Label, labels displaying inpAxisValues values.
callbacks : dict of btnName:list of functions, attribute callbacks to buttons of the frame.
- GOZERO = 'gozero'
- SETZERO = 'setzero'
- STOP = 'stop'
- __init__(master, axis_names, *args, **kwargs)
Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.
- addCallback(target: str, callback)
- apply_layout()
- goZero()
- reset_layout()
- setZero()
- stop()
- class python_files.app.guielements.ScrollableFrame(master, *args, **kwargs)
Bases:
Frame
- __init__(master, *args, **kwargs)
Construct a Ttk Frame with parent master.
STANDARD OPTIONS
class, cursor, style, takefocus
WIDGET-SPECIFIC OPTIONS
borderwidth, relief, padding, width, height
- class python_files.app.guielements.SettingLabeledEntry(master: Widget, label: str, options: dict, unit: str = None)
Bases:
object
- Summary:
Bunch of tkinter widgets with their operations between them. Used in SettingsFrame class.
- Attributes:
options (optional): dict, different preset values displayed by names in a combobox.
lblSetting: label, title of the setting.
entValue: entry, input/display of the setting value. Disabeled if there is a cmbSetting.
inpValue: stringvar, value of the input/display entValue.
- cmbSetting (optional): combobox, input of preset setting values by names from options.
When option selected, set it’s value in inpValue to be displayed in entValue.
lblUnit (optional): label, unit of the setting value.
- __init__(master: Widget, label: str, options: dict, unit: str = None)
- applyOption(event=None)
- setVal(value)
- class python_files.app.guielements.SettingsFrame(master: Widget, options: dict, *args, **kwargs)
Bases:
Frame
- Summary:
Tkinter frame of settings options.
- __init__(master: Widget, options: dict, *args, **kwargs)
Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.
- addApplyCallback(callback)
- apply()
- apply_config(event=None)
- apply_layout()
- reset_layout()
- python_files.app.guielements.checkNumberInput(input: DoubleVar)
Check if an input number like DoubleVar is really a number, and set is as 0 if not recognized. Also return -1 if the input value is not a number.
- python_files.app.guielements.checkPosInput(input: DoubleVar)
Check if an input number like DoubleVar is negative, and remove it’s sign if so. Also return -1 if the input value is a wrong type.
- python_files.app.guielements.searchByName(data: dict, name: str) dict
- python_files.app.guielements.testAxisButtonsFrame()
- python_files.app.guielements.testAxisConstruct()
- python_files.app.guielements.testAxisFrame()
- python_files.app.guielements.testControlFrame()
- python_files.app.guielements.testControlGeneralFrame()
- python_files.app.guielements.testDict()
- python_files.app.guielements.testIconButton()
- python_files.app.guielements.testSettingsFrame()
python_files.otheruses.movemeasure
- class python_files.otheruses.movemeasure.MoveAndMeasure(axis_names: tuple, wait_ack=True)
Bases:
object
Attributes : - axis (tuple) : names of axis ex (‘x’,’y’,’z’). Up to 3 axis supported. - roadmap (list[list[str]]) : 2d list of positions loaded. - move_finished_event (threading.Event) : event when running, wait until set before doing a measurement. - settingsData (dict) : loaded and effective settings.
- __init__(axis_names: tuple, wait_ack=True)
- Parameters:
wait_ack (bool) – (Optional) Wait for an acknowledge message after sending each command.
- loadMoveSet(filepath: str)
Load a list of positions from a csv or xlsx file.
- Parameters:
filepath (str) – absolute path to the csv or xlsx file
- quit()
Close and quit the ModelControl
- run(measurementFunc, speeds: list, *args, **kwargs)
Run a measure after every move. measurementFunc will be called as measurementFunc(position,*args,**kwargs)
- Parameters:
measurementFunc (function) – a callable function without it’s parameters. Meant to be called on each position.
speeds (list[str:int]) – list of speeds for each axis.
*args –
as many parameters without name for the measurementFunc.
**kwargs –
as many parameters with a name for the the measurementFunc.
- saveSettings(platines: dict = None, controller: str = None, port: str = None)
python_files.otheruses.uiconsole
- class python_files.otheruses.uiconsole.UiConsole(axis_names, wait_ack=True)
Bases:
object
- __init__(axis_names, wait_ack=True)
- absMove()
- controllerMenu()
- goHome()
- goZero()
- incrMove()
- inputCmd()
- mainMenu()
- platinesMenu(axis: str)
- portMenu()
- printCurrentPosition()
- printCurrentSettings()
- quit()
- rawCmd()
- saveSettings(platines: dict = None, controller: str = None, port: str = None)
- setHome()
- setZero()
- settingsMenu()
- stop()