Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
26cce712
G
glances
项目概览
蜕变的菜鸟
/
glances
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
glances
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
26cce712
编写于
2月 16, 2020
作者:
B
Bartlomiej Cieszkowski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
text wrap was due to size of screen being different than subwindows size, use term_window sizing
上级
4969c190
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
25 deletion
+24
-25
glances/outputs/glances_curses.py
glances/outputs/glances_curses.py
+24
-25
未找到文件。
glances/outputs/glances_curses.py
浏览文件 @
26cce712
...
...
@@ -480,7 +480,7 @@ class _GlancesCurses(object):
plugin_max_width
=
None
if
p
in
self
.
_left_sidebar
:
plugin_max_width
=
max
(
self
.
_left_sidebar_min_width
,
self
.
screen
.
getmaxyx
()[
1
]
-
105
)
self
.
term_window
.
getmaxyx
()[
1
]
-
105
)
plugin_max_width
=
min
(
self
.
_left_sidebar_max_width
,
plugin_max_width
)
...
...
@@ -516,7 +516,7 @@ class _GlancesCurses(object):
# Adapt number of processes to the available space
max_processes_displayed
=
(
self
.
screen
.
getmaxyx
()[
0
]
-
11
-
self
.
term_window
.
getmaxyx
()[
0
]
-
11
-
(
0
if
'docker'
not
in
__stat_display
else
self
.
get_stats_display_height
(
__stat_display
[
"docker"
]))
-
(
0
if
'processcount'
not
in
__stat_display
else
...
...
@@ -619,7 +619,7 @@ class _GlancesCurses(object):
l_uptime
+=
self
.
get_stats_display_width
(
stat_display
[
i
])
self
.
display_plugin
(
stat_display
[
"system"
],
display_optional
=
(
self
.
screen
.
getmaxyx
()[
1
]
>=
l_uptime
))
display_optional
=
(
self
.
term_window
.
getmaxyx
()[
1
]
>=
l_uptime
))
self
.
space_between_column
=
3
if
'ip'
in
stat_display
:
self
.
new_column
()
...
...
@@ -658,9 +658,9 @@ class _GlancesCurses(object):
if
not
self
.
args
.
disable_quicklook
:
# Quick look is in the place !
if
self
.
args
.
full_quicklook
:
quicklook_width
=
self
.
screen
.
getmaxyx
()[
1
]
-
(
stats_width
+
8
+
stats_number
*
self
.
space_between_column
)
quicklook_width
=
self
.
term_window
.
getmaxyx
()[
1
]
-
(
stats_width
+
8
+
stats_number
*
self
.
space_between_column
)
else
:
quicklook_width
=
min
(
self
.
screen
.
getmaxyx
()[
1
]
-
(
stats_width
+
8
+
stats_number
*
self
.
space_between_column
),
quicklook_width
=
min
(
self
.
term_window
.
getmaxyx
()[
1
]
-
(
stats_width
+
8
+
stats_number
*
self
.
space_between_column
),
self
.
_quicklook_max_width
-
5
)
try
:
stat_display
[
"quicklook"
]
=
stats
.
get_plugin
(
...
...
@@ -680,14 +680,14 @@ class _GlancesCurses(object):
for
p
in
self
.
_top
:
plugin_display_optional
[
p
]
=
True
if
stats_number
>
1
:
self
.
space_between_column
=
max
(
1
,
int
((
self
.
screen
.
getmaxyx
()[
1
]
-
stats_width
)
/
(
stats_number
-
1
)))
self
.
space_between_column
=
max
(
1
,
int
((
self
.
term_window
.
getmaxyx
()[
1
]
-
stats_width
)
/
(
stats_number
-
1
)))
for
p
in
[
'mem'
,
'cpu'
]:
# No space ? Remove optional stats
if
self
.
space_between_column
<
3
:
plugin_display_optional
[
p
]
=
False
plugin_widths
[
p
]
=
self
.
get_stats_display_width
(
stat_display
[
p
],
without_option
=
True
)
if
hasattr
(
self
.
args
,
'disable_'
+
p
)
else
0
stats_width
=
sum
(
itervalues
(
plugin_widths
))
+
1
self
.
space_between_column
=
max
(
1
,
int
((
self
.
screen
.
getmaxyx
()[
1
]
-
stats_width
)
/
(
stats_number
-
1
)))
self
.
space_between_column
=
max
(
1
,
int
((
self
.
term_window
.
getmaxyx
()[
1
]
-
stats_width
)
/
(
stats_number
-
1
)))
else
:
self
.
space_between_column
=
0
...
...
@@ -727,7 +727,7 @@ class _GlancesCurses(object):
docker + processcount + amps + processlist + alert
"""
# Do not display anything if space is not available...
if
self
.
screen
.
getmaxyx
()[
1
]
<
self
.
_left_sidebar_min_width
:
if
self
.
term_window
.
getmaxyx
()[
1
]
<
self
.
_left_sidebar_min_width
:
return
# Restore line position
...
...
@@ -744,9 +744,9 @@ class _GlancesCurses(object):
self
.
new_line
()
if
p
==
'processlist'
:
self
.
display_plugin
(
stat_display
[
'processlist'
],
display_optional
=
(
self
.
screen
.
getmaxyx
()[
1
]
>
102
),
display_optional
=
(
self
.
term_window
.
getmaxyx
()[
1
]
>
102
),
display_additional
=
(
not
MACOS
),
max_y
=
(
self
.
screen
.
getmaxyx
()[
0
]
-
self
.
get_stats_display_height
(
stat_display
[
'alert'
])
-
2
))
max_y
=
(
self
.
term_window
.
getmaxyx
()[
0
]
-
self
.
get_stats_display_height
(
stat_display
[
'alert'
])
-
2
))
else
:
self
.
display_plugin
(
stat_display
[
p
])
...
...
@@ -780,8 +780,8 @@ class _GlancesCurses(object):
size_x
+=
input_size
if
size_y
is
None
:
size_y
=
len
(
sentence_list
)
+
4
screen_x
=
self
.
screen
.
getmaxyx
()[
1
]
screen_y
=
self
.
screen
.
getmaxyx
()[
0
]
screen_x
=
self
.
term_window
.
getmaxyx
()[
1
]
screen_y
=
self
.
term_window
.
getmaxyx
()[
0
]
if
size_x
>
screen_x
or
size_y
>
screen_y
:
# No size to display the popup => abord
return
False
...
...
@@ -798,7 +798,7 @@ class _GlancesCurses(object):
for
y
,
m
in
enumerate
(
message
.
split
(
'
\n
'
)):
popup
.
addnstr
(
2
+
y
,
2
,
m
,
len
(
m
))
if
is_input
and
not
WINDOWS
:
if
is_input
:
# Create a subwindow for the text field
subpop
=
popup
.
derwin
(
1
,
input_size
,
2
,
2
+
len
(
m
))
subpop
.
attron
(
self
.
colors_list
[
'FILTER'
])
...
...
@@ -848,8 +848,8 @@ class _GlancesCurses(object):
return
0
# Get the screen size
screen_x
=
self
.
screen
.
getmaxyx
()[
1
]
screen_y
=
self
.
screen
.
getmaxyx
()[
0
]
screen_x
=
self
.
term_window
.
getmaxyx
()[
1
]
screen_y
=
self
.
term_window
.
getmaxyx
()[
0
]
# Set the upper/left position of the message
if
plugin_stats
[
'align'
]
==
'right'
:
...
...
@@ -1034,15 +1034,14 @@ class GlancesCursesClient(_GlancesCurses):
pass
if
not
WINDOWS
:
class
GlancesTextbox
(
Textbox
,
object
):
class
GlancesTextbox
(
Textbox
,
object
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
GlancesTextbox
,
self
).
__init__
(
*
args
,
**
kwargs
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
GlancesTextbox
,
self
).
__init__
(
*
args
,
**
kwargs
)
def
do_command
(
self
,
ch
):
if
ch
==
10
:
# Enter
return
0
if
ch
==
127
:
# Back
return
8
return
super
(
GlancesTextbox
,
self
).
do_command
(
ch
)
def
do_command
(
self
,
ch
):
if
ch
==
10
:
# Enter
return
0
if
ch
==
127
:
# Back
return
8
return
super
(
GlancesTextbox
,
self
).
do_command
(
ch
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录