add full env export and add icon for viewer

This commit is contained in:
2020-04-25 12:28:57 +08:00
parent d601cef30f
commit a5174e935a
12 changed files with 233 additions and 20 deletions

View File

@ -0,0 +1,7 @@
import locale
database_encoding = locale.getpreferredencoding()
export_db = "export.db"
decorated_db = "decorate.db"
env_db = "env.db"
force_regenerate = False

View File

@ -1,23 +1,25 @@
import sqlite3
import DecoratorConstValue as dcv
import json
import locale
import CustomConfig
def run():
exportDb = sqlite3.connect('export.db')
exportDb.text_factory = lambda x: x.decode(locale.getpreferredencoding())
decorateDb = sqlite3.connect('decorate.db')
exportDb = sqlite3.connect(CustomConfig.export_db)
exportDb.text_factory = lambda x: x.decode(CustomConfig.database_encoding)
decorateDb = sqlite3.connect(CustomConfig.decorated_db)
# init table
print('Init decorate.dll')
print('Init decorate database...')
initDecorateDb(decorateDb)
decorateDb.commit()
# decorate graph
print('Generating gragh list...')
graphList = []
decorateGraph(exportDb, decorateDb, graphList)
# decorate each graph
print('Generating graph...')
currentGraphBlockCell = {}
for i in graphList:
currentGraphBlockCell.clear()
@ -26,6 +28,7 @@ def run():
buildLink(exportDb, decorateDb, i, currentGraphBlockCell, graphPIO)
# export information
print('Generating info...')
buildInfo(exportDb, decorateDb)
# give up all change of eexport.db (because no change)

View File

@ -1,3 +1,5 @@
import CustomConfig
from flask import Flask
from flask import g
from flask import render_template
@ -17,7 +19,7 @@ app = Flask(__name__)
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._database = sqlite3.connect('decorate.db')
db = g._database = sqlite3.connect(CustomConfig.decorated_db)
return db
@app.teardown_appcontext
@ -47,7 +49,7 @@ def helpHandle():
@app.route('/about', methods=['GET'])
def aboutHandle():
return render_template("about.html")
return render_template("about.html", static_icon = url_for('static', filename='icon.png'))
@app.route('/index', methods=['GET'])
def indexHandle():

View File

@ -1,15 +1,42 @@
import CustomConfig
import DecoratorCore
import ServerCore
import os
import sys
import getopt
# debug use
# os.remove('decorate.db')
try:
opts, args = getopt.getopt(sys.argv, "hi:o:e:f")
except getopt.GetoptError:
print('Wrong arguments!')
print('test.py -i <export.db> -o <decorated.db> -e <env.db> -f')
sys.exit(1)
for opt, arg in opts:
if opt == '-h':
print('test.py -i <export.db> -o <decorated.db> -e <env.db> -f')
sys.exit(0)
elif opt == '-i':
CustomConfig.export_db = arg
elif opt == '-o':
CustomConfig.decorated_db = arg
elif opt == '-e':
CustomConfig.env_db = arg
elif opt == '-f':
CustomConfig.force_regenerate = True
# process -f
if (CustomConfig.force_regenerate):
if os.path.isfile(CustomConfig.decorated_db):
os.remove(CustomConfig.decorated_db)
print('Super Script View')
if not os.path.isfile("decorate.db"):
if not os.path.isfile(CustomConfig.env_db):
print('No environment database. Fail to generate. Exit app.')
sys.exit(1)
if not os.path.isfile(CustomConfig.decorated_db):
print('No decorated database, generating it.')
if not os.path.isfile('export.db'):
if not os.path.isfile(CustomConfig.export_db):
print('No export.db. Fail to generate. Exit app.')
sys.exit(1)

View File

@ -21,6 +21,9 @@
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
</PropertyGroup>
<ItemGroup>
<Compile Include="CustomConfig.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="DecoratorConstValue.py">
<SubType>Code</SubType>
</Compile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -7,10 +7,10 @@
</head>
<body>
<h1>Super Script Materializer</h1>
<h1><img src="{{ static_icon }}" width="64" height="64" style="margin: 0 10px 0 10px;"/>Super Script Materializer</h1>
<p>There are no secret script behind Virtools. Super Script Materializer will destroy all locks and show you the real code.<br />
But Super Script Materializer only show you code. It couldn't analyse the result and touch author's heart and intention. This is your work.<br />
This also is the meaning of this app's icon.</p>
So, let we crack all scripts and destroy close-source illusion.</p>
<br />
<p><a href="https://github.com/yyc12345/SuperScriptMaterializer">SuperScriptMaterializer</a>. All codes are under GPLv3.<br />
Web interface is powered by <a href="https://github.com/pallets/flask">Flask</a>.<br />