This commit is contained in:
恍兮惚兮 2024-09-24 20:13:53 +08:00
parent cba64e3ee6
commit c1cad12cd9
3 changed files with 18 additions and 7 deletions

View File

@ -315,7 +315,6 @@ class showocrimage(saveposwindow):
gobject.baseobject.textgetmethod(text, False)
def __init__(self, parent, cached):
self.img1 = None
self.originimage = None
super().__init__(parent, poslist=globalconfig["showocrgeo"])
self.setWindowIcon(qtawesome.icon("fa.picture-o"))
@ -330,17 +329,30 @@ class showocrimage(saveposwindow):
hb = QHBoxLayout()
hb.addWidget(icon)
hb.addWidget(button)
self.dial = QSpinBox(self)
self.dial.setRange(0, 359)
self.dial.setWrapping(True)
self.dial.valueChanged.connect(self.onValueChanged)
self.dial.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
hb.addWidget(self.dial)
self.layout1.addLayout(hb)
self.layout1.addWidget(self.originlabel)
self.setimage.connect(self.setimagefunction)
if cached:
self.setimagefunction(cached)
def onValueChanged(self, value):
transform = QTransform()
transform.rotate(value)
rotated_image = self.originimage.transformed(transform)
self.originlabel.showpixmap(QPixmap.fromImage(rotated_image))
def retest(self):
if self.originimage is None:
return
text, infotype = ocr_run(self.originimage)
transform = QTransform()
transform.rotate(self.dial.value())
text, infotype = ocr_run(self.originimage.transformed(transform))
if infotype:
gobject.baseobject.displayinfomessage(text, infotype)
else:
@ -348,8 +360,7 @@ class showocrimage(saveposwindow):
def setimagefunction(self, originimage):
self.originimage = originimage
self.img1 = QPixmap.fromImage(originimage)
self.originlabel.showpixmap(self.img1)
self.originlabel.showpixmap(QPixmap.fromImage(originimage))
def getocrgrid(self):

View File

@ -1,7 +1,7 @@
try:
from PyQt5 import QtSvg
from PyQt5.QtWidgets import QFrame,QListView,QCheckBox,QAbstractItemView,QTextEdit,QTableView,QHeaderView,QColorDialog,QSpinBox,QDoubleSpinBox,QComboBox,QDialogButtonBox,QMainWindow,QMessageBox,QDialog,QGridLayout,QTextBrowser,QGraphicsDropShadowEffect,QWidget,QSizePolicy,QScrollArea,QApplication,QPushButton,QSystemTrayIcon,QPlainTextEdit,QAction,QMenu,QFileDialog,QKeySequenceEdit,QLabel,QSpacerItem,QWidgetItem,QLayout,QTextBrowser,QLineEdit,QFormLayout,QSizePolicy,QTabWidget,QTabBar,QSplitter,QListWidget,QListWidgetItem,QHBoxLayout,QVBoxLayout,QSizeGrip,QFontComboBox,QProgressBar,QRadioButton,QButtonGroup,QSlider,QToolTip,QGroupBox,QGraphicsOpacityEffect,QStackedWidget,QStyledItemDelegate,QStyleOptionViewItem,QFontDialog
from PyQt5.QtGui import QIconEngine,QIntValidator,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent,QWheelEvent,QPaintEvent,QTextLayout, QTextOption,QDragEnterEvent, QDropEvent
from PyQt5.QtGui import QIconEngine,QIntValidator,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent,QWheelEvent,QPaintEvent,QTextLayout, QTextOption,QDragEnterEvent, QDropEvent,QTransform
from PyQt5.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex,QTimer,QRectF,QVariantAnimation,QUrl,QPropertyAnimation,QLocale,QSignalBlocker
isqt5 = True
class LineHeightTypes:

View File

@ -29,7 +29,7 @@ include(generate_product_version)
set(VERSION_MAJOR 5)
set(VERSION_MINOR 38)
set(VERSION_PATCH 11)
set(VERSION_PATCH 12)
add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h)