Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ build/
node_modules/
*.iml
.idea/
package-lock.json
yarn.lock
/dist
22 changes: 22 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@ This will serve built files locally and open your default browser pointing to th
source files will fire gulp tasks that will keep the ``build`` directory up to date. The build system also uses
gulp's live-reload plugin, which works great with `Google Chrome's Live Reload`_ extension.

Desktop Application
...............................................................................
Plasio now supports running as a desktop application using Electron. To build the desktop version::

# First build the web application
gulp build

# Then create the Windows installer and portable version
npm run dist

This will create two files in the ``dist`` directory:
- ``Plasio Viewer Setup 0.0.1.exe`` - Windows installer
- ``Plasio Viewer 0.0.1.exe`` - Portable version

The installer version will create shortcuts and can be uninstalled through Windows Control Panel.
The portable version can be run directly without installation.

System Requirements for Desktop Version:
- Windows 10 or later (64-bit)
- 4GB RAM minimum
- Graphics card with WebGL support

The gulp file includes a task to publish directly to plas.io, however, you need AWS Access for that to work. You may direct plasio
to your own AWS buckets, in which case you will have to edit ``gulpfile.js`` to direct it likewise.

Expand Down
73 changes: 73 additions & 0 deletions TempScript/download-fonts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
const fs = require('fs');
const path = require('path');
const https = require('https');

// 添加日志
const log = require('electron-log');
log.transports.file.level = 'info';

const fontsToDownload = [
{
name: 'OpenSans-Regular',
url: 'https://fonts.gstatic.com/s/opensans/v34/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS-muw.woff2',
format: 'woff2'
},
{
name: 'OpenSans-Bold',
url: 'https://fonts.gstatic.com/s/opensans/v34/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSGmu0SC55K5gw.woff2',
format: 'woff2'
},
{
name: 'ArchivoBlack-Regular',
url: 'https://fonts.gstatic.com/s/archivoblack/v17/HTxqL289NzCGg4MzN6KJ7eW6CYKF_i7y.woff2',
format: 'woff2'
}
];

function downloadFont(font) {
return new Promise((resolve, reject) => {
const fontPath = path.join(__dirname, 'build', 'fonts', `${font.name}.${font.format}`);
log.info(`下载字体: ${font.name}`);

const file = fs.createWriteStream(fontPath);
https.get(font.url, response => {
response.pipe(file);
file.on('finish', () => {
file.close();
log.info(`字体下载完成: ${font.name}`);
resolve();
});
}).on('error', err => {
fs.unlink(fontPath, () => {
log.error(`下载字体失败 ${font.name}:`, err);
reject(err);
});
});

file.on('error', err => {
fs.unlink(fontPath, () => {
log.error(`写入字体文件失败 ${font.name}:`, err);
reject(err);
});
});
});
}

async function downloadAllFonts() {
try {
// 确保字体目录存在
const fontDir = path.join(__dirname, 'build', 'fonts');
if (!fs.existsSync(fontDir)) {
fs.mkdirSync(fontDir, { recursive: true });
}

// 下载所有字体
await Promise.all(fontsToDownload.map(downloadFont));
log.info('所有字体下载完成');
} catch (error) {
log.error('下载字体过程中出错:', error);
process.exit(1);
}
}

downloadAllFonts();
13 changes: 13 additions & 0 deletions TempScript/generate-icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const icongen = require('icon-gen');
const path = require('path');

icongen(path.join(__dirname, 'resources', 'assets', 'circle.png'), path.join(__dirname, 'resources'), {
ico: {
name: 'icon',
sizes: [16, 24, 32, 48, 64, 128, 256]
}
}).then((results) => {
console.log('图标生成成功:', results);
}).catch((err) => {
console.error('图标生成失败:', err);
});
Loading