|
|
|
|
@ -24,6 +24,7 @@ from PyQt5.QtCore import Qt, QRect, QEvent |
|
|
|
|
from PyQt5.QtGui import QColor, QPixmap, QImage, QFont, QCursor |
|
|
|
|
from PyQt5.QtGui import QPainter |
|
|
|
|
from PyQt5.QtWidgets import QWidget |
|
|
|
|
from PyQt5.QtWidgets import QToolTip |
|
|
|
|
from core.buffer import Buffer |
|
|
|
|
from core.utils import touch, interactive |
|
|
|
|
import fitz |
|
|
|
|
@ -296,6 +297,8 @@ class PdfViewerWidget(QWidget): |
|
|
|
|
|
|
|
|
|
self.remember_offset = None |
|
|
|
|
|
|
|
|
|
self.last_hover_annot_id = None |
|
|
|
|
|
|
|
|
|
# To avoid 'PDF only' method errors |
|
|
|
|
self.inpdf = True |
|
|
|
|
if os.path.splitext(self.url)[-1] != ".pdf": |
|
|
|
|
@ -1065,6 +1068,14 @@ class PdfViewerWidget(QWidget): |
|
|
|
|
self.page_cache_pixmap_dict.clear() |
|
|
|
|
self.update() |
|
|
|
|
|
|
|
|
|
if current_annot and current_annot.info["content"]: |
|
|
|
|
if current_annot.info["id"] != self.last_hover_annot_id or not QToolTip.isVisible(): |
|
|
|
|
QToolTip.showText(QCursor.pos(), current_annot.info["content"], None, QRect(), 10 * 1000) |
|
|
|
|
self.last_hover_annot_id = current_annot.info["id"] |
|
|
|
|
else: |
|
|
|
|
if QToolTip.isVisible(): |
|
|
|
|
QToolTip.hideText() |
|
|
|
|
|
|
|
|
|
return page, current_annot |
|
|
|
|
|
|
|
|
|
def save_annot(self): |
|
|
|
|
@ -1088,7 +1099,7 @@ class PdfViewerWidget(QWidget): |
|
|
|
|
annot.setInfo(content=annot_text) |
|
|
|
|
annot.update() |
|
|
|
|
self.save_annot() |
|
|
|
|
self.edited_annot = (None, None) |
|
|
|
|
self.edited_page_annot = (None, None) |
|
|
|
|
|
|
|
|
|
def jump_to_page(self, page_num): |
|
|
|
|
self.update_vertical_offset(min(max(self.scale * (int(page_num) - 1) * self.page_height, 0), self.max_scroll_offset())) |
|
|
|
|
|