本文整理汇总了Python中cylc.gui.dot_maker.DotMaker.get_icon方法的典型用法代码示例。如果您正苦于以下问题:Python DotMaker.get_icon方法的具体用法?Python DotMaker.get_icon怎么用?Python DotMaker.get_icon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cylc.gui.dot_maker.DotMaker
的用法示例。
在下文中一共展示了DotMaker.get_icon方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _set_key_liststore
# 需要导入模块: from cylc.gui.dot_maker import DotMaker [as 别名]
# 或者: from cylc.gui.dot_maker.DotMaker import get_icon [as 别名]
def _set_key_liststore(self):
dotm = DotMaker(self._theme, self._dot_size)
self._key_liststore.clear()
for state in task_state.legal:
dot = dotm.get_icon(state)
self._key_liststore.append([state, dot])
示例2: ScanApp
# 需要导入模块: from cylc.gui.dot_maker import DotMaker [as 别名]
# 或者: from cylc.gui.dot_maker.DotMaker import get_icon [as 别名]
class ScanApp(object):
"""Summarize running suite statuses for a given set of hosts."""
WARNINGS_COLUMN = 7
STATUS_COLUMN = 6
CYCLE_COLUMN = 5
UPDATE_TIME_COLUMN = 4
TITLE_COLUMN = 3
STOPPED_COLUMN = 2
SUITE_COLUMN = 1
HOST_COLUMN = 0
ICON_SIZE = 17
def __init__(self, hosts=None, owner=None, poll_interval=None):
gobject.threads_init()
set_exception_hook_dialog("cylc gscan")
setup_icons()
if not hosts:
hosts = GLOBAL_CFG.get(["suite host scanning", "hosts"])
self.hosts = hosts
if owner is None:
owner = USER
self.owner = owner
self.window = gtk.Window()
self.window.set_title("cylc gscan")
self.window.set_icon(get_icon())
self.vbox = gtk.VBox()
self.vbox.show()
self.warnings = {}
self.theme_name = gcfg.get(['use theme'])
self.theme = gcfg.get(['themes', self.theme_name])
self.dots = DotMaker(self.theme)
suite_treemodel = gtk.TreeStore(
str, str, bool, str, int, str, str, str)
self._prev_tooltip_location_id = None
self.suite_treeview = gtk.TreeView(suite_treemodel)
# Construct the host column.
host_name_column = gtk.TreeViewColumn("Host")
cell_text_host = gtk.CellRendererText()
host_name_column.pack_start(cell_text_host, expand=False)
host_name_column.set_cell_data_func(
cell_text_host, self._set_cell_text_host)
host_name_column.set_sort_column_id(0)
host_name_column.set_visible("host" in gsfg.get(["columns"]))
host_name_column.set_resizable(True)
# Construct the suite name column.
suite_name_column = gtk.TreeViewColumn("Suite")
cell_text_name = gtk.CellRendererText()
suite_name_column.pack_start(cell_text_name, expand=False)
suite_name_column.set_cell_data_func(
cell_text_name, self._set_cell_text_name)
suite_name_column.set_sort_column_id(1)
suite_name_column.set_visible("suite" in gsfg.get(["columns"]))
suite_name_column.set_resizable(True)
# Construct the suite title column.
suite_title_column = gtk.TreeViewColumn("Title")
cell_text_title = gtk.CellRendererText()
suite_title_column.pack_start(cell_text_title, expand=False)
suite_title_column.set_cell_data_func(
cell_text_title, self._set_cell_text_title)
suite_title_column.set_sort_column_id(3)
suite_title_column.set_visible("title" in gsfg.get(
["columns"]))
suite_title_column.set_resizable(True)
# Construct the update time column.
time_column = gtk.TreeViewColumn("Updated")
cell_text_time = gtk.CellRendererText()
time_column.pack_start(cell_text_time, expand=False)
time_column.set_cell_data_func(
cell_text_time, self._set_cell_text_time)
time_column.set_sort_column_id(4)
time_column.set_visible("updated" in gsfg.get(["columns"]))
time_column.set_resizable(True)
self.suite_treeview.append_column(host_name_column)
self.suite_treeview.append_column(suite_name_column)
self.suite_treeview.append_column(suite_title_column)
self.suite_treeview.append_column(time_column)
# Construct the status column.
status_column = gtk.TreeViewColumn("Status")
status_column.set_sort_column_id(5)
status_column.set_visible("status" in gsfg.get(["columns"]))
status_column.set_resizable(True)
cell_text_cycle = gtk.CellRendererText()
status_column.pack_start(cell_text_cycle, expand=False)
status_column.set_cell_data_func(
cell_text_cycle, self._set_cell_text_cycle, self.CYCLE_COLUMN)
self.suite_treeview.append_column(status_column)
# Warning icon.
warn_icon = gtk.CellRendererPixbuf()
#.........这里部分代码省略.........
示例3: ScanApp
# 需要导入模块: from cylc.gui.dot_maker import DotMaker [as 别名]
# 或者: from cylc.gui.dot_maker.DotMaker import get_icon [as 别名]
class ScanApp(object):
"""Summarize running suite statuses for a given set of hosts."""
WARNINGS_COLUMN = 9
STATUS_COLUMN = 8
CYCLE_COLUMN = 7
UPDATE_TIME_COLUMN = 6
TITLE_COLUMN = 5
STOPPED_COLUMN = 4
SUITE_COLUMN = 3
OWNER_COLUMN = 2
HOST_COLUMN = 1
GROUP_COLUMN = 0
ICON_SIZE = 17
def __init__(
self, hosts=None, patterns_name=None, patterns_owner=None,
comms_timeout=None, poll_interval=None):
gobject.threads_init()
set_exception_hook_dialog("cylc gscan")
setup_icons()
if not hosts:
hosts = GLOBAL_CFG.get(["suite host scanning", "hosts"])
self.hosts = hosts
self.window = gtk.Window()
title = "cylc gscan"
for opt, items, skip in [
("-n", patterns_name, None), ("-o", patterns_owner, USER)]:
if items:
for pattern in items:
if pattern != skip:
title += " %s %s" % (opt, pattern)
self.window.set_title(title)
self.window.set_icon(get_icon())
self.vbox = gtk.VBox()
self.vbox.show()
self.warnings = {}
self.theme_name = gcfg.get(['use theme'])
self.theme = gcfg.get(['themes', self.theme_name])
suite_treemodel = gtk.TreeStore(
str, # group
str, # host
str, # owner
str, # suite
bool, # is_stopped
str, # title
int, # update_time
str, # states
str, # states_text
str) # warning_text
self._prev_tooltip_location_id = None
self.treeview = gtk.TreeView(suite_treemodel)
# Visibility of columns
vis_cols = gsfg.get(["columns"])
# Doesn't make any sense without suite name column
if gsfg.COL_SUITE not in vis_cols:
vis_cols.append(gsfg.COL_SUITE.lower())
# In multiple host environment, add host column by default
if hosts:
vis_cols.append(gsfg.COL_HOST.lower())
# In multiple owner environment, add owner column by default
if patterns_owner != [USER]:
vis_cols.append(gsfg.COL_OWNER.lower())
# Construct the group, host, owner, suite, title, update time column.
for col_title, col_id, col_cell_text_setter in [
(gsfg.COL_GROUP, self.GROUP_COLUMN, self._set_cell_text_group),
(gsfg.COL_HOST, self.HOST_COLUMN, self._set_cell_text_host),
(gsfg.COL_OWNER, self.OWNER_COLUMN, self._set_cell_text_owner),
(gsfg.COL_SUITE, self.SUITE_COLUMN, self._set_cell_text_name),
(gsfg.COL_TITLE, self.TITLE_COLUMN, self._set_cell_text_title),
(gsfg.COL_UPDATED, self.UPDATE_TIME_COLUMN,
self._set_cell_text_time),
]:
column = gtk.TreeViewColumn(col_title)
cell_text = gtk.CellRendererText()
column.pack_start(cell_text, expand=False)
column.set_cell_data_func(cell_text, col_cell_text_setter)
column.set_sort_column_id(col_id)
column.set_visible(col_title.lower() in vis_cols)
column.set_resizable(True)
self.treeview.append_column(column)
# Construct the status column.
status_column = gtk.TreeViewColumn(gsfg.COL_STATUS)
status_column.set_sort_column_id(self.STATUS_COLUMN)
status_column.set_visible(gsfg.COL_STATUS.lower() in vis_cols)
status_column.set_resizable(True)
cell_text_cycle = gtk.CellRendererText()
status_column.pack_start(cell_text_cycle, expand=False)
status_column.set_cell_data_func(
cell_text_cycle, self._set_cell_text_cycle, self.CYCLE_COLUMN)
self.treeview.append_column(status_column)
#.........这里部分代码省略.........
示例4: _set_key_liststore
# 需要导入模块: from cylc.gui.dot_maker import DotMaker [as 别名]
# 或者: from cylc.gui.dot_maker.DotMaker import get_icon [as 别名]
def _set_key_liststore(self):
dotm = DotMaker(self._theme, self._dot_size)
self._key_liststore.clear()
for state in TASK_STATUSES_ORDERED:
dot = dotm.get_icon(state)
self._key_liststore.append([state, dot])