From c1cad12cd98a998112ea8799a49de742f2082631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Tue, 24 Sep 2024 20:13:53 +0800 Subject: [PATCH] ... --- .../gui/setting_textinput_ocr.py | 21 ++++++++++++++----- LunaTranslator/LunaTranslator/qtsymbols.py | 2 +- plugins/CMakeLists.txt | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/setting_textinput_ocr.py b/LunaTranslator/LunaTranslator/gui/setting_textinput_ocr.py index 7f74c0b8..88847e8f 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_textinput_ocr.py +++ b/LunaTranslator/LunaTranslator/gui/setting_textinput_ocr.py @@ -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): diff --git a/LunaTranslator/LunaTranslator/qtsymbols.py b/LunaTranslator/LunaTranslator/qtsymbols.py index fecb30d0..bbfec424 100644 --- a/LunaTranslator/LunaTranslator/qtsymbols.py +++ b/LunaTranslator/LunaTranslator/qtsymbols.py @@ -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: diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 958b6a9d..866a907e 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -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)