Input Widgets

class qtpyvcp.widgets.input_widgets.jog_increment.JogIncrementWidget(parent=None, standalone=False)[source]
class qtpyvcp.widgets.input_widgets.file_system.RemovableDeviceComboBox(parent=None)[source]

ComboBox for choosing from a list of removable devices.

class qtpyvcp.widgets.input_widgets.file_system.QtpyVCPQFileSystemModel[source]
class qtpyvcp.widgets.input_widgets.file_system.FileSystemTable(parent=None)[source]
openSelectedItem(index=None)[source]

If ngc file, opens in LinuxCNC, if dir displays dir.

editSelectedFile()[source]

Open the selected file in editor.

loadSelectedFile(index=None)[source]

If ngc file, opens in LinuxCNC, if dir displays dir.

selectPrevious()[source]

Select the previous item in the view.

selectNext()[source]

Select the next item in the view.

rename()[source]

renames the selected file or folder

newFile()[source]

Create a new empty file

deleteItem()[source]

Delete the selected item (either a file or folder).

setRootPath(root_path)[source]

Sets the currently displayed path.

viewParentDirectory()[source]

View the parent directory of the current view.

getSelection()[source]

Returns list of selected indexes, or None.

hiddenColumns = <PySide6.QtCore.Property object>
fixedNameColumn = <PySide6.QtCore.Property object>
nameColumnsWidth = <PySide6.QtCore.Property object>
class qtpyvcp.widgets.input_widgets.mdientry_widget.Validator[source]
class qtpyvcp.widgets.input_widgets.mdientry_widget.MDIEntry(parent=None)[source]

MDI Entry

Input any valid g Code. Enter sends the g Code.

initialize()[source]

This method is called right before the main application starts.

terminate()[source]

This method is called right before the main application ends.

class qtpyvcp.widgets.input_widgets.action_slider.ActionSlider(parent=None)[source]

docstring for ActionSlider.

actionName = <PySide6.QtCore.Property object>
class qtpyvcp.widgets.input_widgets.offset_table.ItemDelegate(columns)[source]
class qtpyvcp.widgets.input_widgets.offset_table.OffsetModel(parent=None)[source]
allColumns()[source]

Every column this machine is configured for (OFFSET_COLUMNS), regardless of current visibility – the toggle menu’s universe.

class qtpyvcp.widgets.input_widgets.offset_table.OffsetTable(parent=None)[source]
deleteSelectedOffset()[source]

Delete the currently selected item

clearOffsetTable(confirm=True)[source]

Remove all items from the model

selectedRow()[source]

Returns the row number of the currently selected row, or 0

DROLineEdit

class qtpyvcp.widgets.input_widgets.dro_line_edit.DROLineEdit[source]

DRO that supports typing in desired position to set work coordinate offset.

updateValue(pos=None)[source]

Update the displayed position.

class qtpyvcp.widgets.input_widgets.action_dial.ActionDial(parent=None)[source]

docstring for ActionDial.

actionName = <PySide6.QtCore.Property object>
class qtpyvcp.widgets.input_widgets.recent_file_combobox.RecentFileComboBox(parent=None)[source]
class qtpyvcp.widgets.input_widgets.tool_table.ItemDelegate(columns)[source]
class qtpyvcp.widgets.input_widgets.tool_table.ToolModel(parent=None)[source]
toolDataFromRow(row)[source]

Returns dictionary of tool data

class qtpyvcp.widgets.input_widgets.tool_table.ToolTable(parent=None)[source]
deleteSelectedTool()[source]

Delete the currently selected item

selectPrevious()[source]

Select the previous item in the view.

selectNext()[source]

Select the next item in the view.

clearToolTable(confirm=True)[source]

Remove all items from the model

addTool()[source]

Appends a new item to the model

loadSelectedTool()[source]

Loads the currently selected tool

selectedRow()[source]

Returns the row number of the currently selected row, or 0

class qtpyvcp.widgets.input_widgets.tool_table_editor.ToolTableEditor(parent=None)[source]

Tool Table Editor

Edits the tool table: the standard LinuxCNC columns, plus your own custom columns when the tool database is used. For a lathe or a mill use LatheToolTable or MillToolTable, which add that machine’s columns.

Works with either tooltable data plugin:

  • qtpyvcp.plugins.tool_table:ToolTable – the classic .tbl file, standard columns only.

  • qtpyvcp.plugins.db_tool_table:DBToolTable – the tool database, which adds the machine columns and custom columns.

Connect buttons to these slots in Qt Designer. The first seven are the same slots as the ToolTable widget, so either widget can be used with the same connections.

Slot

What it does

addTool()

Adds a tool numbered after the highest one

deleteSelectedTool()

Deletes the selected tool

saveToolTable()

Saves all changes and loads the table into LinuxCNC

loadToolTable()

Reloads the table, discarding unsaved changes

clearToolTable()

Deletes every tool

loadSelectedTool()

Loads the selected tool with T<n> M6

selectPrevious()

Selects the tool above

selectNext()

Selects the tool below

renumberSelectedTool()

Changes the selected tool’s number

duplicateSelectedTool()

Copies the selected tool to the first free number

showAddColumnDialog()

Adds a custom column, tool database only

Set confirmActions to ask before saving, reloading, deleting and clearing. The signal toolSelected(int) gives the tool number when a row is clicked, and dirtyChanged(bool) reports whether there are unsaved changes.

In the table:

  • Right-click a column header to show or hide columns, show them all, or go back to the default set. With the tool database the choice is remembered, and custom columns can be added and removed there too.

  • Right-click a cell to duplicate the tool, or to copy the names that read that value from G-code or a widget rule.

  • Double-click a tool number, in the T column or the row header, to renumber the tool.

  • The tool in the spindle is marked with currentToolColor and currentToolBackground.

  • Every column is locked while a program is running.

class qtpyvcp.widgets.input_widgets.lathe_tool_table.LatheToolTable(parent=None)[source]

Lathe Tool Table

The tool table editor, ToolTableEditor, with the lathe columns of the tool database: tool type, insert shape and size, holder, hand, threading values, spindle direction and more.

It needs the DBToolTable plugin serving the lathe columns, which is its default. In the VCP’s YAML config:

data_plugins:
  tooltable:
    provider: qtpyvcp.plugins.db_tool_table:DBToolTable
    kwargs:
      extras: lathe

If the plugin serves another machine’s columns instead, the lathe columns are hidden and an error is logged. The standard and custom columns still work.

  • Type, Hand, Tip Type and Spindle Dir are pick-lists of the values the database accepts.

  • Insert Shape and Holder offer the choices that fit the tool’s type, and accept other values too.

  • Size Mode is filled in from Type and Insert Shape.

  • On grooving and parting tools, Insert Size shows the groove width.

  • Columns nothing reads back, such as Notes and Holder OAL, are hidden by default. Show them from the column header menu.

class qtpyvcp.widgets.input_widgets.mill_tool_table.MillToolTable(parent=None)[source]

Mill Tool Table

The tool table editor, ToolTableEditor, with the mill column of the tool database, ATC: whether the tool fits in the automatic tool changer. Every tool starts ticked. Untick oversize tools, so a tool change macro can use it to ask for a manual change instead.

It needs the DBToolTable plugin serving the mill columns. In the VCP’s YAML config:

data_plugins:
  tooltable:
    provider: qtpyvcp.plugins.db_tool_table:DBToolTable
    kwargs:
      extras: mill

The Remark column is shown last, after ATC.

GcodeTextEdit

QTextEdit based G-code editor with syntax highlighting.

class qtpyvcp.widgets.input_widgets.gcode_text_edit.ColumnFormatterDelegate(parent=None, alignment=None, margin=None, padding=None, formatter=None, text_padding=None)[source]

Flexible delegate for column formatting with configurable alignment, padding, and text formatting.

displayText(value, locale)[source]

Format the display text using the custom formatter if provided.

initStyleOption(option, index)[source]

Set the alignment and padding for this column.

sizeHint(option, index)[source]

Return size hint including margin and padding.

qtpyvcp.widgets.input_widgets.gcode_text_edit.format_date(value, locale)[source]

Format dates as MM/DD/YY HH:MM AM/PM

qtpyvcp.widgets.input_widgets.gcode_text_edit.format_size(value, locale)[source]

Format file sizes with two-letter abbreviations.

class qtpyvcp.widgets.input_widgets.gcode_text_edit.GcodeSyntaxHighlighter(document, font)[source]
highlightBlock(text)[source]

Apply syntax highlighting to the given block of text.

class qtpyvcp.widgets.input_widgets.gcode_text_edit.GcodeTextEdit(parent=None)[source]

G-code Text Edit

QTextEdit based G-code editor with syntax heightening.

findNext(text, case_sensitive=False, whole_words=False, use_regex=False, wrap=True)[source]

Find next occurrence of text. Returns True if found, False otherwise.

findPrevious(text, case_sensitive=False, whole_words=False, use_regex=False, wrap=True)[source]

Find previous occurrence of text. Returns True if found, False otherwise.

replaceCurrent(search_text, replace_text, case_sensitive=False, whole_words=False, use_regex=False)[source]

Replace the currently selected text if it matches the search text. Returns True if replaced, False otherwise.

replaceCurrentWithUndo(search_text, replace_text, case_sensitive=False, whole_words=False, use_regex=False)[source]

Replace the current selection and return undo data for that replacement. Returns a dict with position and text info, or None if no replacement.

replaceAllWithUndo(search_text, replace_text, case_sensitive=False, whole_words=False, use_regex=False)[source]

Replace all occurrences and return undo data for those replacements. Returns a list of dicts with position and text info.

getMatchCount(text, case_sensitive=False, whole_words=False, use_regex=False)[source]

Count the total number of matches in the document.

getCurrentMatchIndex(text, case_sensitive=False, whole_words=False, use_regex=False)[source]

Get the index of the current match (1-based). Returns 0 if no current selection or selection doesn’t match.

highlightAllMatches(text, case_sensitive=False, whole_words=False, use_regex=False, highlight_current=True)[source]

Highlight all matches in the document, with an optional distinct highlight for the current match.

clearHighlights()[source]

Clear all search highlights.

findAll()[source]

Find all occurrences - UI compatibility method.

findForward()[source]

Alias for findForwardText to maintain compatibility with UI files.

replace()[source]

Alias for replaceText to maintain compatibility with UI files.

replaceAll()[source]

Alias for replaceAllText to maintain compatibility with UI files.

syntaxHighlightingOnOff(state)[source]

Toggle syntax highlighting on/off

EditorReadOnly(state)[source]

Set to Read Only to disable editing

EditorReadWrite(state)[source]

Set to Read Only to disable editing

class qtpyvcp.widgets.input_widgets.gcode_text_edit.NumberMargin(parent)[source]
class qtpyvcp.widgets.input_widgets.gcode_editor.GcodeLexer(parent=None, standalone=False)[source]
class qtpyvcp.widgets.input_widgets.gcode_editor.EditorBase(parent=None)[source]
find_text_occurences(text)[source]

Return byte positions of start and end of all ‘text’ occurences in the document

class qtpyvcp.widgets.input_widgets.gcode_editor.GcodeEditor(parent=None)[source]
backgroundcolor = <PySide6.QtCore.Property object>
marginbackgroundcolor = <PySide6.QtCore.Property object>
class qtpyvcp.widgets.input_widgets.gcode_editor.FindReplaceDialog(parent)[source]

QtPyVCP MDI History Widget

This widget implements the following key elements: [1] A history display of MDI commands issued with the latest command at the top of the list and the oldest at the bottom of the list.

[2] A queue system of commands that have been entered but have not yet been executed. This allows the rapid entry of MDI commands to be executed without having to wait for any running commands to complete.

class qtpyvcp.widgets.input_widgets.mdihistory_widget.MDIHistory(parent=None)[source]

MDI History and Queuing Widget.

This widget implements a visual view of the MDI command history. It also implements a command queuing startegy so that commands can be entered and queued up for execution. Visual style is used to identify items that have been completed, are running and are yet to run.

mdiEntrylineName = <PySide6.QtCore.Property object>
mdiListOrderNatural = <PySide6.QtCore.Property object>
toggleQueue(toggle)[source]

Toggle queue pause. Starting point is the queue is active.

clearQueue()[source]

Clear queue items pending run state for items yet to be run.

removeSelectedItem()[source]

Remove the selected lines

removeAll()[source]

Remove all items from list and from history

runFromSelection()[source]

Start running MDI from the selected row back to correct end.

runSelection()[source]

Run the selected row only.

submit()[source]

Put a new command on the queue for later execution.

rowClicked()[source]

Item row clicked.

keyPressEvent(event)[source]

Key movement processing. Arrow keys move the selected list item up/down Return key generates a submit situation by making the item as the next available command to processes.

setHistory(items_list)[source]

Clear and reset the history in the list. item_list is a list of strings.

heartBeat()[source]

Supports heart beat on the MDI History execution queue. Issue the next command from the queue. Double check machine is in ok state to accept next command. Issue the command and if success mark command as being active. Mark last command as done.

initialize()[source]

Load up starting data and set signal connections.

terminate()[source]

Teardown processing.

Line Edit

class qtpyvcp.widgets.input_widgets.line_edit.VCPLineEdit(parent=None)[source]

VCP Entry Widget

highPrecisionStorage = <PySide6.QtCore.Property object>
displayDecimals = <PySide6.QtCore.Property object>
setValue(value)[source]

Set the value - high precision if enabled, otherwise as text

value()[source]

Return the stored value - high precision if enabled, otherwise current text value

actionName = <PySide6.QtCore.Property object>
initialize()[source]

This method is called right before the main application starts.

terminate()[source]

This method is called right before the main application ends.

class qtpyvcp.widgets.input_widgets.var_line_edit.VCPVarLineEdit(parent=None)[source]

Var Parameter Line Edit

A number entry that reads and writes a LinuxCNC numbered parameter, such as #3014, so the value is stored in the var file.

A value typed in is written when editing finishes, on Enter, Tab or leaving the field, as the MDI command #<varParameterNumber> = <value> to 6 decimal places, the precision the var file stores. Text set any other way, for example by a widget rule, is written writeDelay ms later.

At startup, and whenever the var file changes, the field shows the parameter’s value. It is not overwritten while the field has focus, or when a widget rule sets its Text.

Setup:

  • Set varParameterNumber in Qt Designer. Nothing is read or written while it is 0.

  • The var file is found automatically from [RS274NGC] PARAMETER_FILE in the INI.

  • displayDecimals sets how many decimals are shown, 4 by default and 6 at most. The value is always stored to 6.

Safety:

  • With requireHomed on, the default, the field is disabled unless the machine is on, homed and idle. This is checked at startup and whenever homing changes, and a write is refused unless the machine is in that state.

getParameterFilePath()[source]

Get the automatically detected parameter file path

getConfigurationInfo()[source]

Get debugging information about the current configuration.

Returns:

Configuration information including paths and settings

Return type:

dict

varParameterNumber = <PySide6.QtCore.Property object>
autoWriteEnabled = <PySide6.QtCore.Property object>
writeDelay = <PySide6.QtCore.Property object>
displayDecimals = <PySide6.QtCore.Property object>
requireHomed = <PySide6.QtCore.Property object>
setEnabled(enabled)[source]

Override setEnabled to track original state and respect safety requirements

formatValue(value)[source]

Format value for display using displayDecimals setting

setValue(value)[source]

Set the value with 6-decimal internal storage and formatted display

value()[source]

Return the stored 6-decimal precision value

setDisplayValue(value)[source]

Set display value with consistent formatting using displayDecimals

onEditingFinished()[source]

Handle user editing with 6-decimal precision storage and display formatting

writeToLinuxCNC(force=False)[source]

Public method to manually trigger writing to LinuxCNC parameters.

Parameters:

force (bool) – If True, write immediately without delay

readParameterFromVarFile(parameter_number=None)[source]

Read a parameter value directly from the var file.

Parameters:

parameter_number (int) – Parameter number to read. If None, uses self._var_parameter_number

Returns:

The parameter value with 6-decimal precision, or None if not found

Return type:

float or None

loadParameterValue()[source]

Load the parameter value from the var file into the widget

onReturnPressed()[source]

Override return-press behavior and let editingFinished perform commit

initialize()[source]

Initialize the widget - called by VCP system

terminate()[source]

Cleanup when widget is destroyed

class qtpyvcp.widgets.input_widgets.action_combobox.ActionComboBox(parent=None)[source]

General purpose combobox for triggering QtPyVCP actions.

Parameters:

parent (QWidget) – The parent widget of the combobox, or None.

_action_name

The fully qualified name of the action the combobox triggers when the selection is changed.

Type:

str

actionName = <PySide6.QtCore.Property object>
class qtpyvcp.widgets.input_widgets.setting_slider.VCPAbstractSettingsWidget(parent=None)[source]
class qtpyvcp.widgets.input_widgets.setting_slider.VCPSettingsLineEdit(parent)[source]

Settings LineEdit

settingTypeMode = <PySide6.QtCore.Property object>
highPrecisionStorage = <PySide6.QtCore.Property object>
displayDecimals = <PySide6.QtCore.Property object>
value()[source]

Return the current value normalized to the setting type.

clearValue()[source]

Clear field while committing the new value through setting channels.

This is intended for Qt Designer signal-slot connections that need a no-argument slot. For numeric settings, it writes zero (instead of an empty string) so downstream consumers do not keep stale values.

onSettingChanged(value)[source]

Apply an external setting change to the widget.

Refreshes the high-precision internal cache BEFORE updating the display – setSetting()-driven restores (e.g. loading a stored operation back into a page) must be reflected by value(), not just by the visible text, otherwise value() keeps returning whatever was last typed into the field even though the field displays the restored number. normalizeValue() is lossless for in-range floats, so the setting’s value is safe to adopt as the new full-precision cache.

initialize()[source]

This method is called right before the main application starts.

class qtpyvcp.widgets.input_widgets.setting_slider.VCPSettingsSlider(parent)[source]

Settings Slider

Set action options like:

machine.jog.linear-speed
initialize()[source]

This method is called right before the main application starts.

class qtpyvcp.widgets.input_widgets.setting_slider.VCPSettingsSpinBox(parent)[source]

Settings SpinBox

initialize()[source]

This method is called right before the main application starts.

class qtpyvcp.widgets.input_widgets.setting_slider.VCPSettingsDoubleSpinBox(parent)[source]

Settings DoubleSpinBox

initialize()[source]

This method is called right before the main application starts.

class qtpyvcp.widgets.input_widgets.setting_slider.VCPSettingsCheckBox(parent)[source]

Settings CheckBox

initialize()[source]

This method is called right before the main application starts.

class qtpyvcp.widgets.input_widgets.setting_slider.VCPSettingsPushButton(parent)[source]

Settings PushButton with configurable output type and fail-fast validation

outputAsInt = <PySide6.QtCore.Property object>
value()[source]

Return the current checked state as boolean or integer based on outputAsInt property

setValue(value)[source]

Set the checked state from a boolean, integer, or compatible value with fail-fast validation

text()[source]

Return string representation of value for parameter collection

getSettingsValue()[source]

Get value for settings persistence using configured output type

setSettingsValue(value)[source]

Set value from settings persistence

initialize()[source]

This method is called right before the main application starts.

class qtpyvcp.widgets.input_widgets.setting_slider.VCPSettingsComboBox(parent)[source]

Settings ComboBox

initialize()[source]

This method is called right before the main application starts.