Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
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)
# directory.
# Links:
# PyDM Project: https://github.com/slaclab/pydm
# PyDM Licence: https://github.com/slaclab/pydm/blob/master/LICENSE.md
""""Utility to handle importing the global stylesheet for QtPyVCP widgets.
"""
import os
from qtpy.QtWidgets import QApplication
# Set up logging
from qtpyvcp.utilities import logger
LOG = logger.getLogger(__name__)
# Fallback global stylesheet if there is no global stylesheet provided via env
# variable or command line parameter
GLOBAL_STYLESHEET = os.path.realpath(
os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'..',
'default_stylesheet.qss'
)
)
__style_data = None
def clear_cache():
"""Clear the cache for stylesheet data"""
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
#
# You should have received a copy of the GNU General Public License
# along with QtPyVCP. If not, see .
import subprocess
from qtpy.QtCore import QTimer
from qtpy.QtWidgets import QPushButton, QVBoxLayout, QCheckBox
from qtpyvcp.widgets.dialogs.base_dialog import BaseDialog
from qtpyvcp.utilities.info import Info
from qtpyvcp.utilities import logger
Log = logger.getLogger(__name__)
class ProbeSim(BaseDialog):
def __init__(self, parent=None):
super(ProbeSim, self).__init__(parent=parent)
self.info = Info()
self.log = Log
self.close_button = QPushButton("Touch")
self.pulse_checkbox = QCheckBox("Pulse")
main_layout = QVBoxLayout()
main_layout.addWidget(self.close_button)
from qtpy.QtCore import Qt, Property, QRectF
from qtpy.QtGui import QColor, QLinearGradient, QPainter, QPen
from qtpy.QtWidgets import QProgressBar, QStyle
from qtpyvcp.widgets import VCPWidget
from qtpyvcp.utilities import logger
LOG = logger.getLogger(__name__)
class LoadMeter(QProgressBar, VCPWidget):
"""docstring for LoadMeter"""
def __init__(self, parent=None):
super(LoadMeter, self).__init__(parent)
self.barGradient = ['0.0, 0, 255, 0',
'0.8, 255, 255, 0',
'1.0, 255, 0, 0',]
self._text_color = QColor(0, 0, 0)
self._border_color = Qt.gray
self._border_radius = 2
self._border_width = 1
def paintEvent(self, event):
"""External Widgets
This module loads custom widgets defined in external packages
so they are available in QtDesigner.
"""
from pkg_resources import iter_entry_points
from qtpyvcp.utilities.logger import getLogger
LOG = getLogger(__name__)
for entry_point in iter_entry_points(group='qtpyvcp.widgets'):
try:
group_name = entry_point.name
mod = entry_point.load()
for name in dir(mod):
if name.startswith('_'):
continue
try:
plugin_cls = getattr(mod, name)
plugin_cls.group_name = group_name
globals()[name] = plugin_cls
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with QtPyVCP. If not, see .
import subprocess
from qtpy.QtCore import QTimer
from qtpy.QtWidgets import QPushButton, QHBoxLayout, QPushButton, QWidget
from qtpyvcp.utilities.info import Info
from qtpyvcp.utilities import logger
Log = logger.getLogger(__name__)
class ProbeSim(QWidget):
def __init__(self, parent=None):
super(ProbeSim, self).__init__(parent=parent)
self.info = Info()
self.log = Log
self.close_button = QPushButton("Touch")
self.close_button.setCheckable(False)
self.close_button.setAutoExclusive(False)
self.pulse_button = QPushButton("Pulse")
self.pulse_button.setCheckable(True)
self.pulse_button.setAutoExclusive(False)
import linuxcnc
# Set up logging
from qtpyvcp.utilities import logger
LOG = logger.getLogger(__name__)
from qtpyvcp.plugins import getPlugin
STATUS = getPlugin('status')
STAT = STATUS.stat
CMD = linuxcnc.command()
#==============================================================================
# Coolent actions
#==============================================================================
class flood:
"""Flood Actions Group"""
@staticmethod
def on():