개정판 d20c56f1
issue #1061 : 심볼생성
Change-Id: I7debc220bb2f7621dbe36411df3f84e763583c50
HYTOS/HYTOS/AppDocData.py | ||
---|---|---|
216 | 216 |
conn.close() |
217 | 217 |
return isUpdated |
218 | 218 |
|
219 |
def getTemplateSymbol(self, UID): |
|
220 |
symbolList = [] |
|
221 |
|
|
222 |
conn = sqlite3.connect(self.getTemplateDbPath()) |
|
223 |
with conn: |
|
224 |
cursor = conn.cursor() |
|
225 |
sql = 'SELECT UID, Name, OriginalPoint, ConnectionPoint FROM Symbols Where UID = ? ORDER BY Name' |
|
226 |
|
|
227 |
try: |
|
228 |
param = (UID,) |
|
229 |
cursor.execute(sql, param) |
|
230 |
rows = cursor.fetchall() |
|
231 |
for row in rows: |
|
232 |
symbolList.append((row[0], row[1], row[2], row[3])) |
|
233 |
except Exception as ex: |
|
234 |
from App import App |
|
235 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
236 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
237 |
|
|
238 |
return symbolList |
|
219 | 239 |
|
220 | 240 |
def getTemplateSymbolNameList(self, typeUID): |
221 | 241 |
symbolCategoryList = [] |
... | ... | |
223 | 243 |
conn = sqlite3.connect(self.getTemplateDbPath()) |
224 | 244 |
with conn: |
225 | 245 |
cursor = conn.cursor() |
226 |
sql = 'SELECT UID, Name, OriginalPoint, ConnectionPoint FROM Symbols Where SymbolType_UID = ? ORDER BY Name'
|
|
246 |
sql = 'SELECT UID, Name FROM Symbols Where SymbolType_UID = ? ORDER BY Name' |
|
227 | 247 |
|
228 | 248 |
try: |
229 | 249 |
param = (typeUID,) |
230 | 250 |
cursor.execute(sql, param) |
231 | 251 |
rows = cursor.fetchall() |
232 | 252 |
for row in rows: |
233 |
symbolCategoryList.append((row[0], row[1], row[2], row[3]))
|
|
253 |
symbolCategoryList.append((row[0], row[1])) |
|
234 | 254 |
except Exception as ex: |
235 | 255 |
from App import App |
236 | 256 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
HYTOS/HYTOS/SymbolEditorDialog.py | ||
---|---|---|
155 | 155 |
self.initSymbolNameComboBoxItems(typeUID) |
156 | 156 |
|
157 | 157 |
def onNameChanged(self, index): |
158 |
self.selectedSymbol = self.ui.nameComboBox.itemData(index) |
|
158 |
from AppDocData import AppDocData |
|
159 |
uid = self.ui.nameComboBox.itemData(index) |
|
160 |
|
|
161 |
self.selectedSymbol = AppDocData.instance().getTemplateSymbol(uid) |
|
159 | 162 |
|
160 | 163 |
self.setImage() |
161 | 164 |
self.initContents() |
... | ... | |
221 | 224 |
nameList = AppDocData.instance().getTemplateSymbolNameList(typeUID) |
222 | 225 |
|
223 | 226 |
for name in nameList: |
224 |
self.ui.nameComboBox.addItem(name[1], name) |
|
227 |
self.ui.nameComboBox.addItem(name[1], name[0])
|
|
225 | 228 |
|
226 | 229 |
if self.ui.nameComboBox.count() > 0: |
227 | 230 |
self.ui.nameComboBox.setCurrentIndex(0) |
... | ... | |
235 | 238 |
''' |
236 | 239 |
def initContents(self): |
237 | 240 |
try: |
238 |
if self.selectedSymbol is not None:
|
|
241 |
if len(self.selectedSymbol) > 0:
|
|
239 | 242 |
|
240 | 243 |
#self.ui.nameLineEdit.setText(self.selectedSymbol.getName()) |
241 | 244 |
#self.ui.typeComboBox.setCurrentIndex(self.ui.typeComboBox.findText(self.selectedSymbol.getType())) |
242 | 245 |
|
243 |
originalPoint = self.selectedSymbol[2] |
|
246 |
originalPoint = self.selectedSymbol[0][2]
|
|
244 | 247 |
self.ui.originalPointLineEdit.setText(originalPoint) |
245 | 248 |
OriginalPointCommand.OriginalPointCommand.drawCircle(self.ui.imageView, originalPoint.split(",")[0], originalPoint.split(",")[1]) |
246 | 249 |
|
247 |
connectionPoint = self.selectedSymbol[3] |
|
250 |
connectionPoint = self.selectedSymbol[0][3]
|
|
248 | 251 |
if connectionPoint is not None and len(connectionPoint) > 0: |
249 | 252 |
splitConnectionPointList = connectionPoint.split("/") |
250 | 253 |
symbol_indecies = [str(idx) for idx in range(1)] |
... | ... | |
436 | 439 |
Change self.dbHelper to AppDocData |
437 | 440 |
2019.07.11 yenjin |
438 | 441 |
''' |
439 |
def accept(self): |
|
440 |
uid = self.selectedSymbol[0] |
|
442 |
def accept(self): |
|
443 |
if len(self.selectedSymbol) > 0: |
|
444 |
uid = self.selectedSymbol[0][0] |
|
441 | 445 |
|
442 |
originalPoint = self.ui.originalPointLineEdit.text() |
|
443 |
connectionPoint = self.makeConnectionPointListString() |
|
446 |
originalPoint = self.ui.originalPointLineEdit.text()
|
|
447 |
connectionPoint = self.makeConnectionPointListString()
|
|
444 | 448 |
|
445 |
isSuccess = AppDocData.instance().updateTemplateSymbol(uid, originalPoint, connectionPoint) |
|
446 |
if isSuccess: |
|
447 |
QMessageBox.information(self, self.tr("Notice"), self.tr("Save completed successfully.")) |
|
448 |
|
|
449 |
isSuccess = AppDocData.instance().updateTemplateSymbol(uid, originalPoint, connectionPoint)
|
|
450 |
if isSuccess:
|
|
451 |
QMessageBox.information(self, self.tr("Notice"), self.tr("Save completed successfully."))
|
|
452 |
|
|
449 | 453 |
|
450 | 454 |
#QDialog.accept(self) |
451 | 455 |
|
내보내기 Unified diff