How to use the qtpyvcp.plugins.getPlugin function in qtpyvcp

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 / qtpyvcp / widgets / base_widgets / dro_base_widget.py View on Github external
def __init__(self):
        super(DROBaseWidget, self).__init__()

        self.status = getPlugin('status')
        self.pos = getPlugin('position')

        self._anum = Axis.X
        self._ref_typ = RefType.Relative
        self._mm_fmt = '%10.3f'
        self._in_fmt = '%9.4f'
        self._deg_fmt = '%10.2f' #'%(deg) %(min)\' %(sec)"'

        self._use_global_fmt_settings = True

        # settings
        self.in_fmt_setting = None
        self.mm_fmt_setting = None
        self.deg_fmt_setting = None

        self._angular_axis = False
github kcjengr / qtpyvcp / qtpyvcp / plugins / api.py View on Github external
def __init__(self):
        super(VcpApi, self).__init__()

        api = falcon.API()

        clock = getPlugin('clock')
        status = getPlugin('status')
        offsets = getPlugin('offsettable')
        positions = getPlugin('position')
        tools = getPlugin('tooltable')

        self.clock = Channel(clock)
        self.status = Channel(status)
        self.offsets = Channel(offsets)
        self.positions = Channel(positions)
        self.tools = Channel(tools)

        api.add_route('/clock', self.clock)
        api.add_route('/status', self.status)
        api.add_route('/offsets', self.offsets)
        api.add_route('/positions', self.positions)
        api.add_route('/tools', self.tools)

        host = "0.0.0.0"
        port = 1337
github kcjengr / qtpyvcp / qtpyvcp / plugins / tool_table.py View on Github external
from itertools import takewhile
from datetime import datetime

import linuxcnc

from qtpy.QtCore import QFileSystemWatcher, QTimer, Signal, Slot

import qtpyvcp
from qtpyvcp.utilities.info import Info
from qtpyvcp.utilities.logger import getLogger
from qtpyvcp.actions.machine_actions import issue_mdi
from qtpyvcp.plugins import DataPlugin, DataChannel, getPlugin

CMD = linuxcnc.command()
LOG = getLogger(__name__)
STATUS = getPlugin('status')
STAT = STATUS.stat
INFO = Info()

IN_DESIGNER = os.getenv('DESIGNER', False)


def merge(a, b):
    """Shallow merge two dictionaries"""
    r = a.copy()
    r.update(b)
    return r


DEFAULT_TOOL = {
    'A': 0.0,
    'B': 0.0,
github kcjengr / qtpyvcp / qtpyvcp / actions / decorators.py View on Github external
# import the interior decorator :)
from functools import wraps

import linuxcnc

from qtpyvcp.lib.decorators import action, ACTIONS
from qtpyvcp.plugins import getPlugin
from qtpyvcp.utilities.logger import getLogger

LOG = getLogger(__name__)

STATUS = getPlugin('status')
STAT = STATUS.stat

MAPPING = {
    'task_state': {
        'on': linuxcnc.STATE_ON,
        'off': linuxcnc.STATE_OFF,
        'estop': linuxcnc.STATE_ESTOP,
        'reset': linuxcnc.STATE_ESTOP_RESET,
        linuxcnc.STATE_ON: 'on',
        linuxcnc.STATE_OFF: 'off',
        linuxcnc.STATE_ESTOP: 'estop',
        linuxcnc.STATE_ESTOP_RESET: 'reset'
        },

    'task_mode': {
        'mdi': linuxcnc.MODE_MDI,
github kcjengr / qtpyvcp / qtpyvcp / widgets / input_widgets / jog_increment.py View on Github external
#   You should have received a copy of the GNU General Public License
#   along with QtPyVCP.  If not, see .

import os

from qtpy.QtGui import QColor
from qtpy.QtCore import Qt, Slot, Property
from qtpy.QtWidgets import QWidget, QBoxLayout, QSizePolicy

from qtpyvcp.utilities.info import Info
from qtpyvcp.actions.machine_actions import jog
from qtpyvcp.plugins import getPlugin
from qtpyvcp.utilities.settings import getSetting, setSetting
from qtpyvcp.widgets.button_widgets.led_button import LEDButton

STATUS = getPlugin('status')
INFO = Info()


class JogIncrementWidget(QWidget):

    def __init__(self, parent=None, standalone=False):
        super(JogIncrementWidget, self).__init__(parent)

        self._container = hBox = QBoxLayout(QBoxLayout.LeftToRight, self)

        hBox.setContentsMargins(0, 0, 0, 0)
        self._ledDiameter = 15
        self._ledColor = QColor('green')
        self._alignment = Qt.AlignTop | Qt.AlignRight
        # This prevents doing unneeded initialization
        # when QtDesginer loads the plugin.
github kcjengr / qtpyvcp / qtpyvcp / widgets / display_widgets / gcode_backplot / gcode_backplot.py View on Github external
import time

from qtpy.QtWidgets import QApplication, QProgressBar, QPushButton, QHBoxLayout, QVBoxLayout

from qtpy.QtCore import Property, Signal, Slot, QTimer
from qtpy.QtGui import QColor

from qtpyvcp.widgets.display_widgets.gcode_backplot.qbackplot import QBackPlot

from qtpyvcp.utilities import logger

LOG = logger.getLogger(__name__)

from qtpyvcp.plugins import getPlugin

STATUS = getPlugin('status')

from qtpyvcp.utilities.info import Info

INFO = Info()


class GcodeBackplot(QBackPlot):
    line_selected = Signal(int)
    gcode_error = Signal(str)

    def __init__(self, parent=None, standalone=False):
        super(GcodeBackplot, self).__init__(parent)

        # This prevents doing unneeded initialization
        # when QtDesginer loads the plugin.
        if parent is None and not standalone:
github kcjengr / qtpyvcp / qtpyvcp / widgets / display_widgets / notification_widget.py View on Github external
def __init__(self, parent=None):
        super(NotificationWidget, self).__init__(parent)
        self.notification_channel = getPlugin("notifications")

        self.main_layout = QVBoxLayout()
        self.button_layout = QHBoxLayout()

        self.all_button = QPushButton()
        self.info_button = QPushButton()
        self.warn_button = QPushButton()
        self.error_button = QPushButton()
        self.debug_button = QPushButton()
        self.clear_button = QPushButton()

        self.all_button.setText("all")
        self.info_button.setText("info")
        self.warn_button.setText("warn")
        self.error_button.setText("error")
        self.debug_button.setText("debug")
github kcjengr / qtpyvcp / qtpyvcp / actions / machine_actions.py View on Github external
import linuxcnc
from qtpy.QtWidgets import QComboBox

from qtpyvcp.utilities.settings import setting

# Set up logging
from qtpyvcp.utilities import logger
LOG = logger.getLogger(__name__)

from qtpyvcp.utilities.settings import getSetting
from qtpyvcp.actions.base_actions import setTaskMode
from qtpyvcp.plugins import getPlugin

POSITION = getPlugin('position')
STATUS = getPlugin('status')
STAT = STATUS.stat

from qtpyvcp.utilities.info import Info
INFO = Info()
CMD = linuxcnc.command()


# -------------------------------------------------------------------------
# E-STOP action
# -------------------------------------------------------------------------
class estop:
    """E-Stop action group"""
    @staticmethod
    def activate():
        """Set E-Stop active"""
        LOG.debug("Setting state red")
github kcjengr / qtpyvcp / qtpyvcp / widgets / input_widgets / mdientry_widget.py View on Github external
"""MDI Entry """

from qtpy.QtWidgets import QLineEdit, QCompleter
from qtpy.QtCore import Qt, QEvent, QStringListModel, Slot
from qtpy.QtGui import QKeySequence, QValidator

from qtpyvcp.plugins import getPlugin

STATUS = getPlugin('status')

from qtpyvcp.core import Info

INFO = Info()

from qtpyvcp.actions.machine_actions import issue_mdi

MDI_HISTORY_FILE = INFO.getMDIHistoryFile()


class Validator(QValidator):
    def validate(self, string, pos):
        # eventually could do some actual validating here
        return QValidator.Acceptable, string.upper(), pos
github kcjengr / qtpyvcp / qtpyvcp / plugins / offset_table.py View on Github external
import os

import linuxcnc

from qtpy.QtCore import QFileSystemWatcher, QTimer, Signal

from qtpyvcp.utilities.info import Info
from qtpyvcp.utilities.logger import getLogger
from qtpyvcp.plugins import DataPlugin, DataChannel, getPlugin

from qtpyvcp.actions.machine_actions import issue_mdi


CMD = linuxcnc.command()
LOG = getLogger(__name__)
STATUS = getPlugin('status')
STAT = STATUS.stat
INFO = Info()


def merge(a, b):
    """Shallow merge two dictionaries"""
    r = a.copy()
    r.update(b)
    return r


class OffsetTable(DataPlugin):
    DEFAULT_OFFSET = {
        0: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
        1: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
        2: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],