프로젝트

일반

사용자정보

개정판 d92b873c

IDd92b873c85bedd51842121fb82fe3dba651c6dce
상위 87d85415
하위 53099302

함의성이(가) 약 5년 전에 추가함

issue #506: add copy horizontal button

Change-Id: I088846ed3f5ae0045a8035e70a259fb5028baf04

차이점 보기:

DTI_PID/DTI_PID/OcrResultDialog.py
79 79

  
80 80
        self.ui.counterClockPushButton_2.clicked.connect(lambda: self.rotateImage(True))
81 81
        self.ui.clockPushButton_2.clicked.connect(lambda: self.rotateImage(False))
82
        self.ui.pushButtonCopyHori.clicked.connect(self.copy_horizontal)
82 83
        # add shortcut for detecting text with 't'
83 84
        self.ui.redetectPushButton.clicked.connect(self.detect_text)
84 85
        shortcut = QShortcut(QKeySequence('t'), self.ui.redetectPushButton)
......
338 339
        self.textInfoList = None
339 340
        QDialog.reject(self)
340 341

  
342
    def copy_horizontal(self):
343
        import io, csv
344

  
345
        try:
346
            table = [[text for text in self.ui.detectResultTextEdit.toPlainText().split('\n')]]
347
            stream = io.StringIO()
348
            csv.writer(stream, delimiter='\t').writerows(table)
349
            QApplication.clipboard().setText(stream.getvalue())
350

  
351
        except Exception as ex:
352
            from App import App 
353
            from AppDocData import MessageType
354

  
355
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
356
            App.mainWnd().addMessage.emit(MessageType.Error, message)
357

  
341 358
    '''
342 359
        @brief  Display this QDialog
343 360
    '''
DTI_PID/DTI_PID/OcrResultDialog_UI.py
1 1
# -*- coding: utf-8 -*-
2 2

  
3
# Form implementation generated from reading ui file '.\UI\OcrResultDialog.ui'
3
# Form implementation generated from reading ui file './UI/OcrResultDialog.ui'
4 4
#
5
# Created by: PyQt5 UI code generator 5.14.1
5
# Created by: PyQt5 UI code generator 5.11.3
6 6
#
7 7
# WARNING! All changes made in this file will be lost!
8 8

  
9

  
10 9
from PyQt5 import QtCore, QtGui, QtWidgets
11 10

  
12

  
13 11
class Ui_Dialog(object):
14 12
    def setupUi(self, Dialog):
15 13
        Dialog.setObjectName("Dialog")
......
109 107
        self.detectResultLabel_2.setFont(font)
110 108
        self.detectResultLabel_2.setObjectName("detectResultLabel_2")
111 109
        self.horizontalLayout_3.addWidget(self.detectResultLabel_2)
110
        self.pushButtonCopyHori = QtWidgets.QPushButton(self.bottomWidget)
111
        self.pushButtonCopyHori.setObjectName("pushButtonCopyHori")
112
        self.horizontalLayout_3.addWidget(self.pushButtonCopyHori)
112 113
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
113 114
        self.horizontalLayout_3.addItem(spacerItem1)
114 115
        self.checkBoxSeperate = QtWidgets.QCheckBox(self.bottomWidget)
......
152 153
        self.targetTextLabel_2.setText(_translate("Dialog", "Recognition Object"))
153 154
        self.label.setText(_translate("Dialog", "OCR Source : "))
154 155
        self.detectResultLabel_2.setText(_translate("Dialog", "Recognition Result"))
156
        self.pushButtonCopyHori.setText(_translate("Dialog", "Copy"))
155 157
        self.checkBoxSeperate.setText(_translate("Dialog", "Seperate"))
156 158
        self.pushButtonMakeTrainingImage.setText(_translate("Dialog", "Save OCR Training Image"))
159

  
157 160
import MainWindow_rc
161

  
162
if __name__ == "__main__":
163
    import sys
164
    app = QtWidgets.QApplication(sys.argv)
165
    Dialog = QtWidgets.QDialog()
166
    ui = Ui_Dialog()
167
    ui.setupUi(Dialog)
168
    Dialog.show()
169
    sys.exit(app.exec_())
170

  
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py
290 290

  
291 291
        self.setColor(self.getColor())
292 292

  
293
        if self.angle == 1.57 or self.angle == 4.71:
294
            rect = QRectF(0, 0, self.size[1], self.size[0])
295
        else:
296
            rect = QRectF(0, 0, self.size[0], self.size[1])
293
        #if self.angle == 1.57 or self.angle == 4.71:
294
        #    rect = QRectF(0, 0, self.size[1], self.size[0])
295
        #else:
296
        #    rect = QRectF(0, 0, self.size[0], self.size[1])
297 297

  
298 298
        painter.setFont(self.font())
299 299
        color = self.defaultTextColor()
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
1872 1872

  
1873 1873
        painter.setClipRect(options.exposedRect)
1874 1874
        QGraphicsSvgItem.paint(self, painter, options, widget)
1875
        '''
1876
        # not used
1875 1877
        for attr in self.attrs:
1876 1878
            if issubclass(type(attr), QEngineeringTextItem):
1877 1879
                color = QEngineeringAbstractItem.HOVER_COLOR if self.hover else (
......
1880 1882
            elif issubclass(type(attr), SymbolSvgItem):
1881 1883
                attr.setColor(self.getColor())
1882 1884
                attr.update()
1885
        '''
1883 1886

  
1884 1887
        if self.isSelected():
1885 1888
            self.drawFocusRect(painter)
DTI_PID/DTI_PID/UI/OcrResultDialog.ui
244 244
              </widget>
245 245
             </item>
246 246
             <item>
247
              <widget class="QPushButton" name="pushButtonCopyHori">
248
               <property name="text">
249
                <string>Copy</string>
250
               </property>
251
              </widget>
252
             </item>
253
             <item>
247 254
              <spacer name="horizontalSpacer">
248 255
               <property name="orientation">
249 256
                <enum>Qt::Horizontal</enum>

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)