Skip to content

Commit ea19bff

Browse files
committed
Merge branch '2.9'
2 parents a55123c + 6ac0ef7 commit ea19bff

13 files changed

Lines changed: 146 additions & 548 deletions

File tree

lib/python/qtvcp/lib/machine_log.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,21 @@ def __init__(self):
2020
self.mlp = os.path.expanduser(INFO.MACHINE_LOG_HISTORY_PATH)
2121

2222
def log_it(self, w, message, option=None):
23-
message =message.rstrip('\n')
24-
25-
if option == 'TIME':
26-
self.log_message_time(message)
27-
elif option == 'DATE':
28-
self.log_message_date(message)
29-
elif option == 'DELETE':
23+
if option == 'DELETE':
3024
self.delete_log()
31-
elif option == 'INITIAL':
32-
self.initial_greeting()
33-
else:
34-
self.log_message(message)
25+
return
26+
try:
27+
message = message.rstrip('\n')
28+
if option == 'TIME':
29+
self.log_message_time(message)
30+
elif option == 'DATE':
31+
self.log_message_date(message)
32+
elif option == 'INITIAL':
33+
self.initial_greeting()
34+
else:
35+
self.log_message(message)
36+
except Exception as e:
37+
log.exception('log_it function: {}'.format(e))
3538

3639
def initial_greeting(self):
3740
try:

lib/python/qtvcp/widgets/basic_probe.py

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import sys
1919
import os
2020
import json
21-
from PyQt5.QtCore import QProcess, QRegExp
21+
from PyQt5.QtCore import QProcess, QRegExp, QFile
2222
from PyQt5 import QtGui, QtWidgets, uic
2323
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
2424
from qtvcp.core import Action, Status, Info, Path
@@ -36,6 +36,9 @@
3636
SUBPROGRAM = os.path.abspath(os.path.join(current_dir, 'probe_subprog.py'))
3737
CONFIG_DIR = os.getcwd()
3838

39+
# can use/favours local image and help files
40+
HELP = PATH.find_widget_path()
41+
3942
class BasicProbe(QtWidgets.QWidget, _HalWidgetBase):
4043
def __init__(self, parent=None):
4144
super(BasicProbe, self).__init__(parent)
@@ -57,6 +60,10 @@ def __init__(self, parent=None):
5760
self.dialog = uic.loadUi(self.filename)
5861
except AttributeError as e:
5962
LOG.critical(e)
63+
self.helpPages = ['basic_help.html','basic_help1.html','basic_help2.html',
64+
'basic_help3.html','basic_help4.html','basic_help5.html',
65+
'basic_help6.html','basic_help7.html']
66+
self.currentHelpPage = 0
6067

6168
self.probe_list = ["OUTSIDE CORNERS", "INSIDE CORNERS", "EDGE ANGLE", "BOSS and POCKETS",
6269
"RIDGE and VALLEY", "CALIBRATE"]
@@ -244,32 +251,43 @@ def set_statusbar(self, msg, priority = 2):
244251
# Main button handler routines
245252
def probe_help_clicked(self):
246253
self.dialog.show()
254+
self.update_help_page()
247255

248256
def help_close_clicked(self):
249257
self.dialog.hide()
250258

251259
def help_prev_clicked(self):
252-
i = self.dialog.probe_help_widget.currentIndex()
253-
if i > 0:
254-
self.dialog.probe_help_widget.setCurrentIndex(i - 1)
260+
self.currentHelpPage -=1
261+
if self.currentHelpPage < 0:
262+
self.currentHelpPage = 0
263+
self.update_help_page()
255264

256265
def help_next_clicked(self):
257-
i = self.dialog.probe_help_widget.currentIndex()
258-
if i < 5:
259-
self.dialog.probe_help_widget.setCurrentIndex(i + 1)
266+
self.currentHelpPage +=1
267+
if self.currentHelpPage > len(self.helpPages)-1:
268+
self.currentHelpPage = len(self.helpPages)-1
269+
self.update_help_page()
260270

261271
def cmb_probe_select_changed(self, index):
262272
self.stackedWidget_probe_buttons.setCurrentIndex(index)
263273

264-
def probe_help_prev_clicked(self):
265-
i = self.probe_help_widget.currentIndex()
266-
if i > 0:
267-
self.probe_help_widget.setCurrentIndex(i - 1)
268-
269-
def probe_help_next_clicked(self):
270-
i = self.probe_help_widget.currentIndex()
271-
if i < 5:
272-
self.probe_help_widget.setCurrentIndex(i + 1)
274+
def update_help_page(self):
275+
276+
try:
277+
pagePath = os.path.join(HELP, self.helpPages[self.currentHelpPage])
278+
if not os.path.exists(pagePath): raise Exception("Missing File: {}".format(pagePath))
279+
file = QFile(pagePath)
280+
file.open(QFile.ReadOnly)
281+
html = file.readAll()
282+
html = str(html, encoding='utf8')
283+
html = html.replace("../images/widgets/","{}/widgets/".format(INFO.IMAGE_PATH))
284+
self.dialog.html_textEdit.setHtml(html)
285+
except Exception as e:
286+
print(e)
287+
self.dialog.html_textEdit.setHtml('''
288+
<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Basic Probe Help not available</span> </h1>
289+
{}
290+
'''.format(e))
273291

274292
def probe_btn_clicked(self, button):
275293
cmd = button.property('probe')

lib/python/qtvcp/widgets/probe_subprog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@ def collect_status(self):
216216

217217
# need to be in the right mode - entries are in machine units
218218
def prechecks(self):
219+
ACTION.CALL_MDI('M70')
219220
if INFO.MACHINE_IS_METRIC and STATUS.is_metric_mode():
220221
return None
221222
if not INFO.MACHINE_IS_METRIC and not STATUS.is_metric_mode():
222223
return None
223224
# record motion modes
224-
ACTION.CALL_MDI('M70')
225225
if INFO.MACHINE_IS_METRIC:
226226
ACTION.CALL_MDI('g21')
227227
else:
106 KB
Loading
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
2+
<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Basic Probe Help</span> </h1>
3+
<center><img src="../images/widgets/basic_probe_help/basicProbe.png" width="500"/></center>
4+
5+
<H3>Author Acknowledgement</H3>
6+
7+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
2+
<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Basic Probe Help 1</span> </h1>
3+
<center><img src="../images/widgets/basic_probe_help/extra_probe_depth.png" width="500"/></center>
4+
5+
6+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
2+
<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Basic Probe Help 2</span> </h1>
3+
<center><img src="../images/widgets/basic_probe_help/max_xy_distance.png" width="500"/></center>
4+
5+
6+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
2+
<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Basic Probe Help 3</span> </h1>
3+
<center><img src="../images/widgets/basic_probe_help/max_z_distance.png" width="500"/></center>
4+
5+
6+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
2+
<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Basic Probe Help 4</span> </h1>
3+
<center><img src="../images/widgets/basic_probe_help/step_off_width.png" width="500"/></center>
4+
5+
6+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
2+
<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Basic Probe Help 5</span> </h1>
3+
<center><img src="../images/widgets/basic_probe_help/xy_clearance.png" width="500"/></center>
4+
5+
6+

0 commit comments

Comments
 (0)