How to use qtpyvcp - 10 common examples

To help you get started, we’ve selected a few qtpyvcp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kcjengr / qtpyvcp / video_tests / vtk_test / __init__.py View on Github external
def main(opts=None):

    if opts is None:
        from qtpyvcp.utilities.opt_parser import parse_opts
        opts = parse_opts(vcp_cmd='vtk_test',
                          vcp_name='vtk_test',
                          vcp_version=__version__)

    qtpyvcp.run_vcp(opts, VCP_CONFIG_FILE)
github kcjengr / qtpyvcp / examples / atc_test / atc_test / __init__.py View on Github external
def main(opts=None):

    if opts is None:
        from qtpyvcp.utilities.opt_parser import parse_opts
        opts = parse_opts(vcp_cmd='vtk_tool_table',
                          vcp_name='vtk_tool_table',
                          vcp_version=__version__)

    qtpyvcp.run_vcp(opts, VCP_CONFIG_FILE)
github kcjengr / qtpyvcp / video_tests / vtk_test / __init__.py View on Github external
def main(opts=None):

    if opts is None:
        from qtpyvcp.utilities.opt_parser import parse_opts
        opts = parse_opts(vcp_cmd='vtk_test',
                          vcp_name='vtk_test',
                          vcp_version=__version__)

    qtpyvcp.run_vcp(opts, VCP_CONFIG_FILE)
github kcjengr / qtpyvcp / examples / atc_test / atc_test / __init__.py View on Github external
def main(opts=None):

    if opts is None:
        from qtpyvcp.utilities.opt_parser import parse_opts
        opts = parse_opts(vcp_cmd='vtk_tool_table',
                          vcp_name='vtk_tool_table',
                          vcp_version=__version__)

    qtpyvcp.run_vcp(opts, VCP_CONFIG_FILE)
github kcjengr / qtpyvcp / qtpyvcp / widgets / input_widgets / dro_line_edit.py View on Github external
"""
DROLineEdit
-----------

"""

from qtpy.QtCore import Property
from qtpy.QtWidgets import QLineEdit

from qtpyvcp.widgets.base_widgets.dro_base_widget import DROBaseWidget, Axis, LatheMode
from qtpyvcp.actions.machine_actions import issue_mdi

from qtpyvcp.utilities import logger
LOG = logger.getLogger(__name__)


class DROLineEdit(QLineEdit, DROBaseWidget):
    """DROLineEdit

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

    def __init__(self, parent=None):
        super(DROLineEdit, self).__init__(parent)

        self.returnPressed.connect(self.onReturnPressed)
        self.editingFinished.connect(self.onEditingFinished)

        issue_mdi.bindOk(widget=self)
github kcjengr / qtpyvcp / qtpyvcp / utilities / status.py View on Github external
def _update(self, value):
        self._valueChanged[self.typ].emit(value)
        self._valueChanged[str].emit(self.to_str(value))

    def dataTypes(self):
        return [self.typ.__name__, 'str']



class _Status(QObject):

    stat = STAT

    # Queues
    active_queue = StatusItem('active_queue', int)          # number of motions blending
    queue = StatusItem('queue', int)                        # current size of the trajectory planner queue
    queue_full = StatusItem('queue_full', bool)             # the trajectory planner queue full flag
    queued_mdi_commands = StatusItem('queued_mdi_commands', int)   #

    # Positions
    position = StatusItem('position', tuple)                 # trajectory position
    actual_position = StatusItem('actual_position', tuple)   # current position, in machine units
    joint_position = StatusItem('joint_position', tuple)     # joint commanded positions
    joint_actual_position = StatusItem('joint_actual_position', tuple) # joint actual positions
    dtg = StatusItem('dtg', tuple)                           # DTG per axis, as reported by trajectory planner
    distance_to_go = StatusItem('distance_to_go', float)     # vector DTG, as reported by trajectory planner

    # Velocities
    current_vel = StatusItem('current_vel', float)           # current velocity in user units per second
    velocity = StatusItem('velocity', float)                 # unclear

    # Offsets
github kcjengr / qtpyvcp / qtpyvcp / widgets / dialogs / open_file_dialog.py View on Github external
#!/usr/bin/env python

import os
import sys


from qtpy import QtCore
from qtpy.QtGui import QIcon
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QMessageBox, QFileDialog

from qtpyvcp.utilities import logger
LOG = logger.getLogger(__name__)

from qtpyvcp.core import Info
INFO = Info()

from qtpyvcp.actions.program_actions import load as loadProgram

class _OpenFileDialog(QFileDialog):
    """docstring for OpenFileDialog"""
    def __init__(self, parent=None):
        super(_OpenFileDialog, self).__init__(parent)

        nc_file_dir = INFO.getProgramPrefix()
        nc_file_types = INFO.getQtFilefilter()

        self.setDirectory(nc_file_dir)
        self.setNameFilters(nc_file_types.split(';;'))
github kcjengr / qtpyvcp / qtpyvcp / actions / machine_actions.py View on Github external
command (str) : A valid RS274 gcode command string. Multiple MDI commands
            can be separated with a ``;`` and will be issued sequentially.
        rest (bool, optional): Whether to reset the Task Mode to the state
            the machine was in prior to issuing the MDI command.
    """
    if reset:
        # save the previous mode
        global PREVIOUS_MODE
        PREVIOUS_MODE = STAT.task_mode
        # Force `interp_state` update on next status cycle. This is needed because
        # some commands might take less than `cycle_time` (50ms) to complete,
        # so status would not even notice that the interp_state had changed and the
        # reset mode method would not be called.
        STATUS.old['interp_state'] = -1

    if setTaskMode(linuxcnc.MODE_MDI):
        # issue multiple MDI commands separated by ';'
        for cmd in command.strip().split(';'):
            LOG.info("Issuing MDI command: %s", cmd)
            CMD.mdi(cmd)
    else:
        LOG.error("Failed to issue MDI command: {}".format(command))
github kcjengr / qtpyvcp / qtpyvcp / __main__.py View on Github external
was specified it will be ignored. Useful for overriding
                     a VCP specified in an INI file.
  -h --help          Show this help and exit.
  -v --version       Show version.

Note:
  When specifying QtPyVCP in the INI using [DISPLAY]DISPLAY=qtpyvcp [...]
  the --ini parameter will be passed by the linuxcnc startup script so does
  not need to be specified.

"""

import sys
from qtpyvcp.utilities.opt_parser import parse_opts

opts = parse_opts(__doc__)
# We must import the application after the args have been parsed and the
# environment set up.
from qtpyvcp.application import VCPApplication
app = VCPApplication(opts=opts)
sys.exit(app.exec_())
github kcjengr / qtpyvcp / qtpyvcp / plugins / hal_status.py View on Github external
self.value = self.getValue()
        self.valueChanged[self.type].emit(self.value)

    def setLogChange(self, log_change):
        self.log_change = log_change

    def getLogChange(self):
        return self.log_change

    def convertType(self, value):
        if self.type == bool:
            return value.lower() in ['true', '1']
        return self.type(value)


class HalStatus(DataPlugin):
    """docstring for StatusPoller"""
    def __init__(self):
        super(HalStatus, self).__init__()

        self.cycle_time = 100
        self.linuxcnc_is_alive = False

        self.status_items = {}
        self.pin_dict = {}

        # Create a thread for checking the HAL pins and signals
        self.hal_mutex = threading.Lock()
        self.hal_thread = threading.Thread(target=self.hal_poll_thread)
        self.hal_thread.daemon = True
        self.hal_thread.start()