Mercurial > hg > orthanc
comparison Resources/EmbedResources.py @ 4034:78ee0155ec67
trying to use orthanc frameworking with web-viewer plugin
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Jun 2020 10:14:15 +0200 |
parents | 100fbe970762 |
children |
comparison
equal
deleted
inserted
replaced
4033:0763630a42ef | 4034:78ee0155ec67 |
---|---|
41 USE_SYSTEM_EXCEPTION = False | 41 USE_SYSTEM_EXCEPTION = False |
42 EXCEPTION_CLASS = 'OrthancException' | 42 EXCEPTION_CLASS = 'OrthancException' |
43 OUT_OF_RANGE_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_ParameterOutOfRange)' | 43 OUT_OF_RANGE_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_ParameterOutOfRange)' |
44 INEXISTENT_PATH_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_InexistentItem)' | 44 INEXISTENT_PATH_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_InexistentItem)' |
45 NAMESPACE = 'Orthanc.EmbeddedResources' | 45 NAMESPACE = 'Orthanc.EmbeddedResources' |
46 FRAMEWORK_PATH = None | |
46 | 47 |
47 ARGS = [] | 48 ARGS = [] |
48 for i in range(len(sys.argv)): | 49 for i in range(len(sys.argv)): |
49 if not sys.argv[i].startswith('--'): | 50 if not sys.argv[i].startswith('--'): |
50 ARGS.append(sys.argv[i]) | 51 ARGS.append(sys.argv[i]) |
55 EXCEPTION_CLASS = '::std::runtime_error' | 56 EXCEPTION_CLASS = '::std::runtime_error' |
56 OUT_OF_RANGE_EXCEPTION = '%s("Parameter out of range")' % EXCEPTION_CLASS | 57 OUT_OF_RANGE_EXCEPTION = '%s("Parameter out of range")' % EXCEPTION_CLASS |
57 INEXISTENT_PATH_EXCEPTION = '%s("Unknown path in a directory resource")' % EXCEPTION_CLASS | 58 INEXISTENT_PATH_EXCEPTION = '%s("Unknown path in a directory resource")' % EXCEPTION_CLASS |
58 elif sys.argv[i].startswith('--namespace='): | 59 elif sys.argv[i].startswith('--namespace='): |
59 NAMESPACE = sys.argv[i][sys.argv[i].find('=') + 1 : ] | 60 NAMESPACE = sys.argv[i][sys.argv[i].find('=') + 1 : ] |
61 elif sys.argv[i].startswith('--framework-path='): | |
62 FRAMEWORK_PATH = sys.argv[i][sys.argv[i].find('=') + 1 : ] | |
60 | 63 |
61 if len(ARGS) < 2 or len(ARGS) % 2 != 0: | 64 if len(ARGS) < 2 or len(ARGS) % 2 != 0: |
62 print ('Usage:') | 65 print ('Usage:') |
63 print ('python %s [--no-upcase-check] [--system-exception] [--namespace=<Namespace>] <TargetBaseFilename> [ <Name> <Source> ]*' % sys.argv[0]) | 66 print ('python %s [--no-upcase-check] [--system-exception] [--namespace=<Namespace>] <TargetBaseFilename> [ <Name> <Source> ]*' % sys.argv[0]) |
64 exit(-1) | 67 exit(-1) |
278 | 281 |
279 cpp.write('#include "%s.h"\n' % os.path.basename(TARGET_BASE_FILENAME)) | 282 cpp.write('#include "%s.h"\n' % os.path.basename(TARGET_BASE_FILENAME)) |
280 | 283 |
281 if USE_SYSTEM_EXCEPTION: | 284 if USE_SYSTEM_EXCEPTION: |
282 cpp.write('#include <stdexcept>') | 285 cpp.write('#include <stdexcept>') |
286 elif FRAMEWORK_PATH != None: | |
287 cpp.write('#include "%s/OrthancException.h"' % FRAMEWORK_PATH) | |
283 else: | 288 else: |
284 cpp.write('#include "%s/Core/OrthancException.h"' % os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) | 289 cpp.write('#include <OrthancException.h>') |
285 | 290 |
286 cpp.write(""" | 291 cpp.write(""" |
287 #include <stdint.h> | 292 #include <stdint.h> |
288 #include <string.h> | 293 #include <string.h> |
289 | 294 |