Skip to content

Commit 6ac0ef7

Browse files
committed
qtvcp -probe_basic: switch to html help files
Easier to update and stylize
1 parent 84dd9ca commit 6ac0ef7

11 files changed

Lines changed: 131 additions & 536 deletions

File tree

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')
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+
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 6</span> </h1>
3+
<center><img src="../images/widgets/basic_probe_help/z_clearance" width="500"/></center>
4+
5+
6+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
2+
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
3+
p, li { white-space: pre-wrap; }
4+
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
5+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt; font-weight:600;">Basic Probe Help 7 - Example</span></p>
6+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:20pt; font-weight:600;"><br /></p>
7+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="/home/chris/emc/share/qtvcp/images/widgets/basic_probe_icons/inside_back_right_corner.png" /></p>
8+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
9+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">Demo of inside corner probing using the top right button in Basic Probe (</span><span style=" font-size:14pt; font-weight:600;">back_right_inside</span><span style=" font-size:14pt;">).</span></p>
10+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">While all probe entries must be correct, the most important settings to change for each probe sequence:</span></p>
11+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
12+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">* </span><span style=" font-size:14pt; font-weight:600;">XY CLEARANCE</span><span style=" font-size:14pt;"> -distance away from edge before rough probing</span></p>
13+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">* </span><span style=" font-size:14pt; font-weight:600;">Z CLEARANCE</span><span style=" font-size:14pt;"> -distance from probe to top of material</span></p>
14+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">* </span><span style=" font-size:14pt; font-weight:600;">EXTRA DEPTH</span><span style=" font-size:14pt;"> -distance to lower probe from top of material</span></p>
15+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">* </span><span style=" font-size:14pt; font-weight:600;">EDGE WIDTH</span><span style=" font-size:14pt;"> -distance along edge wall (away from corner) to start probing.</span></p>
16+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
17+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">[NOTE]</span></p>
18+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">These distance are always to be set in 'machine units' (mm for metric machine, inch for imprial machine)</span></p>
19+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
20+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Preset:</span></p>
21+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
22+
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">manual set probe at the intersection of the edges (ie corner) of material as described by the green bullseye on the button. Set it Z CLEARANCE above the top of material. These can be done by eye.</li></ul>
23+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
24+
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">set EXTRA CLEARANCE to a value that you want the probe to go below the _top_ of material.(So the probe will move from it's start position down Z Clearance + Extra Clearance distance)</li></ul>
25+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
26+
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> set XY CLEARANCE to a value that definitely gives clearance from the wall so when the probe goes down it doesn't hit anything.</li>
27+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
28+
<li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">set EDGE WIDTH to a value that describes the distance measured from the corner, along the wall to where you wish to probe. This edge distance will be used along the X wall and then the Y wall.</li></ul>
29+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
30+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Sequence after pressing the probe button</span><span style=" font-size:14pt;">: </span></p>
31+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
32+
<ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">rapid EDGE WIDTH distance away from corner at the same time moving XY CLEARANCE away from edge. So this is a slightly diagonal move.</li>
33+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
34+
<li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">move probe down by Z CLEARANCE + EXTRA DEPTH</li>
35+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
36+
<li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">probe wall twice (rough and fine)</li>
37+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
38+
<li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">move diagonally to the other wall as set by EDGE WIDTH and XY CLEARANCE</li>
39+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
40+
<li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">probe wall twice (rough and fine)</li>
41+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
42+
<li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">raise probe up by Z CLEARANCE + EXTRA DEPTH (returns to starting height)</li>
43+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
44+
<li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">rapid back to starting corner, now calculated using the probed walls</li>
45+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
46+
<li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> if auto zero button is enabled, set X and Y of the current user system to zero.</li></ol>
47+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
48+
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p></body></html>

0 commit comments

Comments
 (0)