Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
36e788f2
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 搜索 >>
提交
36e788f2
编写于
5月 09, 2016
作者:
N
Nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow theme to be set in configuration file #862
上级
53de48d0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
8 deletion
+35
-8
NEWS
NEWS
+2
-1
conf/glances.conf
conf/glances.conf
+8
-0
glances/client.py
glances/client.py
+1
-1
glances/outputs/glances_curses.py
glances/outputs/glances_curses.py
+23
-5
glances/standalone.py
glances/standalone.py
+1
-1
未找到文件。
NEWS
浏览文件 @
36e788f2
...
...
@@ -11,7 +11,8 @@ Enhancements and new features:
* Improve IP plugin to display public IP address (issue #646)
* CPU additionnal stats monitoring: Context switch, Interrupts... (issue #810)
* [Folders] Differentiate permission issue and non-existence of a directory (issue #828)
* [Web UI] add cpu name in quicklook plugin (issue #825)
* [Web UI] Add cpu name in quicklook plugin (issue #825)
* Allow theme to be set in configuration file (issue #862)
Bugs corrected:
...
...
conf/glances.conf
浏览文件 @
36e788f2
##############################################################################
# User interface
##############################################################################
[
outputs
]
# Theme name for the Curses interface: black or white
curse_theme
=
black
##############################################################################
# plugins
##############################################################################
...
...
glances/client.py
浏览文件 @
36e788f2
...
...
@@ -155,7 +155,7 @@ class GlancesClient(object):
self
.
stats
.
load_limits
(
self
.
config
)
# Init screen
self
.
screen
=
GlancesCursesClient
(
args
=
self
.
args
)
self
.
screen
=
GlancesCursesClient
(
config
=
self
.
config
,
args
=
self
.
args
)
# Return result
return
ret
...
...
glances/outputs/glances_curses.py
浏览文件 @
36e788f2
...
...
@@ -51,8 +51,9 @@ class _GlancesCurses(object):
Note: It is a private class, use GlancesCursesClient or GlancesCursesBrowser.
"""
def
__init__
(
self
,
args
=
None
):
# Init args
def
__init__
(
self
,
config
=
None
,
args
=
None
):
# Init
self
.
config
=
config
self
.
args
=
args
# Init windows positions
...
...
@@ -69,6 +70,11 @@ class _GlancesCurses(object):
logger
.
critical
(
"Cannot init the curses library.
\n
"
)
sys
.
exit
(
1
)
# Load the 'outputs' section of the configuration file
# - Init the theme (default is black)
self
.
theme
=
{
'name'
:
'black'
}
self
.
load_config
(
self
.
config
)
# Init cursor
self
.
_init_cursor
()
...
...
@@ -95,6 +101,18 @@ class _GlancesCurses(object):
# History tag
self
.
_init_history
()
def
load_config
(
self
,
config
):
'''Load the outputs section of the configuration file'''
# Load the theme
if
config
.
has_section
(
'outputs'
):
logger
.
debug
(
'Read the outputs section in the configuration file'
)
self
.
theme
[
'name'
]
=
config
.
get_value
(
'outputs'
,
'curse_theme'
,
default
=
'black'
)
logger
.
debug
(
'Theme for the curse interface: {0}'
.
format
(
self
.
theme
[
'name'
]))
def
is_theme
(
self
,
name
):
'''Return True if the theme *name* should be used'''
return
getattr
(
self
.
args
,
'theme_'
+
name
)
or
self
.
theme
[
'name'
]
==
name
def
_init_history
(
self
):
'''Init the history option'''
...
...
@@ -141,7 +159,7 @@ class _GlancesCurses(object):
if
curses
.
has_colors
():
# The screen is compatible with a colored design
if
self
.
args
.
theme_white
:
if
self
.
is_theme
(
'white'
)
:
# White theme: black ==> white
curses
.
init_pair
(
1
,
curses
.
COLOR_BLACK
,
-
1
)
else
:
...
...
@@ -165,14 +183,14 @@ class _GlancesCurses(object):
try
:
curses
.
init_pair
(
9
,
curses
.
COLOR_MAGENTA
,
-
1
)
except
Exception
:
if
self
.
args
.
theme_white
:
if
self
.
is_theme
(
'white'
)
:
curses
.
init_pair
(
9
,
curses
.
COLOR_BLACK
,
-
1
)
else
:
curses
.
init_pair
(
9
,
curses
.
COLOR_WHITE
,
-
1
)
try
:
curses
.
init_pair
(
10
,
curses
.
COLOR_CYAN
,
-
1
)
except
Exception
:
if
self
.
args
.
theme_white
:
if
self
.
is_theme
(
'white'
)
:
curses
.
init_pair
(
10
,
curses
.
COLOR_BLACK
,
-
1
)
else
:
curses
.
init_pair
(
10
,
curses
.
COLOR_WHITE
,
-
1
)
...
...
glances/standalone.py
浏览文件 @
36e788f2
...
...
@@ -75,7 +75,7 @@ class GlancesStandalone(object):
glances_processes
.
max_processes
=
50
# Init screen
self
.
screen
=
GlancesCursesStandalone
(
args
=
args
)
self
.
screen
=
GlancesCursesStandalone
(
config
=
config
,
args
=
args
)
@
property
def
quiet
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录