def __init__(self, opts, vcp_file=None): super(VCPApplication, self).__init__(opts.command_line_args or []) qApp = QApplication.instance() from QtPyVCP.core import Status, Action, Prefs, Info self.info = Info() self.prefs = Prefs() self.status = Status() self.action = Action() if opts.theme is not None: self.setStyle(QStyleFactory.create(opts.theme)) if opts.stylesheet is not None: self.loadStylesheet(opts.stylesheet) self.window = self.loadVCPMainWindow(opts, vcp_file) if self.window is not None: self.window.show() # Performance monitoring if opts.perfmon: import psutil self.perf = psutil.Process() self.perf_timer = QTimer() self.perf_timer.setInterval(2000) self.perf_timer.timeout.connect(self.logPerformance) self.perf_timer.start() self.aboutToQuit.connect(self.status.onShutdown)
# 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 <http://www.gnu.org/licenses/>. # Description: # Generic button for calling a NGCGUI style subroutines. Useful for probing # quill-up, go home, goto etc functionality. import os import re from PyQt5.QtWidgets import QPushButton, qApp from PyQt5.QtCore import Qt, QEvent, pyqtSlot, pyqtProperty from QtPyVCP.core import Info INFO = Info() from QtPyVCP.actions.machine_actions import issue_mdi from QtPyVCP.utilities import logger LOG = logger.getLogger(__name__) # input: #<param_name> = #1 (=0.125 comment) # result: [("param_name", "1", "0.125", "comment")] # if a group is not present it will be an empty string PARSE_POSITIONAL_ARGS = re.compile( r' *# *<([a-z0-9_-]+)> *= *#([0-9]+) *(?:\(= *([0-9.+-]+[0-9.]*?|) *(.*)\))?', re.I) SUBROUTINE_PATH = INFO.getSubroutinePath()