프로젝트

일반

사용자정보

개정판 ff3d1c7a

IDff3d1c7ac9d5c44d368e3849a8a1cc6f06076ea7
상위 599b9bc1
하위 9e64682b

김정우 이(가) 6년 이상 전에 추가함

심볼 추가 생성 시 QDirTreeWidget 갱신을 위해 CreateSymbolCommand에 Parameter 추가

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
118 118
                sql = "SELECT * FROM Symbol WHERE " + fieldName + " = "+ str(data) +""
119 119
            cursor.execute(sql)
120 120
            rows = cursor.fetchall()
121
        except Error as e:
122
            print(e)
121
        # Catch the exception
122
        except Exception as ex:
123
            # Roll back any change if something goes wrong
124
            conn.rollback()
125
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
123 126
        finally:
124 127
            conn.close()
125 128
            if rows is not None and len(rows) > 0:
......
141 144
            sql = "SELECT * FROM Symbol WHERE name = '"+ name +"'"
142 145
            cursor.execute(sql)
143 146
            rows = cursor.fetchall()
144
        except Error as e:
145
            print(e)
147
        # Catch the exception
148
        except Exception as ex:
149
            # Roll back any change if something goes wrong
150
            conn.rollback()
151
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
146 152
        finally:
147 153
            conn.close()
148 154
            if rows is not None and len(rows) > 0:
......
175 181
            cursor.execute(INSERT_SYMBOL_SQL, query)
176 182
            conn.commit()
177 183
            isAdded = True
178
        except Error as e:
179
            print(e)
184
        # Catch the exception
185
        except Exception as ex:
186
            # Roll back any change if something goes wrong
187
            conn.rollback()
188
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
180 189
        finally:
181 190
            conn.close()
182 191
            return (isAdded, symbol.getType(), symbol.getName(), symbol.getPath())
......
210 219
            cursor.execute(UPDATE_SYMBOL_SQL, query)
211 220
            conn.commit()
212 221
            isUpdated = True
213
        except Error as e:
214
            print(e)
222
        # Catch the exception
223
        except Exception as ex:
224
            # Roll back any change if something goes wrong
225
            conn.rollback()
226
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
215 227
        finally:
216 228
            conn.close()
217 229
            return (isUpdated, symbol.getType(), symbol.getName(), symbol.getPath())
DTI_PID/DTI_PID/Commands/CreateSymbolCommand.py
19 19
from SymbolSvgItem import SymbolSvgItem
20 20

  
21 21
class CreateSymbolCommand(AbstractCommand.AbstractCommand):
22
    def __init__(self, imageViewer, resultTreeWidget):
22
    '''
23
        @history    2018.05.04  Jeongwoo    Add Parameter
24
    '''
25
    def __init__(self, imageViewer, resultTreeWidget, dirTreeWidget):
23 26
        super(CreateSymbolCommand, self).__init__(imageViewer)
24 27
        self.name = 'CreateSymbol'
25 28
        self.imageViewer.setCursor(QCursor(Qt.CrossCursor))
26 29
        self.resultTreeWidget = resultTreeWidget
30
        self.dirTreeWidget = dirTreeWidget
27 31
    
28 32
    '''
29 33
        @brief  crop image by rectangle selected by user
30 34
        @history    2018.05.02  Jeongwoo    Init self.offsetX and self.offsetY
31 35
                                            Add QtImageViewer.startPointChanged.emit
32 36
                    2018.05.03  Jeongwoo    Make Svg/Image File Path by SymbolBase.getSvgFileFullePath() and SymbolBase.getImageFileFullPath()
37
                    2018.05.04  Jeongwoo    Add self.dirTreeWidget.initTreeWidget()
33 38
    '''
34 39
    def execute(self, param):
35 40
        event = param[1]
......
47 52
                    croppedImage = self.imageViewer.image().copy(selectionBBox.toAlignedRect())
48 53
                    symbolEditorDialog = QSymbolEditorDialog.QSymbolEditorDialog(self.imageViewer, croppedImage, AppDocData.instance().getCurrentProject())
49 54
                    (isAccepted, isImmediateInsert, offsetX, offsetY, newSym) = symbolEditorDialog.showDialog()
55
                    self.dirTreeWidget.initDirTreeWidget()
50 56
                    if isAccepted:
51 57
                        if isImmediateInsert:
52 58
                            svgPath = newSym.getSvgFileFullPath()
DTI_PID/DTI_PID/MainWindow.py
138 138
        @brief      Create Equipment
139 139
        @author     Jeongwoo
140 140
        @date       18.05.03
141
        @history    2018.05.04  Jeongwoo    Add Parameter on CreateSymbolCommand
141 142
    '''
142 143
    def createEquipment(self):
143 144
        if not self.graphicsView.hasImage():
144 145
            self.showImageSelectionMessageBox()
145 146
            return
146 147
        if self.actionEquipment.isChecked():
147
            self.graphicsView.command = CreateSymbolCommand.CreateSymbolCommand(self.graphicsView, self.resultTreeWidget)
148
            self.graphicsView.command = CreateSymbolCommand.CreateSymbolCommand(self.graphicsView, self.resultTreeWidget, self.dirTreeWidget)
148 149
        else:
149 150
            self.graphicsView.useDefaultCommand()
150 151

  
......
152 153
    '''
153 154
        @brief      Create Nozzle
154 155
        @author     Jeongwoo
155
        @date       18.05.03
156
        @date       2018.05.03
157
        @history    2018.05.04  Jeongwoo    Add Parameter on CreateSymbolCommand
156 158
    '''
157 159
    def createNozzle(self):
158 160
        if not self.graphicsView.hasImage():
159 161
            self.showImageSelectionMessageBox()
160 162
            return
161 163
        if self.actionNozzle.isChecked():
162
            self.graphicsView.command = CreateSymbolCommand.CreateSymbolCommand(self.graphicsView, self.resultTreeWidget)
164
            self.graphicsView.command = CreateSymbolCommand.CreateSymbolCommand(self.graphicsView, self.resultTreeWidget, self.dirTreeWidget)
163 165
        else:
164 166
            self.graphicsView.useDefaultCommand()
165 167

  

내보내기 Unified diff

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