2020import json
2121from PyQt5 .QtCore import QProcess , QRegExp , QFile , Qt
2222from PyQt5 import QtGui , QtWidgets , uic , QtCore
23- from PyQt5 .QtWidgets import QDialogButtonBox
23+ from PyQt5 .QtWidgets import QDialogButtonBox , QAbstractSlider
2424from qtvcp .widgets .widget_baseclass import _HalWidgetBase
2525from qtvcp .core import Action , Status , Info , Path
2626from qtvcp .widgets .dialogMixin import GeometryMixin
@@ -353,11 +353,6 @@ def buildWidget(self):
353353 l = QtWidgets .QVBoxLayout ()
354354 t = QtWidgets .QTextEdit ('Basic Probe Help' )
355355 t .setReadOnly (True )
356- try :
357- self .next (t )
358- except Exception as e :
359- t .setText ('Basic Probe Help file Unavailable:\n \n {}' .format (e ))
360-
361356 l .addWidget (t )
362357
363358 buttons = QDialogButtonBox ()
@@ -377,7 +372,19 @@ def buildWidget(self):
377372 previousbutton .setIcon (QtGui .QIcon (':/qt-project.org/styles/commonstyle/images/left-32.png' ))
378373 previousbutton .clicked .connect (lambda : self .next (t ,False ))
379374
375+ self .pageStepUpbutton = QtWidgets .QPushButton ()
376+ self .pageStepUpbutton .setIconSize (QtCore .QSize (38 , 38 ))
377+ self .pageStepUpbutton .setIcon (QtGui .QIcon (':/qt-project.org/styles/commonstyle/images/up-32.png' ))
378+ self .pageStepUpbutton .clicked .connect (lambda : self .pageStep (t ,False ))
379+
380+ self .pageStepDwnbutton = QtWidgets .QPushButton ()
381+ self .pageStepDwnbutton .setIconSize (QtCore .QSize (38 , 38 ))
382+ self .pageStepDwnbutton .setIcon (QtGui .QIcon (':/qt-project.org/styles/commonstyle/images/down-32.png' ))
383+ self .pageStepDwnbutton .clicked .connect (lambda : self .pageStep (t ,True ))
384+
380385 bBox = QDialogButtonBox (buttons )
386+ bBox .addButton (self .pageStepUpbutton , QDialogButtonBox .ActionRole )
387+ bBox .addButton (self .pageStepDwnbutton , QDialogButtonBox .ActionRole )
381388 bBox .addButton (previousbutton , QDialogButtonBox .ActionRole )
382389 bBox .addButton (nextbutton , QDialogButtonBox .ActionRole )
383390 bBox .addButton (closebutton , QDialogButtonBox .DestructiveRole )
@@ -386,6 +393,11 @@ def buildWidget(self):
386393 l .addWidget (bBox )
387394 self .setLayout (l )
388395
396+ try :
397+ self .next (t )
398+ except Exception as e :
399+ t .setText ('Basic Probe Help file Unavailable:\n \n {}' .format (e ))
400+
389401 def next (self ,t ,direction = None ):
390402 if direction is None :
391403 self .currentHelpPage = 0
@@ -405,6 +417,14 @@ def next(self,t,direction=None):
405417 html = str (html , encoding = 'utf8' )
406418 html = html .replace ("../images/widgets/" ,"{}/widgets/" .format (INFO .IMAGE_PATH ))
407419 t .setHtml (html )
420+ if t .verticalScrollBar ().isVisible ():
421+ t .verticalScrollBar ().setPageStep (100 )
422+ self .pageStepDwnbutton .show ()
423+ self .pageStepUpbutton .show ()
424+ else :
425+ self .pageStepDwnbutton .hide ()
426+ self .pageStepUpbutton .hide ()
427+
408428 except Exception as e :
409429 t .setHtml ('''
410430<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>
@@ -414,6 +434,12 @@ def next(self,t,direction=None):
414434 return
415435 self .show ()
416436
437+ def pageStep (self , t , state ):
438+ if state :
439+ t .verticalScrollBar ().triggerAction (QAbstractSlider .SliderPageStepAdd )
440+ else :
441+ t .verticalScrollBar ().triggerAction (QAbstractSlider .SliderPageStepSub )
442+
417443 # accept button applies presets and if line number given starts linuxcnc
418444 def close (self ):
419445 self .record_geometry ()
0 commit comments