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


Python Gtk.CellRendererProgress方法代码示例

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


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

示例1: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererProgress [as 别名]
def __init__(self, database):
		""" log box """
		builder	 = Gtk.Builder() # glade
		builder.add_from_file(os.path.dirname(os.path.abspath(__file__)) + "/../assets/ui/logger.glade")

		self.database = database

		# log list
		self.notebook = builder.get_object("log-notebook")
		self.log_box = builder.get_object("log-box")
		self.scrolled = builder.get_object("scrolled")

		self.log_liststore = Gtk.ListStore(int, int, str, str, int, str, str, int, str, int)
		self.log_tree = Gtk.TreeView(model=self.log_liststore)
		self.id = 0

		self.extensions  = karmaEngine()

		for i, column_title in enumerate(["#","Status","Start time", "End time", "Pid", "Target", "Task"]):
			if i == 1:

				renderer = Gtk.CellRendererProgress()

				column = Gtk.TreeViewColumn(column_title, renderer, value=1 )
				column.set_min_width(100)
				column.add_attribute(renderer, "pulse", 7)				#renderer.text = " "
			else:
				renderer = Gtk.CellRendererText()
				column = Gtk.TreeViewColumn(column_title, renderer, text=i)
		
			self.log_tree.append_column(column)

		# get logs from the database
		self.refresh(self.database)
		self.log_tree.show()

		# pulse progress bar every second
		GObject.timeout_add(100, self._pulse_progressbars)

		# connect events
		self.log_tree.connect("button_press_event", self.mouse_click)
		self.log_tree.connect("row-activated", self.on_row_activated)
		self.log_tree.connect('size-allocate', self._scroll)

		# multi selection 
		selection = self.log_tree.get_selection()
		selection.set_mode(Gtk.SelectionMode.MULTIPLE)

		self.log_box.add(self.log_tree) 
开发者ID:r3vn,项目名称:badKarma,代码行数:51,代码来源:workspace.py

示例2: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CellRendererProgress [as 别名]
def __init__(self, queue):
		self.queue = queue
		self.scroll = sftp_utilities.get_object('SFTPClient.notebook.page_stfp.scrolledwindow_transfer_statuses')
		self.treeview_transfer = sftp_utilities.get_object('SFTPClient.notebook.page_stfp.treeview_transfer_statuses')
		self._tv_lock = threading.RLock()

		col_img = Gtk.CellRendererPixbuf()
		col = Gtk.TreeViewColumn('')
		col.pack_start(col_img, False)
		col.add_attribute(col_img, 'pixbuf', 0)
		self.treeview_transfer.append_column(col)
		gui_utilities.gtk_treeview_set_column_titles(self.treeview_transfer, ('Local File', 'Remote File', 'Status'), column_offset=1)

		col_bar = Gtk.TreeViewColumn('Progress')
		progress = Gtk.CellRendererProgress()
		col_bar.pack_start(progress, True)
		col_bar.add_attribute(progress, 'value', 4)
		col_bar.set_property('resizable', True)
		col_bar.set_min_width(125)
		self.treeview_transfer.append_column(col_bar)

		# todo: make this a CellRendererBytes
		gui_utilities.gtk_treeview_set_column_titles(self.treeview_transfer, ('Size',), column_offset=5, renderers=(extras.CellRendererBytes(),))
		self._tv_model = Gtk.TreeStore(GdkPixbuf.Pixbuf, str, str, str, int, int, object)
		self.treeview_transfer.connect('size-allocate', self.signal_tv_size_allocate)
		self.treeview_transfer.connect('button_press_event', self.signal_tv_button_pressed)

		self.treeview_transfer.set_model(self._tv_model)
		self.treeview_transfer.show_all()

		self.popup_menu = Gtk.Menu.new()

		self.menu_item_paused = Gtk.CheckMenuItem.new_with_label('Paused')
		menu_item = self.menu_item_paused
		menu_item.connect('toggled', self.signal_menu_toggled_paused)
		self.popup_menu.append(menu_item)

		self.menu_item_cancel = Gtk.MenuItem.new_with_label('Cancel')
		menu_item = self.menu_item_cancel
		menu_item.connect('activate', self.signal_menu_activate_cancel)
		self.popup_menu.append(menu_item)

		menu_item = Gtk.SeparatorMenuItem()
		self.popup_menu.append(menu_item)

		menu_item = Gtk.MenuItem.new_with_label('Clear')
		menu_item.connect('activate', self.signal_menu_activate_clear)
		self.popup_menu.append(menu_item)
		self.popup_menu.show_all() 
开发者ID:rsmusllp,项目名称:king-phisher-plugins,代码行数:51,代码来源:client.py


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