def insertWebsite(self, url, domain):
		'''增加一个网页,标记为未访问,并对相应的domain增加其入度'''
		cur = self.conn.cursor()
		cur.execute("SELECT 1 FROM Domains WHERE domain=?", (domain,))
		result = cur.fetchone()
		if not result:
			# 未有对应domain记录, 先创建domain, 把入度设为1
			if VERBOSE:
				print 'Spot Domain:',domain
			self.insertDomain(domain, indegree=1)
			cur.execute("SELECT did FROM Domains WHERE domain=?", (domain,))
			did = cur.fetchone()[0]
		else:
			did = result[0]
			# 对应的domain记录已经存在, 对其入度+1
			cur.execute("UPDATE Domains SET outdegree=outdegree+1 WHERE domain=?", (domain,))

		cur.execute("INSERT INTO Websites VALUES (NULL,?,?,NULL,0)", (did, url,))
		# 写入到文件
		self.conn.commit()
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)