Dialogs

class qtpyvcp.widgets.dialogs.base_dialog.BaseDialog(parent=None, ui_file=None, title=None, modal=None, popup=None, frameless=None, stay_on_top=None)[source]

Base Dialog

Base QtPyVCP dialog class.

This is intended to be used as a base class for custom dialogs, as well as a provider for use in YAML config files. This allows loading custom dialogs from .ui files without needing to write any python code.

You can launch dialogs using a Dialog Button or from a window menu item.

Example

YAML config for loading a custom dialog called my_dialog from a .ui file named my_diloag.ui located in the same dir as the .yml file:

dialogs:
  my_dialog:
    provider: qtpyvcp.widgets.dialogs.base_dialog:BaseDialog
    kwargs:
      ui_file: {{ file.dir }}/my_dialog.ui
      title: My Dialog Title    # optional, set the dialog title
      modal: false              # optional, whether the dialog is modal
      popup: false              # optional, whether the dialog is a popup
      frameless: false          # optional, whether the dialog is frameless
      stay_on_top: true         # optional, whether the dialog stays on top
Parameters:
  • parent (QWidget, optional) – The dialog’s parent window, or None.

  • ui_file (str, optional) – The path of a .ui file to load the dialog from. The ui base widget should be a QDialog.

  • title (str, optional) – The title to use for the dialog. This will override any title property set in QtDesigner.

  • modal (bool, optional) – Whether the dialog should be application modal. This will override any modality hints set in QtDesigner.

  • frameless (bool, optional) – Whether the window has a frame or not. If the window does not have a frame you will need some way to close it, like an Ok or Cancel button.

  • popup – (bool, optional) : Makes the dialog use a frame less window that automatically hides when it looses focus.

  • stay_on_top (bool, optional) – Sets the stay on top hint window flag. This overrides any window flags set in QtDesiger.

loadUiFile(ui_file)[source]

Load dialog from a .ui file.

The .ui file base class should be a QDialog.

Parameters:

ui_file (str) – path to the .ui file to load.

setWindowFlag(flag, on)[source]

BackPort QWidget.setWindowFlag() implementation from Qt 5.9

This method was introduced in Qt 5.9 so is not present in Qt 5.7.1 which is standard on Debian 9 (stretch), so add our own implementation.

class qtpyvcp.widgets.dialogs.about_dialog.AboutDialog(*args, **kwargs)[source]
class qtpyvcp.widgets.dialogs.error_dialog.ErrorDialog(exc_info)[source]
class qtpyvcp.widgets.dialogs.offsets_dialog.OffsetsDialog(parent=None)[source]
class qtpyvcp.widgets.dialogs.open_file_dialog.OpenFileDialog(parent=None)[source]

NGC file chooser dialog.

accept(self)[source]
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.dialogs.probesim_dialog.ProbeSim(parent=None)[source]
close(self) bool[source]
class qtpyvcp.widgets.dialogs.toolchange_dialog.ToolChangeDialog(*args, **kwargs)[source]

Tool Change Dialog

Manual tool changing dialog component

This is a qtpyvcp replacement of axis’ hal_manualtoolchange. It uses the same pin names in the same way, but the HAL component they are under is called qtpyvcp_manualtoolchange instead.

Example

Remove any references in .hal to hal_manualtoolchange and remove net tool-change-loop if you have it.

To your main .hal add:

#  ---manual tool change signals---
net tool-change-request    <= iocontrol.0.tool-change
net tool-change-confirmed  => iocontrol.0.tool-changed
net tool-number            <= iocontrol.0.tool-prep-number

#  ---ignore tool prepare requests---
net tool-prepare-loopback   iocontrol.0.tool-prepare      =>  iocontrol.0.tool-prepared

and to you *postgui.hal add:

#  ---manual tool change signals---
net tool-change-request     =>  qtpyvcp_manualtoolchange.change
net tool-change-confirmed   <=  qtpyvcp_manualtoolchange.changed
net tool-number             =>  qtpyvcp_manualtoolchange.number
timerEvent(self, a0: QTimerEvent)[source]
reject(self)[source]
accept(self)[source]