Fri, 06 Oct 2023 15:52:33 +0200
Extended the MicroPython code to give an indication, why the connection to a device failed.
<!DOCTYPE html> <html><head> <title>eric7.PdfViewer.PdfView</title> <meta charset="UTF-8"> <link rel="stylesheet" href="styles.css"> </head> <body> <a NAME="top" ID="top"></a> <h1>eric7.PdfViewer.PdfView</h1> <p> Module implementing a specialized PDF view class. </p> <h3>Global Attributes</h3> <table> <tr><td>None</td></tr> </table> <h3>Classes</h3> <table> <tr> <td><a href="#PdfMarker">PdfMarker</a></td> <td>Class defining the data structure for markers.</td> </tr> <tr> <td><a href="#PdfMarkerGeometry">PdfMarkerGeometry</a></td> <td>Class defining the data structure for marker geometries.</td> </tr> <tr> <td><a href="#PdfMarkerType">PdfMarkerType</a></td> <td>Class defining the various marker types.</td> </tr> <tr> <td><a href="#PdfView">PdfView</a></td> <td>Class implementing a specialized PDF view.</td> </tr> </table> <h3>Functions</h3> <table> <tr><td>None</td></tr> </table> <hr /> <hr /> <a NAME="PdfMarker" ID="PdfMarker"></a> <h2>PdfMarker</h2> <p> Class defining the data structure for markers. </p> <h3>Derived from</h3> None <h3>Class Attributes</h3> <table> <tr><td>markerType</td></tr><tr><td>rectangle</td></tr> </table> <h3>Class Methods</h3> <table> <tr><td>None</td></tr> </table> <h3>Methods</h3> <table> <tr><td>None</td></tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> <a NAME="PdfMarkerGeometry" ID="PdfMarkerGeometry"></a> <h2>PdfMarkerGeometry</h2> <p> Class defining the data structure for marker geometries. </p> <h3>Derived from</h3> None <h3>Class Attributes</h3> <table> <tr><td>markerType</td></tr><tr><td>rectangle</td></tr> </table> <h3>Class Methods</h3> <table> <tr><td>None</td></tr> </table> <h3>Methods</h3> <table> <tr><td>None</td></tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> <a NAME="PdfMarkerType" ID="PdfMarkerType"></a> <h2>PdfMarkerType</h2> <p> Class defining the various marker types. </p> <h3>Derived from</h3> enum.Enum <h3>Class Attributes</h3> <table> <tr><td>SEARCHRESULT</td></tr><tr><td>SELECTION</td></tr> </table> <h3>Class Methods</h3> <table> <tr><td>None</td></tr> </table> <h3>Methods</h3> <table> <tr><td>None</td></tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> <a NAME="PdfView" ID="PdfView"></a> <h2>PdfView</h2> <p> Class implementing a specialized PDF view. </p> <h3>Signals</h3> <dl> <dt>selectionAvailable(bool)</dt> <dd> emitted to indicate the availability of a selection </dd> </dl> <h3>Derived from</h3> QPdfView <h3>Class Attributes</h3> <table> <tr><td>MarkerColors</td></tr> </table> <h3>Class Methods</h3> <table> <tr><td>None</td></tr> </table> <h3>Methods</h3> <table> <tr> <td><a href="#PdfView.__init__">PdfView</a></td> <td>Constructor</td> </tr> <tr> <td><a href="#PdfView.__calculateDocumentLayout">__calculateDocumentLayout</a></td> <td>Private slot to calculate the document layout data.</td> </tr> <tr> <td><a href="#PdfView.__calculateDocumentViewport">__calculateDocumentViewport</a></td> <td>Private method to calculate the document viewport.</td> </tr> <tr> <td><a href="#PdfView.__calculateMarkerGeometries">__calculateMarkerGeometries</a></td> <td>Private method to calculate the marker geometries.</td> </tr> <tr> <td><a href="#PdfView.__currentPageChanged">__currentPageChanged</a></td> <td>Private slot to handle a change of the current page.</td> </tr> <tr> <td><a href="#PdfView.__updateView">__updateView</a></td> <td>Private method to update the view.</td> </tr> <tr> <td><a href="#PdfView.__zoomFactorForMode">__zoomFactorForMode</a></td> <td>Private method to calculate the zoom factor iaw.</td> </tr> <tr> <td><a href="#PdfView.__zoomInOut">__zoomInOut</a></td> <td>Private method to zoom into or out of the view.</td> </tr> <tr> <td><a href="#PdfView.addMarker">addMarker</a></td> <td>Public slot to add a marker.</td> </tr> <tr> <td><a href="#PdfView.addSearchMarker">addSearchMarker</a></td> <td>Public slot to add a search marker given a PDF link.</td> </tr> <tr> <td><a href="#PdfView.clearAllMarkers">clearAllMarkers</a></td> <td>Public slot to clear all markers.</td> </tr> <tr> <td><a href="#PdfView.clearMarkers">clearMarkers</a></td> <td>Public slot to clear the markers of a specific type.</td> </tr> <tr> <td><a href="#PdfView.clearSearchMarkers">clearSearchMarkers</a></td> <td>Public slot to clear the search markers.</td> </tr> <tr> <td><a href="#PdfView.clearSelection">clearSelection</a></td> <td>Public slot to clear the current selection.</td> </tr> <tr> <td><a href="#PdfView.event">event</a></td> <td>Public method handling events.</td> </tr> <tr> <td><a href="#PdfView.gestureEvent">gestureEvent</a></td> <td>Protected method handling gesture events.</td> </tr> <tr> <td><a href="#PdfView.getSelection">getSelection</a></td> <td>Public method to get a PDF selection object.</td> </tr> <tr> <td><a href="#PdfView.hasSelection">hasSelection</a></td> <td>Public method to check the presence of a selection.</td> </tr> <tr> <td><a href="#PdfView.keyPressEvent">keyPressEvent</a></td> <td>Protected method handling key press events.</td> </tr> <tr> <td><a href="#PdfView.mouseMoveEvent">mouseMoveEvent</a></td> <td>Protected method to handle mouse move events.</td> </tr> <tr> <td><a href="#PdfView.mousePressEvent">mousePressEvent</a></td> <td>Protected method to handle mouse press events.</td> </tr> <tr> <td><a href="#PdfView.mouseReleaseEvent">mouseReleaseEvent</a></td> <td>Protected method to handle mouse release events.</td> </tr> <tr> <td><a href="#PdfView.paintEvent">paintEvent</a></td> <td>Protected method to paint the view.</td> </tr> <tr> <td><a href="#PdfView.resizeEvent">resizeEvent</a></td> <td>Protected method to handle a widget resize.</td> </tr> <tr> <td><a href="#PdfView.scrollContentsBy">scrollContentsBy</a></td> <td>Public method called when the scrollbars are moved.</td> </tr> <tr> <td><a href="#PdfView.setDocument">setDocument</a></td> <td>Public method to set the PDF document.</td> </tr> <tr> <td><a href="#PdfView.wheelEvent">wheelEvent</a></td> <td>Protected method to handle wheel events.</td> </tr> <tr> <td><a href="#PdfView.zoomIn">zoomIn</a></td> <td>Public slot to zoom into the view.</td> </tr> <tr> <td><a href="#PdfView.zoomOut">zoomOut</a></td> <td>Public slot to zoom out of the view.</td> </tr> <tr> <td><a href="#PdfView.zoomReset">zoomReset</a></td> <td>Public slot to reset the zoom factor of the view.</td> </tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> <a NAME="PdfView.__init__" ID="PdfView.__init__"></a> <h4>PdfView (Constructor)</h4> <b>PdfView</b>(<i>parent</i>) <p> Constructor </p> <dl> <dt><i>parent</i> (QWidget)</dt> <dd> reference to the parent widget </dd> </dl> <a NAME="PdfView.__calculateDocumentLayout" ID="PdfView.__calculateDocumentLayout"></a> <h4>PdfView.__calculateDocumentLayout</h4> <b>__calculateDocumentLayout</b>(<i></i>) <p> Private slot to calculate the document layout data. </p> <p> This is a PyQt implementation of the code found in the QPdfView class because it is calculated in a private part and not accessible. </p> <a NAME="PdfView.__calculateDocumentViewport" ID="PdfView.__calculateDocumentViewport"></a> <h4>PdfView.__calculateDocumentViewport</h4> <b>__calculateDocumentViewport</b>(<i></i>) <p> Private method to calculate the document viewport. </p> <p> This is a PyQt implementation of the code found in the QPdfView class because it is calculated in a private part and not accessible. </p> <a NAME="PdfView.__calculateMarkerGeometries" ID="PdfView.__calculateMarkerGeometries"></a> <h4>PdfView.__calculateMarkerGeometries</h4> <b>__calculateMarkerGeometries</b>(<i>page, offset</i>) <p> Private method to calculate the marker geometries. </p> <dl> <dt><i>page</i> (int)</dt> <dd> page number </dd> <dt><i>offset</i> (QPoint or QPointF)</dt> <dd> page offset </dd> </dl> <a NAME="PdfView.__currentPageChanged" ID="PdfView.__currentPageChanged"></a> <h4>PdfView.__currentPageChanged</h4> <b>__currentPageChanged</b>(<i></i>) <p> Private slot to handle a change of the current page. </p> <a NAME="PdfView.__updateView" ID="PdfView.__updateView"></a> <h4>PdfView.__updateView</h4> <b>__updateView</b>(<i></i>) <p> Private method to update the view. </p> <a NAME="PdfView.__zoomFactorForMode" ID="PdfView.__zoomFactorForMode"></a> <h4>PdfView.__zoomFactorForMode</h4> <b>__zoomFactorForMode</b>(<i>zoomMode</i>) <p> Private method to calculate the zoom factor iaw. the current zoom mode. </p> <dl> <dt><i>zoomMode</i> (QPdfView.ZoomMode)</dt> <dd> zoom mode to get the zoom factor for </dd> </dl> <dl> <dt>Return:</dt> <dd> zoom factor </dd> </dl> <dl> <dt>Return Type:</dt> <dd> float </dd> </dl> <a NAME="PdfView.__zoomInOut" ID="PdfView.__zoomInOut"></a> <h4>PdfView.__zoomInOut</h4> <b>__zoomInOut</b>(<i>zoomIn</i>) <p> Private method to zoom into or out of the view. </p> <dl> <dt><i>zoomIn</i> (bool)</dt> <dd> flag indicating to zoom into the view </dd> </dl> <a NAME="PdfView.addMarker" ID="PdfView.addMarker"></a> <h4>PdfView.addMarker</h4> <b>addMarker</b>(<i>page, rect, markerType</i>) <p> Public slot to add a marker. </p> <dl> <dt><i>page</i> (int)</dt> <dd> page number for the marker </dd> <dt><i>rect</i> (QRect or QRectF)</dt> <dd> marker rectangle </dd> <dt><i>markerType</i> (PdfMarkerType)</dt> <dd> type of the marker </dd> </dl> <a NAME="PdfView.addSearchMarker" ID="PdfView.addSearchMarker"></a> <h4>PdfView.addSearchMarker</h4> <b>addSearchMarker</b>(<i>link</i>) <p> Public slot to add a search marker given a PDF link. </p> <dl> <dt><i>link</i> (QPdfLink)</dt> <dd> reference to the PDF link object </dd> </dl> <a NAME="PdfView.clearAllMarkers" ID="PdfView.clearAllMarkers"></a> <h4>PdfView.clearAllMarkers</h4> <b>clearAllMarkers</b>(<i></i>) <p> Public slot to clear all markers. </p> <a NAME="PdfView.clearMarkers" ID="PdfView.clearMarkers"></a> <h4>PdfView.clearMarkers</h4> <b>clearMarkers</b>(<i>markerType</i>) <p> Public slot to clear the markers of a specific type. </p> <dl> <dt><i>markerType</i> (PdfMarkerType)</dt> <dd> type of the marker </dd> </dl> <a NAME="PdfView.clearSearchMarkers" ID="PdfView.clearSearchMarkers"></a> <h4>PdfView.clearSearchMarkers</h4> <b>clearSearchMarkers</b>(<i></i>) <p> Public slot to clear the search markers. </p> <a NAME="PdfView.clearSelection" ID="PdfView.clearSelection"></a> <h4>PdfView.clearSelection</h4> <b>clearSelection</b>(<i></i>) <p> Public slot to clear the current selection. </p> <a NAME="PdfView.event" ID="PdfView.event"></a> <h4>PdfView.event</h4> <b>event</b>(<i>evt</i>) <p> Public method handling events. </p> <dl> <dt><i>evt</i> (QEvent)</dt> <dd> reference to the event </dd> </dl> <dl> <dt>Return:</dt> <dd> flag indicating, if the event was handled </dd> </dl> <dl> <dt>Return Type:</dt> <dd> bool </dd> </dl> <a NAME="PdfView.gestureEvent" ID="PdfView.gestureEvent"></a> <h4>PdfView.gestureEvent</h4> <b>gestureEvent</b>(<i>evt</i>) <p> Protected method handling gesture events. </p> <dl> <dt><i>evt</i> (QGestureEvent)</dt> <dd> reference to the gesture event </dd> </dl> <a NAME="PdfView.getSelection" ID="PdfView.getSelection"></a> <h4>PdfView.getSelection</h4> <b>getSelection</b>(<i></i>) <p> Public method to get a PDF selection object. </p> <dl> <dt>Return:</dt> <dd> reference to the PDF selection object </dd> </dl> <dl> <dt>Return Type:</dt> <dd> QPdfSelection </dd> </dl> <a NAME="PdfView.hasSelection" ID="PdfView.hasSelection"></a> <h4>PdfView.hasSelection</h4> <b>hasSelection</b>(<i></i>) <p> Public method to check the presence of a selection. </p> <dl> <dt>Return:</dt> <dd> flag indicating the presence of a selection </dd> </dl> <dl> <dt>Return Type:</dt> <dd> bool </dd> </dl> <a NAME="PdfView.keyPressEvent" ID="PdfView.keyPressEvent"></a> <h4>PdfView.keyPressEvent</h4> <b>keyPressEvent</b>(<i>evt</i>) <p> Protected method handling key press events. </p> <dl> <dt><i>evt</i> (QKeyEvent)</dt> <dd> reference to the key event </dd> </dl> <a NAME="PdfView.mouseMoveEvent" ID="PdfView.mouseMoveEvent"></a> <h4>PdfView.mouseMoveEvent</h4> <b>mouseMoveEvent</b>(<i>evt</i>) <p> Protected method to handle mouse move events. </p> <dl> <dt><i>evt</i> (QMouseEvent)</dt> <dd> reference to the mouse event </dd> </dl> <a NAME="PdfView.mousePressEvent" ID="PdfView.mousePressEvent"></a> <h4>PdfView.mousePressEvent</h4> <b>mousePressEvent</b>(<i>evt</i>) <p> Protected method to handle mouse press events. </p> <dl> <dt><i>evt</i> (QMouseEvent)</dt> <dd> reference to the mouse event </dd> </dl> <a NAME="PdfView.mouseReleaseEvent" ID="PdfView.mouseReleaseEvent"></a> <h4>PdfView.mouseReleaseEvent</h4> <b>mouseReleaseEvent</b>(<i>evt</i>) <p> Protected method to handle mouse release events. </p> <dl> <dt><i>evt</i> (QMouseEvent)</dt> <dd> reference to the mouse event </dd> </dl> <a NAME="PdfView.paintEvent" ID="PdfView.paintEvent"></a> <h4>PdfView.paintEvent</h4> <b>paintEvent</b>(<i>evt</i>) <p> Protected method to paint the view. </p> <p> This event handler calls the original paint event handler of the super class and paints the markers on top of the result. </p> <dl> <dt><i>evt</i> (QPaintEvent)</dt> <dd> reference to the paint event </dd> </dl> <a NAME="PdfView.resizeEvent" ID="PdfView.resizeEvent"></a> <h4>PdfView.resizeEvent</h4> <b>resizeEvent</b>(<i>evt</i>) <p> Protected method to handle a widget resize. </p> <dl> <dt><i>evt</i> (QResizeEvent)</dt> <dd> reference to the resize event </dd> </dl> <a NAME="PdfView.scrollContentsBy" ID="PdfView.scrollContentsBy"></a> <h4>PdfView.scrollContentsBy</h4> <b>scrollContentsBy</b>(<i>dx, dy</i>) <p> Public method called when the scrollbars are moved. </p> <dl> <dt><i>dx</i> (int)</dt> <dd> change of the horizontal scroll bar </dd> <dt><i>dy</i> (int)</dt> <dd> change of the vertical scroll bar </dd> </dl> <a NAME="PdfView.setDocument" ID="PdfView.setDocument"></a> <h4>PdfView.setDocument</h4> <b>setDocument</b>(<i>document</i>) <p> Public method to set the PDF document. </p> <dl> <dt><i>document</i> (QPdfDocument)</dt> <dd> reference to the PDF document object </dd> </dl> <a NAME="PdfView.wheelEvent" ID="PdfView.wheelEvent"></a> <h4>PdfView.wheelEvent</h4> <b>wheelEvent</b>(<i>evt</i>) <p> Protected method to handle wheel events. </p> <dl> <dt><i>evt</i> (QWheelEvent)</dt> <dd> reference to the wheel event </dd> </dl> <a NAME="PdfView.zoomIn" ID="PdfView.zoomIn"></a> <h4>PdfView.zoomIn</h4> <b>zoomIn</b>(<i></i>) <p> Public slot to zoom into the view. </p> <a NAME="PdfView.zoomOut" ID="PdfView.zoomOut"></a> <h4>PdfView.zoomOut</h4> <b>zoomOut</b>(<i></i>) <p> Public slot to zoom out of the view. </p> <a NAME="PdfView.zoomReset" ID="PdfView.zoomReset"></a> <h4>PdfView.zoomReset</h4> <b>zoomReset</b>(<i></i>) <p> Public slot to reset the zoom factor of the view. </p> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>