개정판 47a43855
#issue AppDocData 수정
MainWindow 에서 Rotate, Flip함수 생성
SymbolSvgItem 에서 angle에 관한 수정
Change-Id: I393f099c6e77afed9f4b0872f036e4d35c373fdd
HYTOS/HYTOS/AppDocData.py | ||
---|---|---|
297 | 297 |
|
298 | 298 |
sqlFiles = ['update_database.sql'] |
299 | 299 |
string_main_version = QCoreApplication.applicationVersion() |
300 |
app_version= version.parse(string_main_version) |
|
300 | 301 |
|
301 | 302 |
with sqlite3.connect(drawing) as conn: |
302 | 303 |
conn.execute('PRAGMA foreign_keys = ON') |
... | ... | |
305 | 306 |
|
306 | 307 |
doc_ver_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'Scripts', |
307 | 308 |
f'DocVer_{string_main_version}.sql') |
308 |
#만약 3버전프로그램에 1버전 문서일때 스크립트가 2와 3이 있을때 3에대한 스크립트만 적용됨 2는 적용안되는 경우? (스크립트를 그냥 1로 이어붙여서 작업?) |
|
309 |
# ㄴ 두번의 sql스크립트 생성 동안 한번도안건드린 문서가 있는경우 |
|
309 |
|
|
310 | 310 |
configs = self.getConfigs('Version', 'Doc_ver') |
311 |
doc_version = version.parse(configs[0].value) |
|
311 | 312 |
|
312 |
if not configs or version.parse(string_main_version) > version.parse(configs[0].value):
|
|
313 |
if not configs or app_version > doc_version:
|
|
313 | 314 |
if os.path.isfile(doc_ver_path): |
314 | 315 |
sqlFiles.append(f'DocVer_{string_main_version}.sql') |
315 |
|
|
316 |
elif version.parse(string_main_version) < version.parse(configs[0].value): |
|
317 |
QtWidgets.QMessageBox.information(self, self.tr('Warning'), |
|
318 |
self.tr('The App version is lower than the document version. Please update.')) |
|
316 |
elif app_version < doc_version: |
|
319 | 317 |
return False |
320 | 318 |
else: |
321 | 319 |
pass |
... | ... | |
1864 | 1862 |
@activeDrawing.setter |
1865 | 1863 |
def activeDrawing(self, value): |
1866 | 1864 |
self._activeDrawing = value |
1867 |
|
|
1868 |
''' |
|
1869 |
@brief Add ScaleX and ScaleY columns to existing files |
|
1870 |
@author HyunJun |
|
1871 |
@date 2021.05.11 |
|
1872 |
''' |
|
1873 |
|
|
1874 |
#def add_column_ScaleXY(self): |
HYTOS/HYTOS/Commands/FlipCommand.py | ||
---|---|---|
24 | 24 |
"""undo""" |
25 | 25 |
for idx, item in enumerate(self._items): |
26 | 26 |
item.flip = self._params[idx] |
27 |
item.flip_symbol(self._flip == 1) |
|
27 |
#item.flip_symbol(self._flip == 1)
|
|
28 | 28 |
|
29 | 29 |
self._scene.update() |
30 | 30 |
|
... | ... | |
36 | 36 |
_params = [] |
37 | 37 |
for idx, item in enumerate(self._items): |
38 | 38 |
_params.append(item.flip) # save original flip code |
39 |
item.flip_symbol(self._flip == 1) |
|
39 |
#item.flip_symbol(self._flip == 1)
|
|
40 | 40 |
|
41 | 41 |
self._params = _params |
42 | 42 |
self._scene.update() |
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
227 | 227 |
|
228 | 228 |
''' add rotate and flip tool buttons''' |
229 | 229 |
self.actionRotate_L.triggered.connect(self.on_left_rotation_clicked) |
230 |
self.actionRotate_R.triggered.connect(self.on_right_rotation_clicked) |
|
231 |
self.actionFlip_horizontal.triggered.connect(self.on_horizontal_filp_clicked) |
|
232 |
self.actionFlip_vertical.triggered.connect(self.on_vertical_filp_clicked) |
|
230 | 233 |
|
231 | 234 |
self.graphicsView.scene.selectionChanged.connect(self.onSelectionChanged) |
232 | 235 |
|
... | ... | |
423 | 426 |
viewer = self.graphicsView |
424 | 427 |
items = viewer.scene.selectedItems() |
425 | 428 |
if items: |
429 |
viewer.scene.undo_stack.push(RotateCommand(viewer.scene, items, reverse=True)) |
|
430 |
except Exception as ex: |
|
431 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
|
432 |
f"{sys.exc_info()[-1].tb_lineno}" |
|
433 |
|
|
434 |
self.addMessage.emit(MessageType.Error, message) |
|
435 |
|
|
436 |
def on_right_rotation_clicked(self): |
|
437 |
from RotateCommand import RotateCommand |
|
438 |
|
|
439 |
try: |
|
440 |
viewer = self.graphicsView |
|
441 |
items = viewer.scene.selectedItems() |
|
442 |
if items: |
|
426 | 443 |
viewer.scene.undo_stack.push(RotateCommand(viewer.scene, items)) |
427 | 444 |
except Exception as ex: |
428 | 445 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
... | ... | |
430 | 447 |
|
431 | 448 |
self.addMessage.emit(MessageType.Error, message) |
432 | 449 |
|
450 |
def on_horizontal_filp_clicked(self): |
|
451 |
from FlipCommand import FlipCommand |
|
452 |
|
|
453 |
try: |
|
454 |
viewer = self.graphicsView |
|
455 |
items = viewer.scene.selectedItems() |
|
456 |
if items: |
|
457 |
viewer.scene.undo_stack.push(FlipCommand(viewer.scene, items, 1)) |
|
458 |
except Exception as ex: |
|
459 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
|
460 |
f"{sys.exc_info()[-1].tb_lineno}" |
|
461 |
|
|
462 |
self.addMessage.emit(MessageType.Error, message) |
|
463 |
|
|
464 |
def on_vertical_filp_clicked(self): |
|
465 |
from FlipCommand import FlipCommand |
|
466 |
|
|
467 |
try: |
|
468 |
viewer = self.graphicsView |
|
469 |
items = viewer.scene.selectedItems() |
|
470 |
if items: |
|
471 |
viewer.scene.undo_stack.push(FlipCommand(viewer.scene, items, 2)) |
|
472 |
except Exception as ex: |
|
473 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
|
474 |
f"{sys.exc_info()[-1].tb_lineno}" |
|
475 |
|
|
476 |
self.addMessage.emit(MessageType.Error, message) |
|
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
|
481 |
|
|
433 | 482 |
def closeEvent(self, event: QCloseEvent) -> None: |
434 | 483 |
"""save geometry and state and then ask user to save drawing which is modified""" |
435 | 484 |
|
... | ... | |
2502 | 2551 |
|
2503 | 2552 |
success = app_doc_data.build_drawing_database(drawing.path) |
2504 | 2553 |
if success == False: |
2554 |
QMessageBox.information(self, self.tr('Warning'), self.tr( |
|
2555 |
'The App version is lower than the document version. Please update.')) |
|
2505 | 2556 |
return |
2506 | 2557 |
|
2507 | 2558 |
self.patch_data() |
HYTOS/HYTOS/Shapes/SymbolSvgItem.py | ||
---|---|---|
219 | 219 |
values = ['?', '?', '?', '?', '?', '?', '?', '?', '?'] |
220 | 220 |
param = [str(self.uid), str(self.dbUid), str(self.tag_no) if self.tag_no is not None else self.tag_no, |
221 | 221 |
self.index, rect.left(), rect.top(), |
222 |
str(self.angle), self.scale(), self.scale()]
|
|
222 |
self.rotation(), self.scale(), self.scale()] #str(self.angle)
|
|
223 | 223 |
sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values)) |
224 | 224 |
res.append((sql, tuple(param))) |
225 | 225 |
|
... | ... | |
1763 | 1763 |
|
1764 | 1764 |
item = SymbolSvgItem.createItem(_type, uid, None, 0, dbUid) |
1765 | 1765 |
item.setVisible(False) |
1766 |
item.buildItem(name, _type, float(angle), scaleX,scaleY , pt, origin, connPts, dbUid, pointsUids, index) |
|
1766 |
item.buildItem(name, _type, float(angle), scaleX, scaleY , pt, origin, connPts, dbUid, pointsUids, index)
|
|
1767 | 1767 |
item.tag_no = tag_no |
1768 | 1768 |
item.build_label() |
1769 | 1769 |
|
... | ... | |
1930 | 1930 |
|
1931 | 1931 |
transform = QTransform() |
1932 | 1932 |
transform.translate(self.loc[0] + self.symbolOrigin[0], self.loc[1] + self.symbolOrigin[1]) |
1933 |
transform.rotateRadians(-self.angle) |
|
1933 |
#transform.rotateRadians(-self.angle) |
|
1934 |
transform.rotate(self.angle) |
|
1934 | 1935 |
transform.translate(-self.symbolOrigin[0], -self.symbolOrigin[1]) |
1935 | 1936 |
self.setTransform(transform) |
1936 | 1937 |
scene.addItem(self) |
내보내기 Unified diff