프로젝트

일반

사용자정보

개정판 52437c65

ID52437c65942a16775f7b429e83155c88302fedc5
상위 5e1d20ad
하위 9496adb3

함의성이(가) 9달 전에 추가함

pdf test

Change-Id: I3337201fe68a5b208b6d3d8ff0e79daa455d6d1e

차이점 보기:

DTI_PID/DTI_PID/ImportTextFromCADDialog.py
1138 1138
            matches = [id2_xml_file for id2_xml_file in id2_xml_files if id2_xml_file.replace(file_name, '').upper() == '.XML']
1139 1139

  
1140 1140
            if not matches:
1141
                path = os.path.join(app_doc_data.getCurrentProject().getTempPath(), file_name + '.xml')
1141
                path = os.path.join(temp_path, file_name + '.xml')
1142 1142
                img = AppDocData.my_imread(file_path=id2_image_file)
1143 1143
                _width = img.shape[1]
1144 1144
                _height = img.shape[0]
DTI_PID/DTI_PID/ImportTextFromPDFDialog.py
89 89
        project = AppDocData.instance().getCurrentProject()
90 90

  
91 91
        temp_path = project.getTempPath()
92
        drawing_path = project.getDrawingFilePath()
92 93
        id2_xml_files = [f for f in os.listdir(temp_path) if os.path.isfile(os.path.join(temp_path, f)) and
93 94
                         (os.path.splitext(f)[1].upper() == '.XML')]
94 95

  
......
99 100
            matches = [id2_xml_file for id2_xml_file in id2_xml_files if id2_xml_file.replace(file_name, '').upper() == '.XML']
100 101
            if matches:
101 102
                try:
103
                    id2_image_file = os.path.join(drawing_path, file_name + '.png')
104
                    img = AppDocData.my_imread(file_path=id2_image_file)
105
                    _width = img.shape[1]
106
                    _height = img.shape[0]
107

  
102 108
                    symbol_areas = []
103 109
                    pdf_xml_path = os.path.join(os.path.dirname(_file), os.path.splitext(os.path.basename(_file))[0] + '.xml')
104 110
                    pdf_xml = parse(pdf_xml_path)
......
139 145
                    for blk_tbl_record in pdf_xml_root.iter('Text'):
140 146
                        position = [float(token) for token in blk_tbl_record.attrib['Position'].split(',')]                    
141 147
    
142
                        rect = self.make_text_box(blk_tbl_record, position)
148
                        rect = self.make_text_box(blk_tbl_record, position, _height)
143 149
                        rects.append(rect)
144 150

  
145 151
                    nodes = self.texts_to_xml(rects, symbol_areas)
......
159 165
                              f"{sys.exc_info()[-1].tb_lineno}"
160 166
                    App.mainWnd().addMessage.emit(MessageType.Error, message)
161 167
    
162
    def make_text_box(self, text_node, position):
168
    def make_text_box(self, text_node, position, height):
163 169
        try:
164
            loc = [self.text_scale[2] + position[0], self.text_scale[3] + position[1]]
170
            loc = [self.text_scale[2] + position[0], self.text_scale[3] + (height - position[1])]
165 171

  
166 172
            text = text_node.text
167 173
            angle = 0#round(float(text_node.attrib['Angle']), 2)
......
344 350
            
345 351
            return nodes
346 352
        except Exception as ex:
347
            message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
348
                    f"{sys.exc_info()[-1].tb_lineno}"
353
            from App import App
349 354

  
350
            print(message)
355
            message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
356
                      f"{sys.exc_info()[-1].tb_lineno}"
357
            App.mainWnd().addMessage.emit(MessageType.Error, message)
351 358

  
352 359
def close(self):
353 360
    QDialog.reject(self)

내보내기 Unified diff

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