Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
编程深海AiKoder
nrfutil_gui
提交
3d6db475
N
nrfutil_gui
项目概览
编程深海AiKoder
/
nrfutil_gui
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nrfutil_gui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3d6db475
编写于
11月 17, 2021
作者:
编程深海AiKoder
🚴🏻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adjust GUI layout
上级
76c7babd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
221 addition
and
159 deletion
+221
-159
.gitignore
.gitignore
+1
-0
configs/title.ico
configs/title.ico
+0
-0
main.py
main.py
+220
-159
未找到文件。
.gitignore
0 → 100644
浏览文件 @
3d6db475
.vscode
\ No newline at end of file
configs/title.ico
0 → 100644
浏览文件 @
3d6db475
161.8 KB
main.py
浏览文件 @
3d6db475
#!/usr/bin/env python
import
wx
from
wx.core
import
SEND_EVENT_POST
,
Panel
from
wx.core
import
BITMAP_TYPE_ICO
class
NrfutilGui
(
wx
.
Frame
):
def
__init__
(
self
,
*
args
,
**
kw
):
super
(
NrfutilGui
,
self
).
__init__
(
*
args
,
**
kw
)
class
GenerateKey
(
wx
.
Panel
):
"""Generating and displaying keys"""
self
.
InitUI
()
def
__init__
(
self
,
parent
):
super
(
GenerateKey
,
self
).
__init__
(
parent
)
def
InitUI
(
self
):
panel
=
wx
.
Panel
(
self
)
hbox
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
vbox
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
# group
self
.
sbox
=
wx
.
StaticBox
(
self
,
-
1
,
"Generating and displaying keys"
)
self
.
sbox_sizer
=
wx
.
StaticBoxSizer
(
self
.
sbox
,
wx
.
HORIZONTAL
)
vbox1
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
# Generating and displaying keys
step1_sbox
=
wx
.
StaticBox
(
panel
,
-
1
,
"Generating and displaying keys"
)
step1_sbox_sizer
=
wx
.
StaticBoxSizer
(
step1_sbox
,
wx
.
HORIZONTAL
)
hbox1
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
generate_btn
=
wx
.
Button
(
panel
,
label
=
"Generate"
)
display_btn
=
wx
.
Button
(
panel
,
label
=
"Display"
)
hbox1
.
Add
(
generate_btn
,
0
,
wx
.
LEFT
|
wx
.
ALL
,
2
)
hbox1
.
Add
(
display_btn
,
0
,
wx
.
LEFT
|
wx
.
ALL
,
2
)
step1_sbox_sizer
.
Add
(
hbox1
,
0
,
wx
.
LEFT
|
wx
.
ALL
,
2
)
# Generating and displaying bootloader settings
step2_sbox
=
wx
.
StaticBox
(
panel
,
-
1
,
"Generating and displaying bootloader settings"
)
step2_sbox_sizer
=
wx
.
StaticBoxSizer
(
step2_sbox
,
wx
.
HORIZONTAL
)
self
.
hbox
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
# item
self
.
generate_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Generate"
)
self
.
display_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Display"
)
self
.
hbox
.
Add
(
self
.
generate_btn
,
0
,
wx
.
LEFT
|
wx
.
ALL
,
2
)
self
.
hbox
.
Add
(
self
.
display_btn
,
0
,
wx
.
LEFT
|
wx
.
ALL
,
2
)
self
.
sbox_sizer
.
Add
(
self
.
hbox
,
0
,
wx
.
LEFT
|
wx
.
ALL
,
2
)
self
.
vbox
.
Add
(
self
.
sbox_sizer
,
0
,
wx
.
ALL
|
wx
.
ALIGN_LEFT
,
2
)
self
.
SetSizer
(
self
.
vbox
)
step2_gbs
=
wx
.
GridBagSizer
(
2
,
2
)
family_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"--family"
)
family_select
=
[
"NRF51"
,
"NRF52"
,
"NRF52QFAB"
,
"NRF52810"
,
"NRF52840"
]
family_cbo
=
wx
.
ComboBox
(
panel
,
choices
=
family_select
,
value
=
family_select
[
1
],
style
=
wx
.
CB_READONLY
class
GenerateBlSettings
(
wx
.
Panel
):
"""Generating and displaying bootloader settings"""
def
__init__
(
self
,
parent
):
super
(
GenerateBlSettings
,
self
).
__init__
(
parent
)
self
.
vbox
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
# group
self
.
sbox
=
wx
.
StaticBox
(
self
,
-
1
,
"Generating and displaying bootloader settings"
)
self
.
sbox_sizer
=
wx
.
StaticBoxSizer
(
self
.
sbox
,
wx
.
HORIZONTAL
)
boot_version_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"--bootloader-version"
)
boot_version
=
wx
.
TextCtrl
(
panel
,
-
1
,
value
=
"1"
)
self
.
gbs
=
wx
.
GridBagSizer
(
2
,
2
)
bl_settings_txt
=
wx
.
StaticText
(
panel
,
-
1
,
label
=
"--bl-settings-version
"
)
bl_settings_sel
=
[
"1 (=SDK 12.0)"
,
"2 (>=SDK 15.3.0)
"
]
bl_settings
_cbo
=
wx
.
ComboBox
(
panel
,
choices
=
bl_settings_sel
,
value
=
bl_settings_sel
[
1
],
self
.
family_title
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"--family
"
)
self
.
family_list
=
[
"NRF51"
,
"NRF52"
,
"NRF52QFAB"
,
"NRF52810"
,
"NRF52840
"
]
self
.
family
_cbo
=
wx
.
ComboBox
(
self
.
sbox
,
choices
=
self
.
family_list
,
value
=
self
.
family_list
[
1
],
style
=
wx
.
CB_READONLY
,
)
app_version_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"--application-version"
)
app_version
=
wx
.
TextCtrl
(
panel
,
-
1
,
value
=
"10"
)
app_path_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"--application"
)
app_path_display
=
wx
.
TextCtrl
(
panel
,
style
=
wx
.
TE_READONLY
)
app_path_btn
=
wx
.
Button
(
panel
,
label
=
"Load"
)
apply2_btn
=
wx
.
Button
(
panel
,
label
=
"Generate"
)
step2_gbs
.
Add
(
family_txt
,
pos
=
(
0
,
0
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
family_cbo
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
boot_version_txt
,
pos
=
(
1
,
0
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
boot_version
,
pos
=
(
1
,
1
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
bl_settings_txt
,
pos
=
(
2
,
0
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
bl_settings_cbo
,
pos
=
(
2
,
1
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
app_version_txt
,
pos
=
(
3
,
0
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
app_version
,
pos
=
(
3
,
1
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
app_path_txt
,
pos
=
(
4
,
0
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
app_path_display
,
pos
=
(
4
,
1
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
app_path_btn
,
pos
=
(
4
,
2
),
flag
=
wx
.
ALL
)
step2_gbs
.
Add
(
apply2_btn
,
pos
=
(
5
,
2
),
flag
=
wx
.
ALL
)
step2_sbox_sizer
.
Add
(
step2_gbs
,
0
,
wx
.
ALL
|
wx
.
LEFT
,
2
)
# Merging files into a single file
step3_sbox
=
wx
.
StaticBox
(
panel
,
-
1
,
"Merging files into a single file"
)
step3_sbox_sizer
=
wx
.
StaticBoxSizer
(
step3_sbox
,
wx
.
HORIZONTAL
)
step3_gbs
=
wx
.
GridBagSizer
(
2
,
2
)
sd_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"softdevice"
)
sd_path_txt
=
wx
.
TextCtrl
(
panel
,
style
=
wx
.
TE_READONLY
)
sd_load_btn
=
wx
.
Button
(
panel
,
label
=
"Load"
)
bl_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"bootloader"
)
bl_path_txt
=
wx
.
TextCtrl
(
panel
,
style
=
wx
.
TE_READONLY
)
bl_load_btn
=
wx
.
Button
(
panel
,
label
=
"Load"
)
app_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"application"
)
app_path_txt
=
wx
.
TextCtrl
(
panel
,
style
=
wx
.
TE_READONLY
)
app_load_btn
=
wx
.
Button
(
panel
,
label
=
"Load"
)
settings_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"settings"
)
settings_path_txt
=
wx
.
TextCtrl
(
panel
,
style
=
wx
.
TE_READONLY
)
settings_load_btn
=
wx
.
Button
(
panel
,
label
=
"Load"
)
apply3_btn
=
wx
.
Button
(
panel
,
label
=
"Generate"
)
step3_gbs
.
Add
(
sd_txt
,
pos
=
(
0
,
0
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
sd_path_txt
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
sd_load_btn
,
pos
=
(
0
,
2
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
bl_txt
,
pos
=
(
1
,
0
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
bl_path_txt
,
pos
=
(
1
,
1
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
bl_load_btn
,
pos
=
(
1
,
2
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
app_txt
,
pos
=
(
2
,
0
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
app_path_txt
,
pos
=
(
2
,
1
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
app_load_btn
,
pos
=
(
2
,
2
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
settings_txt
,
pos
=
(
3
,
0
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
settings_path_txt
,
pos
=
(
3
,
1
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
settings_load_btn
,
pos
=
(
3
,
2
),
flag
=
wx
.
ALL
)
step3_gbs
.
Add
(
apply3_btn
,
pos
=
(
4
,
2
),
flag
=
wx
.
ALL
)
step3_sbox_sizer
.
Add
(
step3_gbs
,
0
,
wx
.
ALL
|
wx
.
LEFT
,
2
)
# Generating DFU packages
step4_sbox
=
wx
.
StaticBox
(
panel
,
-
1
,
"Generating DFU packages"
)
step4_sbox_sizer
=
wx
.
StaticBoxSizer
(
step4_sbox
,
wx
.
HORIZONTAL
)
step4_gbs
=
wx
.
GridBagSizer
(
2
,
2
)
hw_version_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"--hw-version"
)
hw_version_select
=
[
"52"
]
hw_version
=
wx
.
ComboBox
(
panel
,
choices
=
hw_version_select
,
value
=
hw_version_select
[
0
],
self
.
boot_version_title
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"--bootloader-version"
)
self
.
boot_version
=
wx
.
TextCtrl
(
self
.
sbox
,
-
1
,
value
=
"1"
)
self
.
bl_settings_title
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
label
=
"--bl-settings-version"
)
self
.
bl_settings_list
=
[
"1 (=SDK 12.0)"
,
"2 (>=SDK 15.3.0)"
]
self
.
bl_settings_cbo
=
wx
.
ComboBox
(
self
.
sbox
,
choices
=
self
.
bl_settings_list
,
value
=
self
.
bl_settings_list
[
1
],
style
=
wx
.
CB_READONLY
,
)
sd_seq_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"--sd-req"
)
sd_seq_sel
=
[
"0x101 (s132_nrf52_7.2.0)"
,
"0xCB (s132_nrf52_7.0.1)"
]
sd_seq_cb
=
wx
.
ComboBox
(
panel
,
choices
=
sd_seq_sel
,
value
=
sd_seq_sel
[
0
],
style
=
wx
.
CB_READONLY
self
.
app_version_title
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"--application-version"
)
self
.
app_version
=
wx
.
TextCtrl
(
self
.
sbox
,
-
1
,
value
=
"10"
)
self
.
app_path_title
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"--application"
)
self
.
app_path_display
=
wx
.
TextCtrl
(
self
.
sbox
,
style
=
wx
.
TE_READONLY
)
self
.
app_path_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Load"
)
self
.
generate_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Generate"
)
self
.
gbs
.
Add
(
self
.
family_title
,
pos
=
(
0
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
family_cbo
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
boot_version_title
,
pos
=
(
1
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
boot_version
,
pos
=
(
1
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
bl_settings_title
,
pos
=
(
2
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
bl_settings_cbo
,
pos
=
(
2
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_version_title
,
pos
=
(
3
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_version
,
pos
=
(
3
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_path_title
,
pos
=
(
4
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_path_display
,
pos
=
(
4
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_path_btn
,
pos
=
(
4
,
2
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
generate_btn
,
pos
=
(
5
,
2
),
flag
=
wx
.
ALL
)
self
.
sbox_sizer
.
Add
(
self
.
gbs
,
0
,
wx
.
ALL
|
wx
.
LEFT
,
2
)
self
.
vbox
.
Add
(
self
.
sbox_sizer
,
0
,
wx
.
ALL
|
wx
.
ALIGN_LEFT
,
2
)
self
.
SetSizer
(
self
.
vbox
)
class
MergeFile
(
wx
.
Panel
):
"""Merging files into a single file"""
def
__init__
(
self
,
parent
):
super
(
MergeFile
,
self
).
__init__
(
parent
)
self
.
vbox
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
# group
self
.
sbox
=
wx
.
StaticBox
(
self
,
-
1
,
"Merging files into a single file"
)
self
.
sbox_sizer
=
wx
.
StaticBoxSizer
(
self
.
sbox
,
wx
.
HORIZONTAL
)
self
.
gbs
=
wx
.
GridBagSizer
(
2
,
2
)
self
.
sd_txt
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"softdevice"
)
self
.
sd_path_txt
=
wx
.
TextCtrl
(
self
.
sbox
,
style
=
wx
.
TE_READONLY
)
self
.
sd_load_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Load"
)
self
.
bl_txt
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"bootloader"
)
self
.
bl_path_txt
=
wx
.
TextCtrl
(
self
.
sbox
,
style
=
wx
.
TE_READONLY
)
self
.
bl_load_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Load"
)
self
.
app_txt
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"application"
)
self
.
app_path_txt
=
wx
.
TextCtrl
(
self
.
sbox
,
style
=
wx
.
TE_READONLY
)
self
.
app_load_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Load"
)
self
.
settings_txt
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"settings"
)
self
.
settings_path_txt
=
wx
.
TextCtrl
(
self
.
sbox
,
style
=
wx
.
TE_READONLY
)
self
.
settings_load_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Load"
)
self
.
generate_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Generate"
)
self
.
gbs
.
Add
(
self
.
sd_txt
,
pos
=
(
0
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
sd_path_txt
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
sd_load_btn
,
pos
=
(
0
,
2
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
bl_txt
,
pos
=
(
1
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
bl_path_txt
,
pos
=
(
1
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
bl_load_btn
,
pos
=
(
1
,
2
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_txt
,
pos
=
(
2
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_path_txt
,
pos
=
(
2
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_load_btn
,
pos
=
(
2
,
2
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
settings_txt
,
pos
=
(
3
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
settings_path_txt
,
pos
=
(
3
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
settings_load_btn
,
pos
=
(
3
,
2
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
generate_btn
,
pos
=
(
4
,
2
),
flag
=
wx
.
ALL
)
self
.
sbox_sizer
.
Add
(
self
.
gbs
,
0
,
wx
.
ALL
|
wx
.
LEFT
,
2
)
self
.
vbox
.
Add
(
self
.
sbox_sizer
,
0
,
wx
.
ALL
|
wx
.
ALIGN_LEFT
,
2
)
self
.
SetSizer
(
self
.
vbox
)
class
GenerateDfuPackage
(
wx
.
Panel
):
def
__init__
(
self
,
parent
):
super
(
GenerateDfuPackage
,
self
).
__init__
(
parent
)
self
.
vbox
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
# group
self
.
sbox
=
wx
.
StaticBox
(
self
,
-
1
,
"Generating DFU packages"
)
self
.
sbox_sizer
=
wx
.
StaticBoxSizer
(
self
.
sbox
,
wx
.
HORIZONTAL
)
self
.
gbs
=
wx
.
GridBagSizer
(
2
,
2
)
self
.
hw_version_txt
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"--hw-version"
)
self
.
hw_version_select
=
[
"52"
]
self
.
hw_version
=
wx
.
ComboBox
(
self
.
sbox
,
choices
=
self
.
hw_version_select
,
value
=
self
.
hw_version_select
[
0
],
style
=
wx
.
CB_READONLY
,
)
application_version_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"--application-version"
)
application_version
=
wx
.
TextCtrl
(
panel
,
value
=
"1"
)
app_file_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"--application"
)
app_file_path
=
wx
.
TextCtrl
(
panel
,
style
=
wx
.
TE_READONLY
)
app_file_load_btn
=
wx
.
Button
(
panel
,
label
=
"Load"
)
key_file_txt
=
wx
.
StaticText
(
panel
,
-
1
,
"--key-file"
)
key_file_path
=
wx
.
TextCtrl
(
panel
,
style
=
wx
.
TE_READONLY
)
key_file_load_btn
=
wx
.
Button
(
panel
,
label
=
"Load"
)
step4_gbs
.
Add
(
hw_version_txt
,
pos
=
(
0
,
0
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
hw_version
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
sd_seq_txt
,
pos
=
(
1
,
0
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
sd_seq_cb
,
pos
=
(
1
,
1
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
application_version_txt
,
pos
=
(
2
,
0
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
application_version
,
pos
=
(
2
,
1
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
app_file_txt
,
pos
=
(
3
,
0
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
app_file_path
,
pos
=
(
3
,
1
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
app_file_load_btn
,
pos
=
(
3
,
2
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
key_file_txt
,
pos
=
(
4
,
0
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
key_file_path
,
pos
=
(
4
,
1
),
flag
=
wx
.
ALL
)
step4_gbs
.
Add
(
key_file_load_btn
,
pos
=
(
4
,
2
),
flag
=
wx
.
ALL
)
step4_sbox_sizer
.
Add
(
step4_gbs
,
0
,
wx
.
ALL
|
wx
.
LEFT
,
2
)
vbox1
.
Add
(
step1_sbox_sizer
,
0
,
wx
.
ALL
|
wx
.
ALIGN_LEFT
,
2
)
vbox1
.
Add
(
step2_sbox_sizer
,
0
,
wx
.
ALL
|
wx
.
ALIGN_LEFT
,
2
)
vbox1
.
Add
(
step3_sbox_sizer
,
0
,
wx
.
ALL
|
wx
.
ALIGN_LEFT
,
2
)
vbox1
.
Add
(
step4_sbox_sizer
,
0
,
wx
.
ALL
|
wx
.
ALIGN_LEFT
,
2
)
## right panel
vbox2
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
sd_seq_txt
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"--sd-req"
)
self
.
sd_seq_sel
=
[
"0x101 (s132_nrf52_7.2.0)"
,
"0xCB (s132_nrf52_7.0.1)"
]
self
.
sd_seq_cb
=
wx
.
ComboBox
(
self
.
sbox
,
choices
=
self
.
sd_seq_sel
,
value
=
self
.
sd_seq_sel
[
0
],
style
=
wx
.
CB_READONLY
,
)
right_box
=
wx
.
StaticBox
(
panel
,
-
1
,
"Logging"
)
right_boxsizer
=
wx
.
StaticBoxSizer
(
right_box
,
wx
.
VERTICAL
)
log_ctrl
=
wx
.
TextCtrl
(
right_box
,
self
.
application_version_txt
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"--application-version"
)
self
.
application_version
=
wx
.
TextCtrl
(
self
.
sbox
,
value
=
"1"
)
self
.
app_file_txt
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"--application"
)
self
.
app_file_path
=
wx
.
TextCtrl
(
self
.
sbox
,
style
=
wx
.
TE_READONLY
)
self
.
app_file_load_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Load"
)
self
.
key_file_txt
=
wx
.
StaticText
(
self
.
sbox
,
-
1
,
"--key-file"
)
self
.
key_file_path
=
wx
.
TextCtrl
(
self
.
sbox
,
style
=
wx
.
TE_READONLY
)
self
.
key_file_load_btn
=
wx
.
Button
(
self
.
sbox
,
label
=
"Load"
)
self
.
gbs
.
Add
(
self
.
hw_version_txt
,
pos
=
(
0
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
hw_version
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
sd_seq_txt
,
pos
=
(
1
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
sd_seq_cb
,
pos
=
(
1
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
application_version_txt
,
pos
=
(
2
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
application_version
,
pos
=
(
2
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_file_txt
,
pos
=
(
3
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_file_path
,
pos
=
(
3
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
app_file_load_btn
,
pos
=
(
3
,
2
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
key_file_txt
,
pos
=
(
4
,
0
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
key_file_path
,
pos
=
(
4
,
1
),
flag
=
wx
.
ALL
)
self
.
gbs
.
Add
(
self
.
key_file_load_btn
,
pos
=
(
4
,
2
),
flag
=
wx
.
ALL
)
self
.
sbox_sizer
.
Add
(
self
.
gbs
,
0
,
wx
.
ALL
|
wx
.
LEFT
,
2
)
self
.
vbox
.
Add
(
self
.
sbox_sizer
,
0
,
wx
.
ALL
|
wx
.
ALIGN_LEFT
,
2
)
self
.
SetSizer
(
self
.
vbox
)
class
Logger
(
wx
.
Panel
):
def
__init__
(
self
,
parent
):
super
(
Logger
,
self
).
__init__
(
parent
)
self
.
vbox
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
# group
self
.
sbox
=
wx
.
StaticBox
(
self
,
-
1
,
"Logging"
)
self
.
sbox_sizer
=
wx
.
StaticBoxSizer
(
self
.
sbox
,
wx
.
VERTICAL
)
self
.
log_ctrl
=
wx
.
TextCtrl
(
self
.
sbox
,
size
=
(
400
,
600
),
style
=
wx
.
TC_MULTILINE
|
wx
.
TE_READONLY
|
wx
.
VSCROLL
|
wx
.
TE_RICH2
,
)
# log_ctrl.SetForegroundColour(wx.WHITE)
# log_ctrl.SetBackgroundColour(wx.BLACK)
log_ctrl
.
SetBackgroundColour
(
wx
.
WHITE
)
log_ctrl
.
SetValue
(
"hello00000000000000000000000000000000000000000000000"
)
right_boxsizer
.
Add
(
log_ctrl
,
proportion
=
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
vbox2
.
Add
(
right_boxsizer
)
self
.
log_ctrl
.
SetBackgroundColour
(
wx
.
WHITE
)
self
.
sbox_sizer
.
Add
(
self
.
log_ctrl
,
proportion
=
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
self
.
vbox
.
Add
(
self
.
sbox_sizer
)
self
.
SetSizer
(
self
.
vbox
)
class
NrfutilGui
(
wx
.
Frame
):
def
__init__
(
self
,
parent
):
wx
.
Frame
.
__init__
(
self
,
parent
,
style
=
wx
.
DEFAULT_FRAME_STYLE
^
wx
.
RESIZE_BORDER
,
title
=
"Nrfutil Tool v1.0"
,
size
=
(
800
,
650
),
)
self
.
initFrame
()
def
initFrame
(
self
):
panel
=
wx
.
Panel
(
self
)
hbox
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
vbox1
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
vbox1
.
Add
(
GenerateKey
(
panel
),
0
,
wx
.
ALL
|
wx
.
EXPAND
,
1
)
vbox1
.
Add
(
GenerateBlSettings
(
panel
),
0
,
wx
.
ALL
|
wx
.
EXPAND
,
1
)
vbox1
.
Add
(
MergeFile
(
panel
),
0
,
wx
.
ALL
|
wx
.
EXPAND
,
1
)
vbox1
.
Add
(
GenerateDfuPackage
(
panel
),
0
,
wx
.
ALL
|
wx
.
EXPAND
,
1
)
vbox2
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
vbox2
.
Add
(
Logger
(
panel
))
hbox
.
Add
(
vbox1
)
hbox
.
Add
(
vbox2
)
panel
.
SetSizer
(
hbox
)
ico
=
wx
.
Icon
(
"configs/title.ico"
,
type
=
BITMAP_TYPE_ICO
)
self
.
SetIcon
(
ico
)
# display
self
.
SetSize
(
800
,
650
)
self
.
SetTitle
(
"Nrfutil Tool"
)
self
.
Layout
()
self
.
Centre
()
self
.
Show
(
True
)
def
main
():
app
=
wx
.
App
()
ng
=
NrfutilGui
(
None
,
style
=
wx
.
DEFAULT_FRAME_STYLE
^
wx
.
RESIZE_BORDER
)
app
=
wx
.
App
(
False
)
ng
=
NrfutilGui
(
None
)
app
.
MainLoop
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录