Commit 30bd6ac4 authored by dmMaze's avatar dmMaze
Browse files

update shortcuts

parent 59f283a8
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -232,19 +232,14 @@ class TranslateThread(ModuleThread):


class ImgtransThread(QThread):
    finished = Signal(object)
    imgtrans_proj: ProjImgTrans
    textdetect_thread: TextDetectThread = None
    ocr_thread: OCRThread = None
    translate_thread: TranslateThread = None
    inpaint_thread: InpaintThread = None

    finished = Signal(object)
    update_detect_progress = Signal(int)
    update_ocr_progress = Signal(int)
    update_translate_progress = Signal(int)
    update_inpaint_progress = Signal(int)

    exception_occurred = Signal(str, str)

    def __init__(self, 
                 dl_config: DLModuleConfig, 
                 textdetect_thread: TextDetectThread,
@@ -261,7 +256,6 @@ class ImgtransThread(QThread):
        self.job = None
        self.imgtrans_proj: ProjImgTrans = None


    @property
    def textdetector(self) -> TextDetectorBase:
        return self.textdetect_thread.textdetector
+29 −5
Original line number Diff line number Diff line
@@ -279,10 +279,14 @@ class MainWindow(QMainWindow):
                self.dl_manager.run_canvas_inpaint = False

    def setupShortcuts(self):
        shortcutNext = QShortcut(QKeySequence("D"), self)
        shortcutNext = QShortcut(QKeySequence.StandardKey.MoveToNextPage, self)
        shortcutNext.activated.connect(self.shortcutNext)
        shortcutBefore = QShortcut(QKeySequence("A"), self)
        shortcutD = QShortcut(QKeySequence("D"), self)
        shortcutD.activated.connect(self.shortcutNext) 
        shortcutBefore = QShortcut(QKeySequence.StandardKey.MoveToPreviousPage, self)
        shortcutBefore.activated.connect(self.shortcutBefore)
        shortcutA = QShortcut(QKeySequence("A"), self)
        shortcutA.activated.connect(self.shortcutBefore)         
        shortcutTextedit = QShortcut(QKeySequence("T"), self)
        shortcutTextedit.activated.connect(self.shortcutTextedit)
        shortcutTextblock = QShortcut(QKeySequence("W"), self)
@@ -297,8 +301,16 @@ class MainWindow(QMainWindow):
        shortcutCtrlD.activated.connect(self.shortcutCtrlD)
        shortcutSpace = QShortcut(QKeySequence("Space"), self)
        shortcutSpace.activated.connect(self.shortcutSpace)
        shortcutCtrlA = QShortcut(QKeySequence("Ctrl+A"), self)
        shortcutCtrlA.activated.connect(self.shortcutCtrlA)
        shortcutSelectAll = QShortcut(QKeySequence.StandardKey.SelectAll, self)
        shortcutSelectAll.activated.connect(self.shortcutSelectAll)

        # font formatting
        shortcutBold = QShortcut(QKeySequence.StandardKey.Bold, self)
        shortcutBold.activated.connect(self.shortcutBold)
        shortcutItalic = QShortcut(QKeySequence.StandardKey.Italic, self)
        shortcutItalic.activated.connect(self.shortcutItalic)
        shortcutUnderline = QShortcut(QKeySequence.StandardKey.Underline, self)
        shortcutUnderline.activated.connect(self.shortcutUnderline)

    def shortcutNext(self):
        if self.centralStackWidget.currentIndex() == 0:
@@ -337,7 +349,7 @@ class MainWindow(QMainWindow):
                if self.drawingPanel.currentTool == self.drawingPanel.rectTool:
                    self.drawingPanel.rectPanel.delete_btn.click()

    def shortcutCtrlA(self):
    def shortcutSelectAll(self):
        if self.centralStackWidget.currentIndex() == 0:
            if self.textPanel.isVisible():
                self.st_manager.set_blkitems_selection(True)
@@ -348,6 +360,18 @@ class MainWindow(QMainWindow):
                if self.drawingPanel.currentTool == self.drawingPanel.rectTool:
                    self.drawingPanel.rectPanel.inpaint_btn.click()

    def shortcutBold(self):
        if self.textPanel.formatpanel.isVisible():
            self.textPanel.formatpanel.formatBtnGroup.boldBtn.click()

    def shortcutItalic(self):
        if self.textPanel.formatpanel.isVisible():
            self.textPanel.formatpanel.formatBtnGroup.italicBtn.click()

    def shortcutUnderline(self):
        if self.textPanel.formatpanel.isVisible():
            self.textPanel.formatpanel.formatBtnGroup.underlineBtn.click()

    def setPaintMode(self):
        if self.bottomBar.paintChecker.isChecked():
            if self.rightComicTransStackPanel.isHidden():
+5 −0
Original line number Diff line number Diff line
@@ -400,6 +400,11 @@ class SceneTextManager(QObject):
        self.formatpanel.set_textblk_item(None)
        self.txtblkShapeControl.setCursor(Qt.CursorShape.SizeAllCursor)

    def editingTextItem(self) -> TextBlkItem:
        if self.txtblkShapeControl.isVisible() and self.canvas.editing_textblkitem is not None:
            return self.canvas.editing_textblkitem
        return None

    def savePrevBlkItem(self, blkitem: TextBlkItem):
        self.prev_blkitem = blkitem
        self.prev_textCursor = QTextCursor(self.prev_blkitem.textCursor())