zlgopen / awtk-web Goto Github PK
View Code? Open in Web Editor NEW在浏览器中运行AWTK应用程序
License: GNU Lesser General Public License v2.1
在浏览器中运行AWTK应用程序
License: GNU Lesser General Public License v2.1
调试后发现是下面这个函数的问题,dpi=2造成后面assets.find找不到资源
建议做一个兼容修改,优先找x2的图片,如果找不到就找 x1的图片
另外我试验了一下,如果强制 let dpi = '/x1/',图片可以显示,但还是保持图片的原始大小
AssetsManager.getImage = function (name) {
let anydpi = '/xx/';
let dpi = '/x‘ + TBrowser.getDevicePixelRatio() + ’/';
const assets = g_awtk_assets['image'];
if (assets) {
const asset = assets.find(iter => {
return name == iter.name && (iter.uri.indexOf(anydpi) >= 0 || iter.uri.indexOf(dpi) >= 0);;
});
return asset;
}
return null;
}
一、
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
安装完成。
二、
编译 awtk 本身
git clone https://github.com/zlgopen/awtk.git
cd awtk
scons -j 8
编译完成。
三、
编译 demoui
git clone https://github.com/zlgopen/awtk-web.git
cd awtk-web
python build.py ../awtk/demos/demoui_build.json all
第三步出现以下错误:
shared:INFO: (Emscripten: Running sanity checks)
emcc: error: /home/du/AWTK_GUI/awtk-web/webroot/demoui/assets_web.c: No such file or directory ("/home/du/AWTK_GUI/awtk-web/webroot/demoui/assets_web.c" was expected to be an input file, based on the commandline arguments provided)
gen/app.js
/home/du/AWTK_GUI/awtk-web/webroot/demoui/js/awtk_web.js
/home/du/AWTK_GUI/awtk-web/webroot/demoui/assets_web.js
Traceback (most recent call last):
File "build.py", line 298, in
build_awtk_web_js(config)
File "build.py", line 148, in build_awtk_web_js
merge_files(awtk_web_js_files, outfile)
File "build.py", line 46, in merge_files
with open(fname) as infile:
IOError: [Errno 2] No such file or directory: u'/home/du/AWTK_GUI/awtk-web/webroot/demoui/assets_web.js'
请问是否源文件存在错误?
谢谢!
比如应用的尺寸是800x480像素
生成的web应用在手机浏览器上只能显示其中一部分
而且没有滚动条,无法拖动或缩放,可能与手机的高DPI有关系
在电脑上如果DPI是100%,如果浏览器窗口太小是可以有滚动条的
slako:emsdk slakofan$ ./emsdk install latest
Resolving SDK alias 'latest' to '2.0.28'
Resolving SDK version '2.0.28' to 'sdk-releases-upstream-866055ea639d64dfedc625d28ec981e47ce37168-64bit'
Installing SDK 'sdk-releases-upstream-866055ea639d64dfedc625d28ec981e47ce37168-64bit'..
Installing tool 'node-14.15.5-64bit'..
Error: Downloading URL 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/node-v14.15.5-darwin-x64.tar.gz': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)>
Warning: Possibly SSL/TLS issue. Update or install Python SSL root certificates (2048-bit or greater) supplied in Python folder or https://pypi.org/project/certifi/ and try again.
error: installation failed!
一般web应用都会从服务器获取一些数据,还可能会提交一些表单,这方面awtk-web是怎么做的?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.