Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
e1c47695
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,发现更多精彩内容 >>
提交
e1c47695
编写于
5月 14, 2021
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pressing Q to get rid of irq not working #1792
上级
89d3cb09
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
41 addition
and
22 deletion
+41
-22
conf/glances.conf
conf/glances.conf
+1
-1
glances/compat.py
glances/compat.py
+12
-0
glances/main.py
glances/main.py
+1
-11
glances/outputs/glances_curses.py
glances/outputs/glances_curses.py
+24
-7
glances/plugins/glances_irq.py
glances/plugins/glances_irq.py
+1
-0
glances/plugins/glances_plugin.py
glances/plugins/glances_plugin.py
+2
-3
未找到文件。
conf/glances.conf
浏览文件 @
e1c47695
...
...
@@ -203,7 +203,7 @@ critical=90
[
irq
]
# Documentation: https://glances.readthedocs.io/en/stable/aoa/irq.html
# This plugin is disabled by default
disable
=
Fals
e
disable
=
Tru
e
[
folders
]
# Documentation: https://glances.readthedocs.io/en/stable/aoa/folders.html
...
...
glances/compat.py
浏览文件 @
e1c47695
...
...
@@ -283,3 +283,15 @@ def key_exist_value_not_none_not_v(k, d, v=''):
# - d[k] is not None
# - d[k] != v
return
k
in
d
and
d
[
k
]
is
not
None
and
d
[
k
]
!=
v
def
disable
(
class_name
,
var
):
"""Set disable_<var> to True in the class class_name."""
setattr
(
class_name
,
'enable_'
+
var
,
False
)
setattr
(
class_name
,
'disable_'
+
var
,
True
)
def
enable
(
class_name
,
var
):
"""Set disable_<var> to False in the class class_name."""
setattr
(
class_name
,
'enable_'
+
var
,
True
)
setattr
(
class_name
,
'disable_'
+
var
,
False
)
glances/main.py
浏览文件 @
e1c47695
...
...
@@ -24,22 +24,12 @@ import sys
import
tempfile
from
glances
import
__version__
,
psutil_version
from
glances.compat
import
input
from
glances.compat
import
input
,
disable
,
enable
from
glances.config
import
Config
from
glances.globals
import
WINDOWS
from
glances.logger
import
logger
,
LOG_FILENAME
def
disable
(
class_name
,
var
):
"""Set disable_<var> to True in the class class_name."""
setattr
(
class_name
,
'disable_'
+
var
,
True
)
def
enable
(
class_name
,
var
):
"""Set disable_<var> to False in the class class_name."""
setattr
(
class_name
,
'disable_'
+
var
,
False
)
class
GlancesMain
(
object
):
"""Main class to manage Glances instance."""
...
...
glances/outputs/glances_curses.py
浏览文件 @
e1c47695
...
...
@@ -23,7 +23,7 @@ from __future__ import unicode_literals
import
re
import
sys
from
glances.compat
import
to_ascii
,
nativestr
,
b
,
u
,
itervalues
from
glances.compat
import
to_ascii
,
nativestr
,
b
,
u
,
itervalues
,
enable
,
disable
from
glances.globals
import
MACOS
,
WINDOWS
from
glances.logger
import
logger
from
glances.events
import
glances_events
...
...
@@ -36,9 +36,11 @@ try:
import
curses.panel
from
curses.textpad
import
Textbox
except
ImportError
:
logger
.
critical
(
"Curses module not found. Glances cannot start in standalone mode."
)
logger
.
critical
(
"Curses module not found. Glances cannot start in standalone mode."
)
if
WINDOWS
:
logger
.
critical
(
"For Windows you can try installing windows-curses with pip install."
)
logger
.
critical
(
"For Windows you can try installing windows-curses with pip install."
)
sys
.
exit
(
1
)
...
...
@@ -348,10 +350,25 @@ class _GlancesCurses(object):
# Actions (available in the global hotkey dict)...
for
hotkey
in
self
.
_hotkeys
:
if
self
.
pressedkey
==
ord
(
hotkey
)
and
'switch'
in
self
.
_hotkeys
[
hotkey
]:
setattr
(
self
.
args
,
self
.
_hotkeys
[
hotkey
][
'switch'
],
not
getattr
(
self
.
args
,
self
.
_hotkeys
[
hotkey
][
'switch'
]))
if
self
.
_hotkeys
[
hotkey
][
'switch'
].
startswith
(
'enable_'
)
or
\
self
.
_hotkeys
[
hotkey
][
'switch'
].
startswith
(
'disable_'
):
# Enable / Disable switch
# Get the option name
# Ex: disable_foo return foo
# enable_foo_bar return foo_bar
option
=
'_'
.
join
(
self
.
_hotkeys
[
hotkey
][
'switch'
].
split
(
'_'
)[
1
:])
if
getattr
(
self
.
args
,
self
.
_hotkeys
[
hotkey
][
'switch'
]):
disable
(
self
.
args
,
option
)
else
:
enable
(
self
.
args
,
option
)
else
:
# Others switchs options (with no enable_ or disable_)
setattr
(
self
.
args
,
self
.
_hotkeys
[
hotkey
][
'switch'
],
not
getattr
(
self
.
args
,
self
.
_hotkeys
[
hotkey
][
'switch'
]))
if
self
.
pressedkey
==
ord
(
hotkey
)
and
'sort_key'
in
self
.
_hotkeys
[
hotkey
]:
glances_processes
.
set_sort_key
(
self
.
_hotkeys
[
hotkey
][
'sort_key'
],
self
.
_hotkeys
[
hotkey
][
'sort_key'
]
==
'auto'
)
...
...
glances/plugins/glances_irq.py
浏览文件 @
e1c47695
...
...
@@ -22,6 +22,7 @@
import
os
import
operator
from
glances.logger
import
logger
from
glances.globals
import
LINUX
from
glances.timer
import
getTimeSinceLastUpdate
from
glances.plugins.glances_plugin
import
GlancesPlugin
...
...
glances/plugins/glances_plugin.py
浏览文件 @
e1c47695
...
...
@@ -143,9 +143,8 @@ class GlancesPlugin(object):
try
:
d
=
getattr
(
self
.
args
,
'disable_'
+
plugin_name
)
except
AttributeError
:
return
True
else
:
return
d
is
False
d
=
getattr
(
self
.
args
,
'enable_'
+
plugin_name
,
True
)
return
d
is
False
def
is_disable
(
self
,
plugin_name
=
None
):
"""Return true if plugin is disabled."""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录