當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。