/usr/share/pyshared/timechart/process_table.py is in pytimechart 1.0.0~rc1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import timechart.colors as colors
import colors
from traitsui.table_column import ObjectColumn, ExpressionColumn
from traitsui.api import TableEditor
# we subclass ObjectColumn to be able to change the text color depending of whether the Process is shown
class coloredObjectColumn(ObjectColumn):
def get_text_color(self,i):
if i.show:
return colors.get_color_by_name("shown_process")
else:
return colors.get_color_by_name("hidden_process")
def get_cell_color(self,i):
return colors.get_color_by_name(i.process_type+"_bg")
# The definition of the process TableEditor:
process_table_editor = TableEditor(
columns = [
coloredObjectColumn( name = 'comm', width = 0.45 ,editable=False),
coloredObjectColumn( name = 'pid', width = 0.10 ,editable=False),
coloredObjectColumn( name = 'selection_time',label="stime", width = 0.20 ,editable=False),
ExpressionColumn(
label = 'stime%',
width = 0.20,
expression = "'%.2f' % (object.selection_pc)" )
],
deletable = False,
editable = False,
sort_model = False,
auto_size = False,
orientation = 'vertical',
show_toolbar = False,
selection_mode = 'rows',
selected = "selected"
)
|