add debug mode for viewer
This commit is contained in:
parent
7b31e3576b
commit
8cfd7d99d4
|
@ -7,4 +7,4 @@ export_db = "export.db"
|
||||||
decorated_db = "decorate.db"
|
decorated_db = "decorate.db"
|
||||||
env_db = "env.db"
|
env_db = "env.db"
|
||||||
force_regenerate = False
|
force_regenerate = False
|
||||||
|
debug_mode = False
|
||||||
|
|
|
@ -4,16 +4,17 @@ import ServerCore
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import getopt
|
import getopt
|
||||||
|
import logging
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], "hi:o:e:f")
|
opts, args = getopt.getopt(sys.argv[1:], "hi:o:e:c:fd")
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
print('Wrong arguments!')
|
print('Wrong arguments!')
|
||||||
print('python SuperScriptViewer.py -i <export.db> -o <decorated.db> -e <env.db> -c <codec_name> -f')
|
print('python SuperScriptViewer.py -i <export.db> -o <decorated.db> -e <env.db> -c <codec_name> -f -d')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
for opt, arg in opts:
|
for opt, arg in opts:
|
||||||
if opt == '-h':
|
if opt == '-h':
|
||||||
print('python SuperScriptViewer.py -i <export.db> -o <decorated.db> -e <env.db> -c <codec_name> -f')
|
print('python SuperScriptViewer.py -i <export.db> -o <decorated.db> -e <env.db> -c <codec_name> -f -d')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
elif opt == '-i':
|
elif opt == '-i':
|
||||||
CustomConfig.export_db = arg
|
CustomConfig.export_db = arg
|
||||||
|
@ -25,13 +26,18 @@ for opt, arg in opts:
|
||||||
CustomConfig.database_encoding = arg
|
CustomConfig.database_encoding = arg
|
||||||
elif opt == '-f':
|
elif opt == '-f':
|
||||||
CustomConfig.force_regenerate = True
|
CustomConfig.force_regenerate = True
|
||||||
|
elif opt == '-d':
|
||||||
|
CustomConfig.debug_mode = True
|
||||||
|
|
||||||
|
print('Super Script View')
|
||||||
|
print('Homepage: https://github.com/yyc12345/SuperScriptMaterializer')
|
||||||
|
print('Report bug: https://github.com/yyc12345/SuperScriptMaterializer/issues')
|
||||||
|
print('')
|
||||||
# process -f
|
# process -f
|
||||||
if (CustomConfig.force_regenerate):
|
if (CustomConfig.force_regenerate):
|
||||||
if os.path.isfile(CustomConfig.decorated_db):
|
if os.path.isfile(CustomConfig.decorated_db):
|
||||||
os.remove(CustomConfig.decorated_db)
|
os.remove(CustomConfig.decorated_db)
|
||||||
|
|
||||||
print('Super Script View')
|
|
||||||
if not os.path.isfile(CustomConfig.env_db):
|
if not os.path.isfile(CustomConfig.env_db):
|
||||||
print('No environment database. Fail to generate. Exit app.')
|
print('No environment database. Fail to generate. Exit app.')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -43,7 +49,16 @@ if not os.path.isfile(CustomConfig.decorated_db):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# generate db
|
# generate db
|
||||||
|
if CustomConfig.debug_mode:
|
||||||
DecoratorCore.run()
|
DecoratorCore.run()
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
DecoratorCore.run()
|
||||||
|
except Exception as ex:
|
||||||
|
print("!!! An error occurs. Please report follwoing error output and reproduce file to developer. !!!")
|
||||||
|
logging.exception(ex)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
print('Decorated database generating done.')
|
print('Decorated database generating done.')
|
||||||
|
|
||||||
# todo: start flask
|
# todo: start flask
|
||||||
|
|
|
@ -12,8 +12,7 @@
|
||||||
<Name>SuperScriptViewer</Name>
|
<Name>SuperScriptViewer</Name>
|
||||||
<RootNamespace>SuperScriptViewer</RootNamespace>
|
<RootNamespace>SuperScriptViewer</RootNamespace>
|
||||||
<LaunchProvider>Standard Python launcher</LaunchProvider>
|
<LaunchProvider>Standard Python launcher</LaunchProvider>
|
||||||
<CommandLineArguments>
|
<CommandLineArguments>-f -d</CommandLineArguments>
|
||||||
</CommandLineArguments>
|
|
||||||
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
|
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user