當前位置: 首頁>>代碼示例>>Python>>正文


Python DotMaker.get_icon方法代碼示例

本文整理匯總了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])
開發者ID:ScottWales,項目名稱:cylc,代碼行數:8,代碼來源:legend.py

示例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()
#.........這裏部分代碼省略.........
開發者ID:oliver-sanders,項目名稱:cylc,代碼行數:103,代碼來源:gscan.py

示例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)

#.........這裏部分代碼省略.........
開發者ID:m214089,項目名稱:cylc,代碼行數:103,代碼來源:gscan.py

示例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])
開發者ID:benfitzpatrick,項目名稱:cylc,代碼行數:8,代碼來源:legend.py


注:本文中的cylc.gui.dot_maker.DotMaker.get_icon方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。