80 lines
2.1 KiB
Python
80 lines
2.1 KiB
Python
############################
|
|
# **** IMPORT SECTION **** #
|
|
############################
|
|
import sys
|
|
from qtpy.QtCore import *
|
|
from qtpy.QtGui import *
|
|
from qtpy.QtWidgets import *
|
|
from qtvcp.core import Status
|
|
from qtvcp.lib.qt_vismach import millturn as MILL
|
|
|
|
###########################################
|
|
# **** instantiate libraries section **** #
|
|
###########################################
|
|
STATUS = Status()
|
|
###################################
|
|
# **** HANDLER CLASS SECTION **** #
|
|
###################################
|
|
|
|
class HandlerClass:
|
|
|
|
########################
|
|
# **** INITIALIZE **** #
|
|
########################
|
|
# widgets allows access to widgets from the qtvcp files
|
|
# at this point the widgets and hal pins are not instantiated
|
|
def __init__(self, halcomp,widgets,paths):
|
|
self.w = widgets
|
|
|
|
|
|
##########################################
|
|
# Special Functions called from QTVCP
|
|
##########################################
|
|
|
|
# at this point:
|
|
# the widgets are instantiated.
|
|
# the HAL pins are built but HAL is not set ready
|
|
def initialized__(self):
|
|
self.machine = MILL.Window()
|
|
self.w.mainLayout.addWidget(self.machine)
|
|
|
|
|
|
########################
|
|
# callbacks from STATUS #
|
|
########################
|
|
|
|
#######################
|
|
# callbacks from form #
|
|
#######################
|
|
|
|
#####################
|
|
# general functions #
|
|
#####################
|
|
|
|
#####################
|
|
# KEY BINDING CALLS #
|
|
#####################
|
|
|
|
###########################
|
|
# **** closing event **** #
|
|
###########################
|
|
def closing_cleanup__(self):
|
|
self.machine.cleanup()
|
|
|
|
##############################
|
|
# required class boiler code #
|
|
##############################
|
|
|
|
def __getitem__(self, item):
|
|
return getattr(self, item)
|
|
def __setitem__(self, item, value):
|
|
return setattr(self, item, value)
|
|
|
|
|
|
################################
|
|
# required handler boiler code #
|
|
################################
|
|
|
|
def get_handlers(halcomp,widgets,paths):
|
|
return [HandlerClass(halcomp,widgets,paths)]
|