烜誠教的記錄一下
https://blog.miniasp.com/post/2009/01/09/How-to-setup-7-zip-to-build-SFX-installer
1.下載 :https://www.7-zip.org/download.html
解壓縮後這兩個檔案是重點:7zr.exe 與 7zSD.sfx
2.使用7zip把bat壓成.7z,指令:
7zr.exe a 壓成的.7z 來源bat或資料夾
3.建立文字檔內容如下
;!@Install@!UTF-8!
Title="抬頭名稱"
BeginPrompt="您要執行 [程式名稱] 嗎?"
RunProgram="批次檔名稱.bat"
;!@InstallEnd@!
用utf-8格式存檔
4.把.7z和文字檔合成exe,指令
copy /b 7zSD.sfx + 文字檔config.txt + 來源.7z 輸出.exe
2020年2月20日
2020年2月14日
py compile pyc
https://medium.com/pyladies-taiwan/python-%E5%B0%87python%E6%89%93%E5%8C%85%E6%88%90exe%E6%AA%94-32a4bacbe351
2. -F 打包成一個exe文件
3. --icon=圖標路徑
4. -w 使用視窗,無控制台
5. -c 使用控制台,無視窗
6. -D 創建一個目錄,包含exe以及其他一些依賴性文件
sudo pip3 install pyinstaller
windows
pyinstaller -F .\hello.py
linux
python3 -m compileall file.py常用參數介紹
1. pyinstaller -h 來查看參數2. -F 打包成一個exe文件
3. --icon=圖標路徑
4. -w 使用視窗,無控制台
5. -c 使用控制台,無視窗
6. -D 創建一個目錄,包含exe以及其他一些依賴性文件
2020年2月10日
2020年2月9日
stl viewer
sudo apt-get install freeglut3 freeglut3-dev
加上鍵盤+-可以放大縮小,滑鼠滾輪可以縮放。
記錄一下
static void
mouse_click(int button, int state, int x, int y)
{
//滑鼠滾輸
if ( button == 3 ){zoom += 0.2; state =0;rotating = 1;}
if ( button == 4 ){zoom -= 0.2;rotating = 0;}
}
mine type設定資料
/etc/mime.types
/usr/share/applications/defaults.list/usr/share/mime/packages/*.xml
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-sb2">
<comment>xxxxx scratch sb2 </comment>
<glob pattern="*.sb2"/>
</mime-type>
</mime-info>
2020年1月28日
qt5程式設計師
安裝
sudo apt-get install qt5-default sudo apt-get install qttools5-dev-tools sudo pip3 install pyqt5
存檔為.ui
ui轉py
pyuic5 UI.ui -o UI.py
或
pyuic5 MyUI.ui > myui.py
執行秀UI,編輯另一個py檔內容如下
import
sys
from
PyQt5.QtWidgets import QDialog, QApplication
from myui import Ui_Form #myui 是你的.py檔案名字
class
AppWindow(QDialog):
def
__init__(self):
super().__init__()
self.ui
= Ui_Dialog() #Ui_Dialog是myui.py裡面的class名稱
self.ui.setupUi(self)
self.show()
app
= QApplication(sys.argv)
w
= AppWindow()
w.show()
sys.exit(app.exec_())
2020年1月17日
bpi-bit離線版製作記錄
參考網址:https://github.com/junhuanchen/scratch3-eim-mpfshell
建立scratch3目錄,並進入目錄中
mkdir scratch3
cd scratch3
sudo npm add uglifyjs-webpack-plugin
下載github中的scratch-gui
git clone https://github.com/LLK/scratch-gui
cd scratch-gui
npm install
使用瀏覽器輸入http://0.0.0.0:8601/可以看到scratch3官方編輯器了
bpi-bit擴充積木,需要兩個github專案,如下:
https://github.com/junhuanchen/scratch3-eim-mpfshell
https://github.com/CodeLabClub/scratch3_eim
回到scratch3目錄下
cd scratch3
git clone https://github.com/junhuanchen/scratch3-eim-mpfshell.git
git clone https://github.com/CodeLabClub/scratch3_eim.git
把複製專案vm到目錄中
cp -r scratch3_eim scratch-gui/node_modules/scratch-vm/src/extensions/
cp -r scratch3-eim-mpfshell/scratch3_mpfshell scratch-gui/node_modules/scratch-vm/src/extensions/
cp -r scratch3-eim-mpfshell/scratch3_bpibit scratch-gui/node_modules/scratch-vm/src/extensions/
編輯index.jsx
vim scratch-gui/src/lib/libraries/extensions/index.jsx
在import 下一行,加入下列內容
//bpibit
import mpfshellImage from './mpfshell/mpfshell.png';
import WebduinoImage from './bpibit/webduino.png';
在export default [中最後面加入(注意有個",")
,
{
name: 'Mpfshell',
extensionId: 'mpfshell',
collaborator: 'JunhuanChen',
iconURL: mpfshellImage,
description: (
<FormattedMessage
defaultMessage="Mpfshell for Scratch3"
description="Use mpfshell control micropython."
id="gui.extension.Mpfshell.description"
/>
),
featured: true
},
{
name: 'bpi:bit',
extensionId: 'bpibit',
collaborator: 'Bananapi',
iconURL: WebduinoImage,
description: (
<FormattedMessage
defaultMessage="bpi:bit for scratch3"
description="bpibit"
id="gui.extension.bpibit.description"
/>
),
featured: true
}
編輯extension-manager.js
vim scratch-gui-ok/node_modules/scratch-vm/src/extension-support/extension-manager.js
註解掉 //gdxfor: () => require('../extensions/scratch3_gdx_for'),
加入下列內容
,
//mpfshell: Scratch3MpfshellBlocks,
eim: () => require('../extensions/scratch3_eim'),
mpfshell: () => require('../extensions/scratch3_mpfshell'),
bpibit: () => require('../extensions/scratch3_bpibit'),
把圖檔拷貝進入目錄(好像少了mpfshell.png,自己找一張吧)
mkdir scratch-gui/src/lib/libraries/extensions/bpibit
mkdir scratch-gui/src/lib/libraries/extensions/mpfshell
cp scratch3-eim-mpfshell/webduino.png scratch-gui/src/lib/libraries/extensions/bpibit/
cp scratch3-eim-mpfshell/mpfshell.png scratch-gui/src/lib/libraries/extensions/mpfshell/
重新執行npm start
就可以看到bpi-bit的擴充積木了,
至於連線程式請參考https://adapter.codelab.club/user_guide/install/
說明,燒入韌體和執行連線程式.
加入下列內容
"bpibit.isconnected": "是否連線",
"bpibit.connect": "連線",
"bpibit.close": "關閉",
vim scratch-gui/node_modules/scratch-vm/src/extensions/scratch3_bpibit/index.js
在bpibit部分中在
blocks: [
{
opcode: 'isconnected',
blockType: BlockType.REPORTER,
下加入下列內容
text: formatMessage({
id: 'bpibit.isconnected',
}),
建立scratch3目錄,並進入目錄中
mkdir scratch3
cd scratch3
sudo npm add uglifyjs-webpack-plugin
sudo npm install -g webpack
sudo npm install -g webpack-dev-server
下載github中的scratch-gui
git clone https://github.com/LLK/scratch-gui
cd scratch-gui
npm install
使用瀏覽器輸入http://0.0.0.0:8601/可以看到scratch3官方編輯器了
bpi-bit擴充積木,需要兩個github專案,如下:
https://github.com/junhuanchen/scratch3-eim-mpfshell
https://github.com/CodeLabClub/scratch3_eim
回到scratch3目錄下
cd scratch3
git clone https://github.com/junhuanchen/scratch3-eim-mpfshell.git
git clone https://github.com/CodeLabClub/scratch3_eim.git
把複製專案vm到目錄中
cp -r scratch3_eim scratch-gui/node_modules/scratch-vm/src/extensions/
cp -r scratch3-eim-mpfshell/scratch3_mpfshell scratch-gui/node_modules/scratch-vm/src/extensions/
cp -r scratch3-eim-mpfshell/scratch3_bpibit scratch-gui/node_modules/scratch-vm/src/extensions/
編輯index.jsx
vim scratch-gui/src/lib/libraries/extensions/index.jsx
在import 下一行,加入下列內容
//bpibit
import mpfshellImage from './mpfshell/mpfshell.png';
import WebduinoImage from './bpibit/webduino.png';
在export default [中最後面加入(注意有個",")
,
{
name: 'Mpfshell',
extensionId: 'mpfshell',
collaborator: 'JunhuanChen',
iconURL: mpfshellImage,
description: (
<FormattedMessage
defaultMessage="Mpfshell for Scratch3"
description="Use mpfshell control micropython."
id="gui.extension.Mpfshell.description"
/>
),
featured: true
},
{
name: 'bpi:bit',
extensionId: 'bpibit',
collaborator: 'Bananapi',
iconURL: WebduinoImage,
description: (
<FormattedMessage
defaultMessage="bpi:bit for scratch3"
description="bpibit"
id="gui.extension.bpibit.description"
/>
),
featured: true
}
編輯extension-manager.js
vim scratch-gui-ok/node_modules/scratch-vm/src/extension-support/extension-manager.js
註解掉 //gdxfor: () => require('../extensions/scratch3_gdx_for'),
加入下列內容
,
//mpfshell: Scratch3MpfshellBlocks,
eim: () => require('../extensions/scratch3_eim'),
mpfshell: () => require('../extensions/scratch3_mpfshell'),
bpibit: () => require('../extensions/scratch3_bpibit'),
mkdir scratch-gui/src/lib/libraries/extensions/bpibit
mkdir scratch-gui/src/lib/libraries/extensions/mpfshell
cp scratch3-eim-mpfshell/webduino.png scratch-gui/src/lib/libraries/extensions/bpibit/
cp scratch3-eim-mpfshell/mpfshell.png scratch-gui/src/lib/libraries/extensions/mpfshell/
重新執行npm start
就可以看到bpi-bit的擴充積木了,
至於連線程式請參考https://adapter.codelab.club/user_guide/install/
說明,燒入韌體和執行連線程式.
中文化
vim scratch-gui/node_modules/scratch-l10n/locales/editor-msgs.js加入下列內容
"bpibit.isconnected": "是否連線",
"bpibit.connect": "連線",
"bpibit.close": "關閉",
vim scratch-gui/node_modules/scratch-vm/src/extensions/scratch3_bpibit/index.js
在bpibit部分中在
blocks: [
{
opcode: 'isconnected',
blockType: BlockType.REPORTER,
下加入下列內容
text: formatMessage({
id: 'bpibit.isconnected',
}),
再到網頁中就可以看到中文化完整的內容
訂閱:
文章 (Atom)






