How to use the qtpyvcp.utilities.info.Info 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 / actions / machine_actions.py View on Github external
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")
        CMD.state(linuxcnc.STATE_ESTOP)

    @staticmethod
    def reset():
github kcjengr / qtpyvcp / qtpyvcp / widgets / display_widgets / vtk_backplot / vtk_backplot.py View on Github external
# Fix end

from vtk.util.colors import tomato, yellow, mint
from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor

from qtpyvcp.plugins import getPlugin
from qtpyvcp.widgets import VCPWidget
from qtpyvcp.utilities import logger
from qtpyvcp.utilities.info import Info

from base_canon import StatCanon
from base_backplot import BaseBackPlot
from more_itertools import numeric_range

INFO = Info()

LOG = logger.getLogger(__name__)
STATUS = getPlugin('status')
TOOLTABLE = getPlugin('tooltable')
OFFSETTABLE = getPlugin('offsettable')
IN_DESIGNER = os.getenv('DESIGNER', False)
INIFILE = linuxcnc.ini(os.getenv("INI_FILE_NAME"))
MACHINE_UNITS = 2 if INFO.getIsMachineMetric() else 1
LATHE = bool(INIFILE.find("DISPLAY", "LATHE"))

COLOR_MAP = {
    'traverse': (188, 252, 201, 75),
    'arcfeed': (255, 255, 255, 128),
    'feed': (255, 255, 255, 128),
    'dwell': (100, 100, 100, 255),
    'user': (100, 100, 100, 255),
github kcjengr / qtpyvcp / qtpyvcp / widgets / input_widgets / jog_increment.py View on Github external
#   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.
        if parent is None and not standalone:
github kcjengr / qtpyvcp / qtpyvcp / widgets / input_widgets / file_system.py View on Github external
self.model.setFilter(QDir.AllDirs | QDir.NoDotAndDotDot | QDir.AllEntries)

        self.setModel(self.model)

        self.verticalHeader().hide()
        self.horizontalHeader().setStretchLastSection(True)
        self.setAlternatingRowColors(True)
        self.setSelectionBehavior(QAbstractItemView.SelectRows)

        self.selection_model = self.selectionModel()
        self.selection_model.selectionChanged.connect(self.onSelectionChanged)

        # open selected item on double click or enter pressed
        self.activated.connect(self.openSelectedItem)

        self.info = Info()
        self.nc_file_editor = self.info.getEditor()
        self.nc_file_dir = self.info.getProgramPrefix()
        self.nc_file_exts = self.info.getProgramExtentions()

        self.setRootPath(self.nc_file_dir)

        self.model.rootPathChanged.connect(self.onRootPathChanged)
github kcjengr / qtpyvcp / qtpyvcp / plugins / positions.py View on Github external
# format used for imperial units
          imperial_format: "%8.4f"

ToDO:
    Add joint positions.
"""

import math

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

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

# Set up logging
LOG = getLogger(__name__)

MACHINE_COORDS = INFO.getCoordinates()
MACHINE_UNITS = 2 if INFO.getIsMachineMetric() else 1

# Set the conversions used for changing the DRO units
# Only convert linear axes (XYZUVW), use factor of unity for ABC
if MACHINE_UNITS == 2:
    # List of factors for converting from mm to inches
    CONVERSION_FACTORS = [1.0 / 25.4] * 3 + [1] * 3 + [1.0 / 25.4] * 3
else:
    # List of factors for converting from inches to mm
    CONVERSION_FACTORS = [25.4] * 3 + [1] * 3 + [25.4] * 3
github kcjengr / qtpyvcp / qtpyvcp / widgets / input_widgets / file_system.py View on Github external
def __init__(self, parent=None):
        super(RemovableDeviceComboBox, self).__init__(parent)

        self.setSizeAdjustPolicy(QComboBox.AdjustToContents)

        self._file_locations = getPlugin('file_locations')
        self._file_locations.removable_devices.notify(self.onRemovableDevicesChanged)
        self._file_locations.new_device.notify(self.onNewDeviceAdded)

        self.info = Info()
        self._program_prefix = self.info.getProgramPrefix()

        self.currentTextChanged.connect(self.onCurrentTextChanged)

        # initialize device list
        self.onRemovableDevicesChanged(self._file_locations.removable_devices.value)
github kcjengr / qtpyvcp / qtpyvcp / widgets / menus / homing_menu.py View on Github external
"""Homing Menu Provider"""

import linuxcnc
from qtpy.QtWidgets import QMenu, QAction

from qtpyvcp import actions
from qtpyvcp.plugins import getPlugin
from qtpyvcp.utilities.info import Info

INFO = Info()


class HomingMenu(QMenu):
    """Homing Menu Provider

    Args:
        parent (QWidget, optional) : The menus parent. Default to None.
        axes (list, optional) : List of axes for which to show a homing action.
            If not specified the axis letter list from the INI file will be used.

    ToDO:
        Add un-homing actions if the axis is already homed.
    """
    def __init__(self, parent=None, axes=None):
        super(HomingMenu, self).__init__(parent)
github kcjengr / qtpyvcp / qtpyvcp / actions / spindle_actions.py View on Github external
import linuxcnc

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

from qtpyvcp.utilities.info import Info
from qtpyvcp.plugins import getPlugin

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

SPINDLES = range(INFO.spindles())
DEFAULT_SPEED = INFO.defaultSpindleSpeed()

CMD = linuxcnc.command()

from qtpyvcp.actions.base_actions import setTaskMode


def _spindle_exists(spindle):
    if spindle in SPINDLES:
        return True
    return False

def _spindle_ok(speed=None, spindle=0, widget=None):
    if spindle not in SPINDLES:
github kcjengr / qtpyvcp / qtpyvcp / actions / program_actions.py View on Github external
import sys
import linuxcnc
import tempfile

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

from qtpyvcp.utilities.info import Info
from qtpyvcp.plugins import getPlugin

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

from qtpyvcp.actions.base_actions import setTaskMode


#==============================================================================
# Program actions
#==============================================================================

def load(fname, add_to_recents=True):
    setTaskMode(linuxcnc.MODE_AUTO)
    filter_prog = INFO.getFilterProgram(fname)
    if not filter_prog:
        LOG.debug('Loading NC program: %s', fname)
        CMD.program_open(fname.encode('utf-8'))
    else:
github kcjengr / qtpyvcp / qtpyvcp / widgets / form_widgets / main_window.py View on Github external
from qtpy import uic
from qtpy.QtGui import QKeySequence
from qtpy.QtCore import Qt, Slot, QTimer
from qtpy.QtWidgets import QMainWindow, QApplication, QAction, QMessageBox, \
    QMenu, QMenuBar, QLineEdit, QShortcut

import qtpyvcp
from qtpyvcp import actions
from qtpyvcp.utilities import logger
from qtpyvcp.utilities.info import Info
from qtpyvcp.plugins import getPlugin
from qtpyvcp.widgets.dialogs import showDialog as _showDialog
from qtpyvcp.app.launcher import _initialize_object_from_dict

LOG = logger.getLogger(__name__)
INFO = Info()


class VCPMainWindow(QMainWindow):

    def __init__(self, parent=None, opts=None, ui_file=None, stylesheet=None,
                 maximize=False, fullscreen=False, position=None, size=None,
                 confirm_exit=True, title=None, menu='default'):

        super(VCPMainWindow, self).__init__(parent)

        if opts is None:
            opts = qtpyvcp.OPTIONS

        self.setWindowTitle(title)

        self.app = QApplication.instance()