개정판 2fcff2ae
issue #000 Hytos 수정.
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
1600 | 1600 |
report_drawing = MainWindow.USE_SVG #TODO: force to set report drawing to USE_IMAGE |
1601 | 1601 |
|
1602 | 1602 |
report_drawing_path = None |
1603 |
report_drawing_path_image = None |
|
1603 | 1604 |
with NamedTemporaryFile() as f: |
1604 |
report_drawing_path = f.name + '.png' if report_drawing == MainWindow.USE_IMAGE else f.name + '.svg' |
|
1605 |
report_drawing_path = f.name + '.svg' |
|
1606 |
report_drawing_path_image = f.name + '.png' |
|
1605 | 1607 |
|
1606 | 1608 |
if report_drawing_path: |
1607 | 1609 |
self.on_view_connector(False) # hide connector |
1610 |
self.graphicsView.save_as_image(report_drawing_path_image) |
|
1611 |
self.graphicsView.save_as_svg(report_drawing_path) # try to use save_as_svg when will generate svg file |
|
1612 |
|
|
1608 | 1613 |
if report_drawing == MainWindow.USE_IMAGE: |
1609 |
self.graphicsView.save_as_image(report_drawing_path) |
|
1610 |
else: |
|
1611 |
self.graphicsView.save_as_svg(report_drawing_path) # try to use save_as_svg when will generate svg file |
|
1614 |
report_drawing_path = report_drawing_path_image |
|
1612 | 1615 |
|
1613 | 1616 |
workspace = self.get_work_space() |
1614 | 1617 |
file_name = os.path.join(workspace, app_doc_data.activeDrawing.name + '.xlsx') |
... | ... | |
1627 | 1630 |
# up to here |
1628 | 1631 |
if file_name and os.path.exists(template): |
1629 | 1632 |
units = [attr[1] for attr in app_doc_data.activeDrawing.attrs if attr[0] == 'Units'][0] |
1630 |
|
|
1631 | 1633 |
wb = openpyxl.load_workbook(template) |
1632 |
|
|
1633 | 1634 |
page_no = 1 |
1634 | 1635 |
pages = math.ceil(len(list(app_doc_data.activeDrawing.hmbTable.streamNos())) / 20) |
1635 | 1636 |
for page in range(pages): |
1636 | 1637 |
ws = wb.copy_worksheet(wb.get_sheet_by_name('Page')) |
1637 | 1638 |
ws.title = f"Page ({page_no})" |
1639 |
cal_image = openpyxl.drawing.image.Image(report_drawing_path_image) |
|
1638 | 1640 |
|
1639 | 1641 |
if report_drawing == MainWindow.USE_IMAGE: |
1640 | 1642 |
cal_image = openpyxl.drawing.image.Image(report_drawing_path) |
... | ... | |
2307 | 2309 |
arguments = [report_app_path, |
2308 | 2310 |
save_file_name, |
2309 | 2311 |
report_drawing_path, |
2310 |
f"{MainWindow.PAPER_SIZE.width()},{MainWindow.PAPER_SIZE.height()}"]
|
|
2312 |
f"{cal_image.width},{cal_image.height}"]
|
|
2311 | 2313 |
res = subprocess.call(arguments) |
2312 | 2314 |
if res == 0: |
2313 | 2315 |
os.startfile(save_file_name) |
내보내기 Unified diff