개정판 14c84940
issue #1059: 외부 프로그램을 호출하는 로직 변경
Change-Id: I97d4f073e8e3daeef88a4d0a165d11394cb6dede
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
1376 | 1376 |
try: |
1377 | 1377 |
help_file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'HYTOS User Manual.pdf') |
1378 | 1378 |
os.startfile(f"\"{help_file_path}\"") |
1379 |
# os.system(f"\"{help_file_path}\"") |
|
1380 | 1379 |
except Exception as ex: |
1381 | 1380 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
1382 | 1381 |
sys.exc_info()[-1].tb_lineno) |
... | ... | |
2211 | 2210 |
report_app_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ReportApp', |
2212 | 2211 |
'ReportApp.exe') |
2213 | 2212 |
|
2214 |
# Error : File or Directory used Black |
|
2215 |
black_report_app_path = report_app_path.split(os.path.sep) |
|
2216 |
report_app_path = "" |
|
2217 |
for dir_name in black_report_app_path: |
|
2218 |
if dir_name.find(' ') != -1: # 공백이 없을 경우 -1 |
|
2219 |
dir_name = f'"{dir_name}"' |
|
2220 |
report_app_path += dir_name + '/' |
|
2221 |
report_app_path = report_app_path[:-1] |
|
2222 |
|
|
2223 |
blank_save_file_name = f'"{save_file_name}"' |
|
2224 |
svg_path = f'"{svg_path}"' |
|
2225 |
|
|
2226 |
svg_input_result = os.system(f"{report_app_path} {blank_save_file_name} {svg_path}") |
|
2227 |
|
|
2228 |
if svg_input_result == 1: |
|
2213 |
arguments = [report_app_path, save_file_name, svg_path] |
|
2214 |
res = subprocess.call(arguments) |
|
2215 |
if res == 0: |
|
2229 | 2216 |
os.startfile(save_file_name) |
2230 | 2217 |
QMessageBox.information(self, self.tr('Information'), self.tr('Report is done')) |
2231 |
elif svg_input_result == 0:
|
|
2218 |
else:
|
|
2232 | 2219 |
QMessageBox.information(self, self.tr('Information'), |
2233 | 2220 |
self.tr(' Could not find excel file or svg file. ')) |
2221 |
|
|
2234 | 2222 |
if save_file_name is not None: |
2235 | 2223 |
os.remove(save_file_name) |
2236 | 2224 |
except Exception as ex: |
HYTOS/HYTOS/Shapes/EngineeringCalloutTextItem.py | ||
---|---|---|
99 | 99 |
|
100 | 100 |
super(QEngineeringCalloutTextItem, self).keyPressEvent(event) |
101 | 101 |
except Exception as ex: |
102 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
103 |
sys.exc_info()[-1].tb_lineno)
|
|
102 |
message = f'error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:' \
|
|
103 |
f'{sys.exc_info()[-1].tb_lineno}'
|
|
104 | 104 |
self.addMessage.emit(MessageType.Error, message) |
105 | 105 |
|
106 | 106 |
def itemChange(self, change, value): |
... | ... | |
232 | 232 |
from App import App |
233 | 233 |
from AppDocData import MessageType |
234 | 234 |
|
235 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
236 |
sys.exc_info()[-1].tb_lineno)
|
|
235 |
message = f'error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:' \
|
|
236 |
f'{sys.exc_info()[-1].tb_lineno}'
|
|
237 | 237 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
238 | 238 |
|
239 | 239 |
return res |
... | ... | |
297 | 297 |
res.append(node) |
298 | 298 |
except Exception as ex: |
299 | 299 |
from App import App |
300 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
301 |
sys.exc_info()[-1].tb_lineno)
|
|
300 |
message = f'error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:' \
|
|
301 |
f'{sys.exc_info()[-1].tb_lineno}'
|
|
302 | 302 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
303 | 303 |
|
304 | 304 |
return res |
ReportApp/ReportApp/Program.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Collections.Generic; |
3 |
using System.IO; |
|
3 | 4 |
using System.Linq; |
4 | 5 |
using System.Text; |
5 | 6 |
using System.Threading.Tasks; |
... | ... | |
7 | 8 |
|
8 | 9 |
namespace ConsoleApp1 |
9 | 10 |
{ |
10 |
class Program |
|
11 |
internal static class Program
|
|
11 | 12 |
{ |
12 |
static int Main(string[] args) |
|
13 |
private static int Main(string[] args)
|
|
13 | 14 |
{ |
14 | 15 |
SpreadsheetInfo.SetLicense("SN-2021May25-IPYYaC5T2J/LIzFImndeajkkMS/Fn1fLWGfjRRxTNu/uan2hm9KrTK/v9hdsQfLCOuUeMZXrEHCPsmS7Pnp4YGIGsOw==A"); |
15 | 16 |
|
... | ... | |
18 | 19 |
string ExcelPath = args[0]; |
19 | 20 |
string SvgPath = args[1].Replace("\\", "/"); |
20 | 21 |
|
21 |
var workbook = ExcelFile.Load(ExcelPath); |
|
22 |
if (File.Exists(ExcelPath) && File.Exists(SvgPath)) |
|
23 |
{ |
|
24 |
var workbook = ExcelFile.Load(ExcelPath); |
|
22 | 25 |
|
23 |
foreach (var worksheet in workbook.Worksheets) |
|
24 |
{ |
|
25 |
if (worksheet.Name.Contains("Page")) |
|
26 |
foreach (var worksheet in workbook.Worksheets) |
|
26 | 27 |
{ |
27 |
worksheet.Pictures.Add(SvgPath, "A1", 1500, 990, LengthUnit.Pixel); |
|
28 |
if (worksheet.Name.Contains("Page")) |
|
29 |
{ |
|
30 |
worksheet.Pictures.Add(SvgPath, "A1", 1500, 990, LengthUnit.Pixel); |
|
31 |
} |
|
28 | 32 |
} |
33 |
workbook.Save(ExcelPath); |
|
34 |
|
|
35 |
return 0; |
|
29 | 36 |
} |
30 |
workbook.Save(ExcelPath); |
|
31 |
return 1; |
|
32 | 37 |
} |
33 |
return 0; |
|
38 |
|
|
39 |
return -1; |
|
34 | 40 |
} |
35 | 41 |
} |
36 |
} |
|
42 |
} |
내보내기 Unified diff