Skip to content

Commit

Permalink
修Bug:操作取消 未传递给调用方 (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroi-sora committed Mar 5, 2024
1 parent 4adee15 commit dad6d0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions UmiOCR-data/py_src/tag_pages/ScreenshotOCR.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def __init__(self, *args):

# 对一个imgID进行OCR
def ocrImgID(self, imgID, configDict):
if not imgID or not configDict: # 截图取消
self.recentResult = {"code": 101, "data": ""}
pixmap = PixmapProvider.getPixmap(imgID)
if not pixmap:
e = f'[Error] ScreenshotOCR: imgID "{imgID}" does not exist in the PixmapProvider dict.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ TabPage {
// 截图完毕
function screenshotEnd(clipID) {
popMainWindow()
if(!clipID) {
if(!clipID) { // 截图取消
tabPage.callPy("ocrImgID", undefined, undefined)
return
}
const configDict = configsComp.getValueDict()
Expand All @@ -45,10 +46,12 @@ TabPage {
const res = qmlapp.imageManager.getPaste()
if(res.error) {
qmlapp.popup.simple(qsTr("获取剪贴板异常"), res.error)
tabPage.callPy("ocrImgID", undefined, undefined)
return
}
if(res.text) {
qmlapp.popup.simple(qsTr("剪贴板中为文本"), res.text)
tabPage.callPy("ocrImgID", undefined, undefined)
return
}
qmlapp.tab.showTabPageObj(tabPage) // 切换标签页
Expand Down

0 comments on commit dad6d0e

Please sign in to comment.