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


Python HTML.get_top_element_nested_level方法代码示例

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


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

示例1: test_html_object_get_nested_level

# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import get_top_element_nested_level [as 别名]
	def test_html_object_get_nested_level(self):
		html_obj = HTML()
		self.assertEqual(0, html_obj.get_top_element_nested_level())
开发者ID:Trey50Daniel,项目名称:HTMLBuilder,代码行数:5,代码来源:HtmlElement_tests.py

示例2: Html_Builder

# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import get_top_element_nested_level [as 别名]

#.........这里部分代码省略.........
			self.text_element = StringVar()
			self.option_list_pane = apply(OptionMenu, (root, self.option) + tuple(self.options_list))
			self.option.set(self.options_list[0])
			self.option_list_pane.place(x=20, y=200)
			self.add_button = Button(root, text='Add', width=7, command = self.add)
			self.add_button.place(x=175, y=450)
			self.text_element_box = Entry(root, textvariable=self.text_element)
			self.text_element_box.place(x=130, y=200)
			self.check_is_nested = IntVar()
			self.check_is_nested_button = Checkbutton(root, text = "Is Nested Element", variable = self.check_is_nested, \
						 command = self.el_is_nested, onvalue = 1, offvalue = 0, height=2, \
						 width = 14)
			self.check_is_nested_button.place(x=260, y=200)
			self.has_meta = IntVar()
			self.has_meta_button = Checkbutton(root, text = "Has Attributes", variable = self.has_meta, \
						 command = self.el_has_meta, onvalue = 1, offvalue = 0, height=2, \
						 width = 14)
			self.has_meta_button.place(x=260, y=275)
			self.add_item = True
		else:
			toplevel = Toplevel()
			label1 = Label(toplevel, text='Please finish your current action!', height=5, width=50)
			label1.pack()
	
	def el_has_meta(self):
		if(self.has_meta.get() == 1):
			self.meta = True
			self.meta_label = Label(root, text='Attribute Text:')
			self.meta_label.place(x=20, y=275)
			self.add_meta_button = Button(root, text='Add Attribute', width=11, command = self.add_meta)
			self.add_meta_button.place(x=115, y=330)
			self.value_label = Label(root, text='Attribute Value:')
			self.value_label.place(x=20, y=300)
			self.meta_text = StringVar()
			self.meta_element_box = Entry(root, textvariable=self.meta_text)
			self.meta_element_box.place(x=115, y=275)
			self.value_text = StringVar()
			self.value_box = Entry(root, textvariable=self.value_text)
			self.value_box.place(x=115, y=300)
		else:
			self.meta = False
	
	def add_meta(self):
		self.temp_dict[self.meta_text.get()] = self.value_text.get()
		print self.temp_dict[self.meta_text.get()]
		#self.html_object.meta_dict = self.temp_dict
	
	def order_html(self):
		square = self.html_object.is_full_html
		
	def delete_html(self):
		if not self.html_object.element_list:
			toplevel2 = Toplevel()
			label1 = Label(toplevel2, text='There are no items to delete', height=5, width=50)
			label1.pack()
		elif(self.add_item):
			toplevel3 = Toplevel()
			label1 = Label(toplevel3, text='Please finish your current action!', height=5, width=50)
			label1.pack()
		else:
			self.delete_something = True
			self.w = Spinbox(root, values=tuple(self.html_object.get_element_list()), width=30)
			self.w.place(x=175, y=225)
			self.delete_button = Button(root, text='Delete', width=7, command = self.delete)
			self.delete_button.place(x=175, y = 275)
		
	def delete(self):
		self.deleted_object = self.w.get()
		self.html_object.del_element(self.deleted_object)
		self.delete_something = False
		self.w.destroy()
		self.delete_button.destroy()
		
	def add(self):
		element_object = html_element(self.nested, self.option.get(), self.text_element.get(), self.order_number, self.temp_dict)
		temp = self.html_object.get_top_element_nested_level()
		if (element_object.is_nested):
			element_object.nested_level = temp + 1
			print element_object.nested_level
		else:
			temp = 0
			element_object.nested_level = 0
		self.html_object.add_element(element_object)
		self.order_number += 1
		
		#destroy all of the add options once the object has been added
		self.add_item = False
		self.nested = False
		self.option_list_pane.destroy()
		self.add_button.destroy()
		self.text_element_box.destroy()
		self.check_is_nested_button.destroy()
		self.has_meta_button.destroy()
		self.value_box.destroy()
		self.value_label.destroy()
		if (self.meta):
			self.meta = False
			self.meta_label.destroy()
			self.meta_element_box.destroy()
			self.add_meta_button.destroy()
开发者ID:Trey50Daniel,项目名称:HTMLBuilder,代码行数:104,代码来源:buildHTML.py

示例3: test_html_object_get_nested_level_with_element_list

# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import get_top_element_nested_level [as 别名]
	def test_html_object_get_nested_level_with_element_list(self):
		html_obj = HTML()
		test_element = html_element()
		html_obj.add_element(test_element)
		html_obj.set_element_nested_level(0, 1)
		self.assertEqual(1, html_obj.get_top_element_nested_level())
开发者ID:Trey50Daniel,项目名称:HTMLBuilder,代码行数:8,代码来源:HtmlElement_tests.py


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