Beispiel #1
0
		def create_treeview(self):
			treeview=gtk.TreeView()
			treeview.set_rules_hint(True)
			treeview.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_NONE)
			treeview.set_fixed_height_mode(True)
			treeview.set_headers_visible(True)
			selection=treeview.get_selection()
			selection.set_mode(gtk.SELECTION_MULTIPLE)

			rendererToggle=gtk.CellRendererToggle()
			#rendererToggle.set_activatable(True)
			rendererToggle.set_property('activatable',True)
			rendererToggle.connect('toggled',self.toggled)
			column=gtk.TreeViewColumn(' ',rendererToggle,active=0)
			column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
			column.set_resizable(True)
			column.set_min_width(20)
			treeview.append_column(column)

			rendererText=gtk.CellRendererText()
			column=gtk.TreeViewColumn("软件包",rendererText,text=1)
			column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
			column.set_resizable(True)
			column.set_min_width(150)
			treeview.append_column(column)

			rendererText=gtk.CellRendererText()
			column=gtk.TreeViewColumn("功能描述",rendererText,text=2)
			column.set_min_width(100)
			column.set_resizable(True)
			column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
			treeview.append_column(column)

			rendererText=gtk.CellRendererText()
			column=gtk.TreeViewColumn("当前版本",rendererText,text=3)
			column.set_min_width(100)
			column.set_resizable(True)
			column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
			treeview.append_column(column)

			rendererText=gtk.CellRendererText()
			column=gtk.TreeViewColumn("最新版本",rendererText,text=4)
			column.set_min_width(100)
			column.set_resizable(True)
			column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
			treeview.append_column(column)

			rendererText=gtk.CellRendererText()
			column=gtk.TreeViewColumn("大小",rendererText,text=5)
			column.set_min_width(50)
			column.set_resizable(True)
			column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
			treeview.append_column(column)

			rendererButton=CellRendererButton()
			rendererButton.set_fixed_size(50,20)
			#self.rendererButton.set_sensitive(False)
			rendererButton.connect('clicked',self.download_single)
			column=gtk.TreeViewColumn("状态",rendererButton,text=6,sensitive=7)
			column.set_alignment(0.5)
			column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
			column.set_resizable(True)
			column.set_min_width(50)
			treeview.append_column(column)

			return treeview
Beispiel #2
0
	def create_treeview(self):
		treeview=gtk.TreeView()
		treeview.set_headers_visible(True)
		selection=treeview.get_selection()
		selection.set_mode(gtk.SELECTION_MULTIPLE)
	
		rendererToggle=gtk.CellRendererToggle()
		#rendererToggle.set_activatable(True)
		rendererToggle.connect('toggled',self.toggled,treeview)
		column=gtk.TreeViewColumn(' ',rendererToggle,active=0)
		column.set_resizable(True)
		column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		column.set_fixed_width(25)
		treeview.append_column(column)
	
		rendererText=gtk.CellRendererText()
		column=gtk.TreeViewColumn("服务器",rendererText,text=1)
		column.set_resizable(True)
		column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		column.set_fixed_width(160)
		treeview.append_column(column)

		rendererText=gtk.CellRendererText()
		rendererText.set_property("editable",True)
		rendererText.connect("edited",self.cell_edited,2)
		column=gtk.TreeViewColumn("主机名",rendererText,text=2)
		column.set_visible(True)
		column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		column.set_fixed_width(100)
		treeview.append_column(column)
	
		rendererText=gtk.CellRendererText()
		rendererText.set_property("editable",True)
		rendererText.connect("edited",self.cell_edited,3)
		#rendererCombo=gtk.CellRendererCombo()
		column=gtk.TreeViewColumn("运行级别",rendererText,text=3)
		column.set_resizable(True)
		column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		column.set_fixed_width(60)
		treeview.append_column(column)

		rendererText=gtk.CellRendererText()
		rendererText.set_property("editable",True)
		rendererText.connect("edited",self.cell_edited,4)
		column=gtk.TreeViewColumn("SSH端口",rendererText,text=4)
		column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		column.set_fixed_width(75)
		treeview.append_column(column)
	
		#rendererText=gtk.CellRendererCombo()
		#column=gtk.TreeViewColumn("",rendererText,text=5)
		#column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		#column.set_resizable(True)
		#column.set_fixed_width(50)
		#treeview.append_column(column)

		#rendererText=gtk.CellRendererText()
		#column=gtk.TreeViewColumn("DNS",rendererText,text=5)
		#column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		#column.set_resizable(True)
		#column.set_fixed_width(50)
		#treeview.append_column(column)

		rendererText=gtk.CellRendererText()
		rendererText.set_property("editable",True)
		rendererText.connect("edited",self.cell_edited,5)
		column=gtk.TreeViewColumn("ROOT密码",rendererText,text=5)
		column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		column.set_fixed_width(100)
		treeview.append_column(column)

		rendererButton=CellRendererButton()
		rendererButton.set_fixed_size(30,20)
		rendererButton.connect('clicked',self.open_terminal)
		column=gtk.TreeViewColumn("更多操作",rendererButton,text=6,sensitive=7)
		column.set_alignment(0.5)
		column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		column.set_fixed_width(70)
		treeview.append_column(column)
	
		

		

		return treeview