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


Python Tools.append方法代码示例

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


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

示例1: remove_repo

# 需要导入模块: from Tools import Tools [as 别名]
# 或者: from Tools.Tools import append [as 别名]
	def remove_repo(self):
		RMBUTTON = gtk.Button()
		REPO_NAME = None
		REPOS = Tools().custom_list_dir(Globals.myHOME, ".repo")
		if REPOS is None:
			Dialogs().CDial(gtk.MESSAGE_INFO, "No repos configured.", "There are not repos configured. Please sync a repo first!")
			return

		def callback_radio(widget, data=None):
			L = data.split("/")
			L = L[-1]
			RMBUTTON.set_label("Remove: %s" % L)
			global REPO_NAME
			REPO_NAME = data

		def del_repo_paths(widget):
			global REPO_NAME
			REPO_NAME = str(REPO_NAME.strip())
			if REPO_NAME is not "None":
				q = Dialogs().QDial("Remove repos: %s?" % REPO_NAME, "Are you sure you want to remove:\n %s\n\nOnce this is done it can't be undone." % REPO_NAME)
				if q is not True:
					return
			if REPO_NAME == "All":
				for x in REPOS:
					if os.path.isdir(x):
						if Parser().read("repo_path") == x:
							Parser().write("repo_path", Globals.myDEF_REPO_PATH)
						shutil.rmtree(x)
						dialog.destroy()
						Update().main(None)
			elif REPO_NAME == "None":
				pass
			else:
				if os.path.isdir(REPO_NAME):
					if Parser().read("repo_path") == REPO_NAME:
						Parser().write("repo_path", Globals.myDEF_REPO_PATH)
					shutil.rmtree(REPO_NAME)
					dialog.destroy()
					Update().main(None)

		a = Parser().read("rom_abrv")
		dialog = gtk.Dialog("Remove installed repos", None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
		dialog.set_size_request(500, 400)
		dialog.set_resizable(False)

		scroll = gtk.ScrolledWindow()
		scroll.set_border_width(10)
		scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
		scroll.set_size_request(400, 325)
		dialog.vbox.pack_start(scroll, True, True, 0)
		scroll.show()

		table = gtk.Table(2, 1, False)
		table.set_row_spacings(5)

		scroll.add_with_viewport(table)
		table.show()

		radiobtn = gtk.RadioButton(None, None)

		button_count = 0
		REPOS.append("All")
		REPOS.append("None")
		for radio in REPOS:
			button_count+=1
			button = gtk.RadioButton(group=radiobtn, label="%s" % (radio))
			button.connect("toggled", callback_radio, "%s" % (radio))
			table.attach(button, 0, 1, button_count-1, button_count, xoptions=gtk.FILL, yoptions=gtk.SHRINK)
			button.show()

		RMBUTTON.set_label("Remove: None")
		RMBUTTON.connect("clicked", del_repo_paths)
		RMBUTTON.show()
		dialog.vbox.pack_start(RMBUTTON, True, True, 0)

		dialog.run()
		dialog.destroy()
开发者ID:jacano1969,项目名称:Legacy,代码行数:79,代码来源:Utils.py


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