Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
0f40dd6a
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
0f40dd6a
编写于
9月 05, 2018
作者:
W
weety
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Check if the configuration file needs to be saved when the configuration exits.
上级
ce54828e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
1 deletion
+50
-1
tools/pymenuconfig.py
tools/pymenuconfig.py
+50
-1
未找到文件。
tools/pymenuconfig.py
浏览文件 @
0f40dd6a
...
...
@@ -783,7 +783,7 @@ class MenuConfig(object):
pos
=
[]
for
n
in
self
.
node_stack
+
[
self
.
node
]:
pos
.
append
(
n
.
prompt
[
0
]
if
n
.
prompt
else
'[none]'
)
self
.
label_position
[
'text'
]
=
u
'# '
+
u
'
→
'
.
join
(
pos
)
self
.
label_position
[
'text'
]
=
u
'# '
+
u
'
->
'
.
join
(
pos
)
def
show_node
(
self
,
node
):
self
.
node
=
node
...
...
@@ -934,6 +934,53 @@ class MenuConfig(object):
self
.
status_string
))
def
_check_is_visible
(
self
,
node
):
v
=
True
v
=
v
and
node
.
prompt
is
not
None
# It should be enough to check if prompt expression is not false and
# for menu nodes whether 'visible if' is not false
v
=
v
and
kconfiglib
.
expr_value
(
node
.
prompt
[
1
])
>
0
if
node
.
item
==
kconfiglib
.
MENU
:
v
=
v
and
kconfiglib
.
expr_value
(
node
.
visibility
)
>
0
# If node references Symbol, then we also account for symbol visibility
# TODO: need to re-think whether this is needed
if
isinstance
(
node
.
item
,
kconfiglib
.
Symbol
):
if
node
.
item
.
type
in
(
kconfiglib
.
BOOL
,
kconfiglib
.
TRISTATE
):
v
=
v
and
len
(
node
.
item
.
assignable
)
>
0
else
:
v
=
v
and
node
.
item
.
visibility
>
0
return
v
def
config_is_changed
(
self
):
is_changed
=
False
node
=
self
.
kconfig
.
top_node
.
list
if
not
node
:
# Empty configuration
return
is_changed
while
1
:
item
=
node
.
item
if
isinstance
(
item
,
kconfiglib
.
Symbol
)
and
item
.
user_value
is
None
and
self
.
_check_is_visible
(
node
):
is_changed
=
True
print
(
"Config
\"
# {}
\"
has changed, need save config file
\n
"
.
format
(
node
.
prompt
[
0
]))
break
;
# Iterative tree walk using parent pointers
if
node
.
list
:
node
=
node
.
list
elif
node
.
next
:
node
=
node
.
next
else
:
while
node
.
parent
:
node
=
node
.
parent
if
node
.
next
:
node
=
node
.
next
break
else
:
break
return
is_changed
def
prevent_losing_changes
(
self
):
"""
Checks if there are unsaved changes and asks user to save or discard them
...
...
@@ -945,6 +992,8 @@ class MenuConfig(object):
- True: caller may safely drop current config state
- False: user needs to continue work on current config ('Cancel' pressed or saving failed)
"""
if
self
.
config_is_changed
()
==
True
:
self
.
mark_as_changed
()
if
not
self
.
unsaved_changes
:
return
True
res
=
messagebox
.
askyesnocancel
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录