개정판 29392b1a
issue #1171: fix text angle and linno saving on going and error msg can copy
Change-Id: Ia22f5637710a01e76ed483c991268bea1f1e98f6
DTI_PID/DTI_PID/ExceptionHandler.py | ||
---|---|---|
27 | 27 |
self.logger.critical(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) |
28 | 28 |
|
29 | 29 |
def handler(self, exctype, value, traceback): |
30 |
""" log exception, file namd and line number """
|
|
30 |
""" log exception, file name and line number """
|
|
31 | 31 |
from App import App |
32 | 32 |
from AppDocData import MessageType |
33 | 33 |
|
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
669 | 669 |
current = QDateTime.currentDateTime() |
670 | 670 |
|
671 | 671 |
item = QListWidgetItem('{}: {}'.format(current.toString('hh:mm:ss'), message)) |
672 |
item.setFlags(item.flags() | Qt.ItemIsEditable) |
|
672 | 673 |
if messageType == MessageType.Error: |
673 | 674 |
item.setBackground(Qt.red) |
674 | 675 |
|
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
623 | 623 |
cols = ['UID', 'Drawings_UID', 'Symbol_UID', 'X', 'Y', 'Width', 'Height', 'Rotation', 'Value', 'Connected'] |
624 | 624 |
rect = self.sceneBoundingRect() |
625 | 625 |
values = ['?', '?', "(select UID from Symbol where Name='Line NO' and SymbolType_UID=-1)", '?', '?', '?', '?', '?', '?', '?'] |
626 |
params = [(str(self.uid), str(app_doc_data.activeDrawing.UID), str(rect.x()), str(rect.y()), str(rect.width()), str(rect.height()), str(self.angle),\
|
|
626 |
params = [(str(self.uid), str(app_doc_data.activeDrawing.UID), rect.x(), rect.y(), rect.width(), rect.height(), str(self.angle),\
|
|
627 | 627 |
self.text(),\ |
628 | 628 |
str(self.conns[0]) if self.conns else None)] |
629 | 629 |
sql = 'insert into Components({}) values({})'.format(','.join(cols), ','.join(values)) |
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
363 | 363 |
rect = None |
364 | 364 |
lineCount = self.text().count('\n') if self.text().count('\n') is not 0 else 1 |
365 | 365 |
transform = QTransform() |
366 |
if (1.57 == self.angle) or (4.71 == self.angle): |
|
366 |
|
|
367 |
allowed_error = 0.001 |
|
368 |
if abs(self.angle - 1.57) < allowed_error or abs(self.angle - 4.71) < allowed_error: |
|
367 | 369 |
font = QFont(fontName, width if fontSize == -1 else fontSize) |
368 | 370 |
|
369 | 371 |
x_factor = width / QFontMetricsF(font).height() |
... | ... | |
381 | 383 |
transform.scale(1, sy) |
382 | 384 |
transform.rotateRadians(-self.angle) |
383 | 385 |
transform.translate(-rect.width()*0.5, -rect.height()*0.5) |
384 |
elif 3.14 == self.angle:
|
|
386 |
elif abs(self.angle - 3.14) < allowed_error:
|
|
385 | 387 |
font = QFont(fontName, height if fontSize == -1 else fontSize) |
386 | 388 |
|
387 | 389 |
x_factor = width / (QFontMetricsF(font).width(self.text()) / lineCount) |
내보내기 Unified diff