当前位置: 首页>>代码示例>>Python>>正文


Python Gtk.CellRendererPixbuf方法代码示例

本文整理汇总了Python中gi.repository.Gtk.CellRendererPixbuf方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.CellRendererPixbuf方法的具体用法?Python Gtk.CellRendererPixbuf怎么用?Python Gtk.CellRendererPixbuf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gtk的用法示例。


在下文中一共展示了Gtk.CellRendererPixbuf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _init_renderers

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def _init_renderers(self):
        """Initializes the cell renderers"""
        # We hide the columns headers
        self.set_headers_visible(False)
        # For the backend icon
        pixbuf_cell = Gtk.CellRendererPixbuf()
        tvcolumn_pixbuf = Gtk.TreeViewColumn('Icon', pixbuf_cell)
        tvcolumn_pixbuf.add_attribute(pixbuf_cell, 'pixbuf', self.COLUMN_ICON)
        self.append_column(tvcolumn_pixbuf)
        # For the backend name
        text_cell = Gtk.CellRendererText()
        tvcolumn_text = Gtk.TreeViewColumn('Name', text_cell)
        tvcolumn_text.add_attribute(text_cell, 'markup', self.COLUMN_TEXT)
        self.append_column(tvcolumn_text)
        text_cell.connect('edited', self.cell_edited_callback)
        text_cell.set_property('editable', True)
        # For the backend tags
        tags_cell = Gtk.CellRendererText()
        tvcolumn_tags = Gtk.TreeViewColumn('Tags', tags_cell)
        tvcolumn_tags.add_attribute(tags_cell, 'markup', self.COLUMN_TAGS)
        self.append_column(tvcolumn_tags) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:23,代码来源:backendstree.py

示例2: createCombo

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def createCombo(combo, data=[], name=None, ellipsize_mode=None):
    if name is not None:
        combo.set_name(name)
    lst_store = Gtk.ListStore(Pixbuf, str)
    for row in data:
        lst_store.append(row)
    combo.clear()

    combo.set_model(lst_store)
    crp = Gtk.CellRendererPixbuf()
    crp.set_property('xalign', 0)
    crp.set_property('xpad', 2)
    combo.pack_start(crp, False)
    combo.add_attribute(crp, 'pixbuf', 0)

    crt = Gtk.CellRendererText()
    crt.set_property('xalign', 0)
    crt.set_property('xpad', 4)
    combo.pack_start(crt, True)
    combo.add_attribute(crt, 'text', 1)
    if ellipsize_mode is not None:
        crt.set_property('ellipsize', ellipsize_mode) 
开发者ID:pychess,项目名称:pychess,代码行数:24,代码来源:uistuff.py

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def __init__(self, database, host, *args, **kwargs):
		super(PortsTree, self).__init__(*args, **kwargs)
		""" Single host ports treeview class """

		self.set_model(Gtk.ListStore(GdkPixbuf.Pixbuf, int, str, str, str, str, str, int))
		self.port_liststore = self.get_model()
		
		for i, column_title in enumerate(["#","Port", "State", "Type", "Service", "Banner", "Fingerprint"]):
			if i == 0:

				renderer = Gtk.CellRendererPixbuf()
				column = Gtk.TreeViewColumn(column_title, renderer, pixbuf=0)
			else:
				renderer = Gtk.CellRendererText()
				column = Gtk.TreeViewColumn(column_title, renderer, text=i)

			self.append_column(column)

		self.show_all()

		self.database = database
		self.host     = host

		self.refresh(self.database, self.host) 
开发者ID:r3vn,项目名称:badKarma,代码行数:26,代码来源:widgets.py

示例4: create_functions_columns

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def create_functions_columns(self):

        rendererText = Gtk.CellRendererText()
        rendererText.tooltip_handle = self.connect('motion-notify-event', self.fcn_tooltip)
        rendererPix = Gtk.CellRendererPixbuf()
        self.fcn_pix = GdkPixbuf.Pixbuf.new_from_file(datafile_path('function.png'))
        self.bb_pix = GdkPixbuf.Pixbuf.new_from_file(datafile_path('block.png'))
        column = Gtk.TreeViewColumn("Function")
        column.set_spacing(5)
        column.pack_start(rendererPix, False)
        column.pack_start(rendererText, True)
        column.set_attributes(rendererText, text=1)
        column.set_attributes(rendererPix, pixbuf=0)
        column.set_sort_column_id(1)
        self.store.set_sort_column_id(1,Gtk.SortType.ASCENDING)
        self.append_column(column)
        self.set_model(self.store) 
开发者ID:inguma,项目名称:bokken,代码行数:19,代码来源:treeviews.py

示例5: create_relocs_columns

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def create_relocs_columns(self):

        self.data_sec_pix = GdkPixbuf.Pixbuf.new_from_file(datafile_path('data-sec.png'))
        rendererPix = Gtk.CellRendererPixbuf()
        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Name")
        column.set_spacing(5)
        column.pack_start(rendererPix, False)
        column.pack_start(rendererText, True)
        column.set_attributes(rendererText, text=1)
        column.set_attributes(rendererPix, pixbuf=0)
        column.set_sort_column_id(0)
        self.append_column(column)

        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Virtual Address", rendererText, text=2)
        self.store.set_sort_column_id(2,Gtk.SortType.ASCENDING)
        column.set_sort_column_id(2)
        self.append_column(column)

        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Size", rendererText, text=3)
        column.set_sort_column_id(3)
        self.append_column(column) 
开发者ID:inguma,项目名称:bokken,代码行数:26,代码来源:treeviews.py

示例6: create_exports_columns

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def create_exports_columns(self):

        self.exp_pix = GdkPixbuf.Pixbuf.new_from_file(datafile_path('export.png'))
        rendererPix = Gtk.CellRendererPixbuf()
        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Offset")
        column.set_spacing(5)
        column.pack_start(rendererPix, False)
        column.pack_start(rendererText, True)
        column.set_attributes(rendererText, text=1)
        column.set_attributes(rendererPix, pixbuf=0)
        self.store.set_sort_column_id(1,Gtk.SortType.ASCENDING)
        column.set_sort_column_id(1)
        self.append_column(column)

        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Name", rendererText, text=2)
        column.set_sort_column_id(2)
        self.append_column(column)

        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Ordinal", rendererText, text=3)
        column.set_sort_column_id(3)
        self.append_column(column)
        self.set_model(self.store) 
开发者ID:inguma,项目名称:bokken,代码行数:27,代码来源:treeviews.py

示例7: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def __init__(self, model=None):
		# TODO: add logic to flag open notebook italic - needs daemon
		if model is None:
			model = NotebookTreeModel()
		GObject.GObject.__init__(self)
		self.set_model(model)
		self.get_selection().set_mode(Gtk.SelectionMode.BROWSE)
		self.set_rules_hint(True)
		self.set_reorderable(True)

		cell_renderer = Gtk.CellRendererPixbuf()
		column = Gtk.TreeViewColumn(None, cell_renderer, pixbuf=PIXBUF_COL)
		column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
		w, h = strip_boolean_result(Gtk.icon_size_lookup(Gtk.IconSize.MENU))
		column.set_fixed_width(w * 2)
		self.append_column(column)

		cell_renderer = Gtk.CellRendererText()
		cell_renderer.set_property('ellipsize', Pango.EllipsizeMode.END)
		cell_renderer.set_fixed_height_from_font(2)
		column = Gtk.TreeViewColumn(_('Notebook'), cell_renderer, markup=TEXT_COL)
			# T: Column heading in 'open notebook' dialog
		column.set_sort_column_id(NAME_COL)
		self.append_column(column) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:26,代码来源:notebookdialog.py

示例8: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def __init__(self):
		GObject.GObject.__init__(self)
		self.set_model(
			Gtk.ListStore(str, object, GdkPixbuf.Pixbuf) # NAME_COL, APP_COL, ICON_COL
		)

		cell = Gtk.CellRendererPixbuf()
		self.pack_start(cell, False)
		cell.set_property('xpad', 5)
		self.add_attribute(cell, 'pixbuf', self.ICON_COL)

		cell = Gtk.CellRendererText()
		self.pack_start(cell, True)
		cell.set_property('xalign', 0.0)
		cell.set_property('xpad', 5)
		self.add_attribute(cell, 'text', self.NAME_COL) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:18,代码来源:applications.py

示例9: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def __init__(self, manager):
		GObject.GObject.__init__(self)
		self.manager = manager

		model = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str)
				# PIXBUF_COL, TEXT_COL, NAME_COL
		self.set_model(model)
		self.set_headers_visible(False)

		self.get_selection().set_mode(Gtk.SelectionMode.BROWSE)

		cr = Gtk.CellRendererPixbuf()
		column = Gtk.TreeViewColumn('_pixbuf_', cr, pixbuf=self.PIXBUF_COL)
		self.append_column(column)

		cr = Gtk.CellRendererText()
		column = Gtk.TreeViewColumn('_text_', cr, markup=self.TEXT_COL)
		self.append_column(column)

		self.refresh() 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:22,代码来源:customtools.py

示例10: _renderers_init

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def _renderers_init(self):
        """Configure the cell renderers"""
        # Text renderer
        text_cell = Gtk.CellRendererText()
        self.pack_start(text_cell, False)
        self.add_attribute(text_cell, 'text', 1)
        # Icon renderer
        pixbuf_cell = Gtk.CellRendererPixbuf()
        self.pack_start(pixbuf_cell, False)
        self.add_attribute(pixbuf_cell, "pixbuf", self.COLUMN_ICON) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:12,代码来源:backendscombo.py

示例11: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def __init__(self, store):
        """
        Initializes the TreeViewColumns and some special behaviour.

        Removes the headers, enables the tree-lines, turns the selection-mode
        to multiple. Adds a column for the toggle, the pixbuf and the name
        of the layer.
        """
        Gtk.TreeView.__init__(self, model=store)
        self.store = store
        self.set_headers_visible(False)
        self.set_enable_tree_lines(True)
        self.select = self.get_selection()
        self.select.set_mode(Gtk.SelectionMode.MULTIPLE)
        self.set_property("can-focus", True)

        targets = [("text/plain", 0, 0)]
        self.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK,
                                      targets,
                                      Gdk.DragAction.MOVE)
        self.enable_model_drag_dest(targets, Gdk.DragAction.MOVE)

        self.renderer_activate_layer = Gtk.CellRendererToggle()
        self.column_activate_layer = Gtk.TreeViewColumn("",
                                                   self.renderer_activate_layer,
                                                   active=0)
        self.append_column(self.column_activate_layer)

        icon_renderer = Gtk.CellRendererPixbuf()
        icon_column = Gtk.TreeViewColumn("", icon_renderer, pixbuf=1)
        self.append_column(icon_column)

        self.renderer_name = Gtk.CellRendererText(weight=700,
                                                  weight_set=True)
        self.column_name = Gtk.TreeViewColumn(_("Layer"),
                                              self.renderer_name, text=2)
        self.column_name.set_min_width(100)
        self.renderer_name.set_property("editable", True)
        self.column_name.set_resizable(True)
        self.append_column(self.column_name) 
开发者ID:innstereo,项目名称:innstereo,代码行数:42,代码来源:layer_view.py

示例12: addColumns

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def addColumns(self, treeview, *columns, **keyargs):
        if "hide" in keyargs:
            hide = keyargs["hide"]
        else:
            hide = []
        if "pix" in keyargs:
            pix = keyargs["pix"]
        else:
            pix = []
        for i, name in enumerate(columns):
            if i in hide:
                continue
            if i in pix:
                crp = Gtk.CellRendererPixbuf()
                crp.props.xalign = .5
                column = Gtk.TreeViewColumn(name, crp, pixbuf=i)
            else:
                crt = Gtk.CellRendererText()
                column = Gtk.TreeViewColumn(name, crt, text=i)
                column.set_resizable(True)
            column.set_sort_column_id(i)
            # prevent columns appear choppy
            column.set_sizing(Gtk.TreeViewColumnSizing.GROW_ONLY)

            column.set_reorderable(True)
            treeview.append_column(column) 
开发者ID:pychess,项目名称:pychess,代码行数:28,代码来源:ParrentListSection.py

示例13: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def __init__(self, icon):
        GObject.GObject.__init__(self)
        self.id2iter = {}

        pm = Gtk.ListStore(str, str, int, str)
        self.sort_model = Gtk.TreeModelSort(model=pm)
        self.set_model(self.sort_model)
        self.idSet = set()

        self.set_headers_visible(False)
        self.set_tooltip_column(3)
        self.set_search_column(1)
        self.sort_model.set_sort_column_id(1, Gtk.SortType.ASCENDING)
        self.sort_model.set_sort_func(1, self.compareFunction, 1)

        # First column
        crp = Gtk.CellRendererPixbuf()
        crp.props.pixbuf = icon
        self.rightcol = Gtk.TreeViewColumn("", crp)
        self.append_column(self.rightcol)

        # Second column
        crt = Gtk.CellRendererText()
        crt.props.ellipsize = Pango.EllipsizeMode.END
        self.leftcol = Gtk.TreeViewColumn("", crt, text=1)
        self.leftcol.set_expand(True)
        self.append_column(self.leftcol)

        # Mouse
        self.pressed = None
        self.stdcursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)
        self.linkcursor = Gdk.Cursor.new(Gdk.CursorType.HAND2)
        self.connect("button_press_event", self.button_press)
        self.connect("button_release_event", self.button_release)
        self.connect("motion_notify_event", self.motion_notify)
        self.connect("leave_notify_event", self.leave_notify)

        # Selection
        self.get_selection().connect("changed", self.selection_changed) 
开发者ID:pychess,项目名称:pychess,代码行数:41,代码来源:ChannelsPanel.py

示例14: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def __init__(self):

        ### Icons for the list view
        self.icons = {}
        for kind in ObjectCollection.icon_files:
            self.icons[kind] = GdkPixbuf.Pixbuf.new_from_file(ObjectCollection.icon_files[kind])

        ### GUI List components
        ## Model
        self.store = Gtk.ListStore(FlatCAMObj)

        ## View
        self.view = Gtk.TreeView(model=self.store)
        #self.view.connect("row_activated", self.on_row_activated)
        self.tree_selection = self.view.get_selection()
        self.change_subscription = self.tree_selection.connect("changed", self.on_list_selection_change)

        ## Renderers
        # Icon
        renderer_pixbuf = Gtk.CellRendererPixbuf()
        column_pixbuf = Gtk.TreeViewColumn("Type", renderer_pixbuf)

        def _set_cell_icon(column, cell, model, it, data):
            obj = model.get_value(it, 0)
            cell.set_property('pixbuf', self.icons[obj.kind])

        column_pixbuf.set_cell_data_func(renderer_pixbuf, _set_cell_icon)
        self.view.append_column(column_pixbuf)

        # Name
        renderer_text = Gtk.CellRendererText()
        column_text = Gtk.TreeViewColumn("Name", renderer_text)

        def _set_cell_text(column, cell, model, it, data):
            obj = model.get_value(it, 0)
            cell.set_property('text', obj.options["name"])

        column_text.set_cell_data_func(renderer_text, _set_cell_text)
        self.view.append_column(column_text) 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:41,代码来源:ObjectCollection.py

示例15: create_sections_columns

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererPixbuf [as 别名]
def create_sections_columns(self):

        rendererPix = Gtk.CellRendererPixbuf()
        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Name")
        column.set_spacing(5)
        column.pack_start(rendererPix, False)
        column.pack_start(rendererText, True)
        column.set_attributes(rendererText, text=1)
        column.set_attributes(rendererPix, pixbuf=0)
        column.set_sort_column_id(0)
        self.append_column(column)

        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Virtual Address", rendererText, text=2)
        self.store.set_sort_column_id(2,Gtk.SortType.ASCENDING)
        column.set_sort_column_id(2)
        self.append_column(column)

        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Virtual Size", rendererText, text=3)
        column.set_sort_column_id(3)
        self.append_column(column)

        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Raw Size", rendererText, text=4)
        column.set_sort_column_id(4)
        self.append_column(column)
        self.set_model(self.store) 
开发者ID:inguma,项目名称:bokken,代码行数:31,代码来源:sections_treeview.py


注:本文中的gi.repository.Gtk.CellRendererPixbuf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。