Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Build Lite
提交
f5f6f934
B
Build Lite
项目概览
OpenHarmony
/
Build Lite
大约 1 年 前同步成功
通知
22
Star
24
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
Build Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f5f6f934
编写于
4月 14, 2021
作者:
P
pilipala195
提交者:
Gitee
4月 14, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hb product selection page optimized, split by company name
上级
311c05d5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
19 deletion
+29
-19
hb/common/device.py
hb/common/device.py
+1
-1
hb/common/product.py
hb/common/product.py
+13
-3
hb/cts/common.py
hb/cts/common.py
+3
-4
hb/cts/list.py
hb/cts/list.py
+12
-7
hb/cts/menuconfig.py
hb/cts/menuconfig.py
+0
-4
未找到文件。
hb/common/device.py
浏览文件 @
f5f6f934
...
...
@@ -51,7 +51,7 @@ class Device():
menu
=
Menuconfig
()
kernel
=
menu
.
list_promt
(
'kernel'
,
'Which kernel do you need?'
,
choices
).
get
(
'kernel'
)
choices
).
get
(
'kernel'
)
[
0
]
return
kernel_path_dict
.
get
(
kernel
),
kernel
.
split
(
'@'
)[
0
],
\
os
.
path
.
basename
(
cwd
)
...
...
hb/common/product.py
浏览文件 @
f5f6f934
...
...
@@ -21,6 +21,7 @@ from collections import defaultdict
from
hb.common.utils
import
read_json_file
from
hb.common.config
import
Config
from
hb.cts.menuconfig
import
Menuconfig
from
hb.cts.common
import
Separator
class
Product
():
...
...
@@ -93,16 +94,25 @@ class Product():
@
staticmethod
def
product_menuconfig
():
product_path_dict
=
{}
company_separator
=
None
for
company
,
product
,
product_path
in
Product
.
get_products
():
if
company_separator
is
None
or
company_separator
!=
company
:
company_separator
=
company
product_key
=
Separator
(
company_separator
)
product_path_dict
[
product_key
]
=
None
product_path_dict
[
'{}@{}'
.
format
(
product
,
company
)]
=
product_path
if
not
len
(
product_path_dict
):
raise
Exception
(
'no valid product found'
)
choices
=
[{
'name'
:
product
}
for
product
in
product_path_dict
.
keys
()]
choices
=
[
product
if
isinstance
(
product
,
Separator
)
else
{
'name'
:
product
.
split
(
'@'
)[
0
],
'value'
:
product
.
split
(
'@'
)[
1
]}
for
product
in
product_path_dict
.
keys
()]
menu
=
Menuconfig
()
product
=
menu
.
list_promt
(
'product'
,
'Which product do you need?'
,
choices
).
get
(
'product'
)
return
product_path_dict
.
get
(
product
),
product
.
split
(
'@'
)
[
0
]
product_key
=
f
'
{
product
[
0
]
}
@
{
product
[
1
]
}
'
return
product_path_dict
.
get
(
product
_key
),
product
[
0
]
hb/cts/common.py
浏览文件 @
f5f6f934
...
...
@@ -16,7 +16,6 @@
# limitations under the License.
import
os
import
json
try
:
from
queue
import
Queue
except
ImportError
:
...
...
@@ -33,7 +32,7 @@ from hb.common.utils import read_json_file
def
get_style
(
style_type
):
if
style_type
==
'terminal'
:
return
style_from_dict
({
Token
.
Separator
:
'#
6C6C6C
'
,
Token
.
Separator
:
'#
75c951
'
,
Token
.
QuestionMark
:
'#5F819D'
,
Token
.
Selected
:
''
,
# default
Token
.
Pointer
:
'#FF9D00 bold'
,
# AWS orange
...
...
@@ -43,7 +42,7 @@ def get_style(style_type):
})
if
style_type
==
'answer'
:
return
style_from_dict
({
Token
.
Separator
:
'#
cc5454
'
,
Token
.
Separator
:
'#
75c951
'
,
Token
.
QuestionMark
:
'#E91E63 bold'
,
Token
.
Selected
:
'#cc5454'
,
# default
Token
.
Pointer
:
'#ed9164 bold'
,
...
...
@@ -189,7 +188,7 @@ class Separator(object):
def
__init__
(
self
,
line
=
None
):
if
line
:
self
.
line
=
line
self
.
line
=
f
'
\n
{
line
}
'
def
__str__
(
self
):
return
self
.
line
hb/cts/list.py
浏览文件 @
f5f6f934
...
...
@@ -88,12 +88,17 @@ class InquirerControl(TokenListControl):
tokens
.
append
((
token
.
Selected
if
selected
else
token
,
'- %s (%s)'
%
(
choice
[
0
],
choice
[
2
])))
else
:
try
:
tokens
.
append
((
token
.
Selected
if
selected
else
token
,
str
(
choice
[
0
]),
select_item
))
except
Exception
:
tokens
.
append
((
token
.
Selected
if
selected
else
token
,
choice
[
0
],
select_item
))
if
isinstance
(
choice
[
0
],
Separator
):
tokens
.
append
((
token
.
Separator
,
str
(
choice
[
0
]),
select_item
))
else
:
try
:
tokens
.
append
((
token
.
Selected
if
selected
else
token
,
str
(
choice
[
0
]),
select_item
))
except
Exception
:
tokens
.
append
((
token
.
Selected
if
selected
else
token
,
choice
[
0
],
select_item
))
tokens
.
append
((
token
,
'
\n
'
))
# prepare the select choices
...
...
@@ -175,7 +180,7 @@ def question(message, **kwargs):
@
manager
.
registry
.
add_binding
(
Keys
.
Enter
,
eager
=
True
)
def
set_answer
(
event
):
inquirer_control
.
answered
=
True
event
.
cli
.
set_return_value
(
inquirer_control
.
get_selection
()
[
1
]
)
event
.
cli
.
set_return_value
(
inquirer_control
.
get_selection
())
return
Application
(
layout
=
layout
,
...
...
hb/cts/menuconfig.py
浏览文件 @
f5f6f934
...
...
@@ -15,12 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
from
hb.cts.prompt
import
prompt
from
hb.cts.common
import
Separator
from
hb.cts.common
import
get_style
from
hb.cts.cts
import
CTS
from
hb.common.utils
import
hb_info
class
Menuconfig
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录