當前位置: 首頁>>代碼示例>>Python>>正文


Python EditorDialog.store_value方法代碼示例

本文整理匯總了Python中syncthing_gtk.editordialog.EditorDialog.store_value方法的典型用法代碼示例。如果您正苦於以下問題:Python EditorDialog.store_value方法的具體用法?Python EditorDialog.store_value怎麽用?Python EditorDialog.store_value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在syncthing_gtk.editordialog.EditorDialog的用法示例。


在下文中一共展示了EditorDialog.store_value方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: store_value

# 需要導入模塊: from syncthing_gtk.editordialog import EditorDialog [as 別名]
# 或者: from syncthing_gtk.editordialog.EditorDialog import store_value [as 別名]
 def store_value(self, key, w):
     if key == "vfolders":  # And this one is special too
         # Generate dict of { folder_id : bool } where bool is True if
         # folder should be shared with this device
         folders = {}
         for b in self["vfolders"].get_children():
             folders[b.get_tooltip_text()] = b.get_active()
             # Go over all Folders/<folder>/Devices/<device> keys in config
             # and set them as needed
         nid = self.get_value("deviceID")
         for r in self.config["folders"]:
             rid = r["id"]
             found = False
             for n in r["devices"]:
                 if n["deviceID"] == nid:
                     if not rid in folders or not folders[rid]:
                         # Remove this /<device> key (unshare folder with device)
                         r["devices"].remove(n)
                         break
                     found = True
             if (not found) and (rid in folders) and folders[rid]:
                 # Add new /<device> key (share folder with device)
                 r["devices"].append(
                     {"addresses": None, "deviceID": nid, "name": "", "certName": "", "compression": "metadata"}
                 )
     else:
         EditorDialog.store_value(self, key, w)
開發者ID:nagyist,項目名稱:syncthing-gtk,代碼行數:29,代碼來源:deviceeditor.py

示例2: store_value

# 需要導入模塊: from syncthing_gtk.editordialog import EditorDialog [as 別名]
# 或者: from syncthing_gtk.editordialog.EditorDialog import store_value [as 別名]
	def store_value(self, key, w):
		if key == "vdevices":	# Still very special case
			devices = [ {
						"deviceID" : b.get_tooltip_text(),
						} for b in self["vdevices"].get_children()
						if b.get_active()
					]
			self.set_value("devices", devices)
		else:
			EditorDialog.store_value(self, key, w)
開發者ID:GeoffreyFrogeye,項目名稱:syncthing-gtk,代碼行數:12,代碼來源:foldereditor.py

示例3: store_value

# 需要導入模塊: from syncthing_gtk.editordialog import EditorDialog [as 別名]
# 或者: from syncthing_gtk.editordialog.EditorDialog import store_value [as 別名]
	def store_value(self, key, w):
		if key == "vautostart_daemon":
			if   self["rbOnStartWait"].get_active() : self.set_value(key[1:], 0)
			elif self["rbOnStartRun"].get_active() : self.set_value(key[1:], 1)
			else: return self.set_value(key[1:], 2)	# vOnStartAsk
		elif key == "vautokill_daemon":
			if self["rbOnExitTerminate"].get_active() : return self.set_value(key[1:], 1)
			elif self["rbOnExitLeave"].get_active() : return self.set_value(key[1:], 0)
			else: return self.set_value(key[1:], 2)	# vOnExitAsk
		elif key == "vst_autoupdate":
			# Reset updatecheck timer when autoupdate is turned on
			if self["vst_autoupdate"].get_active():
				self.values["last_updatecheck"] = LONG_AGO
			return EditorDialog.store_value(self, key, w)
		else:
			return EditorDialog.store_value(self, key, w)
開發者ID:syncthing,項目名稱:syncthing-gtk,代碼行數:18,代碼來源:uisettingsdialog.py

示例4: store_value

# 需要導入模塊: from syncthing_gtk.editordialog import EditorDialog [as 別名]
# 或者: from syncthing_gtk.editordialog.EditorDialog import store_value [as 別名]
	def store_value(self, key, w):
		if key == "vaddresses":
			addresses = w.get_text().strip()
			if addresses == "dynamic":
				# Special case
				self.set_value("addresses", "dynamic")
			else:
				addresses = [
					x.strip() if "://" in x else "tcp://%s" % (x.strip(),)
					for x in addresses.split(",") ]
				self.set_value("addresses", ",".join(addresses))
		elif key == "vfolders":
			# Generate dict of { folder_id : bool } where bool is True if
			# folder should be shared with this device
			folders = {}
			for b in self["vfolders"].get_children():
				folders[b.get_tooltip_text()] = b.get_active()
			# Go over all Folders/<folder>/Devices/<device> keys in config
			# and set them as needed
			nid = self.get_value("deviceID")
			for r in self.config["folders"]:
				rid = r["id"]
				found = False
				for n in r["devices"]:
					if n["deviceID"] == nid:
						if not rid in folders or not folders[rid]:
							# Remove this /<device> key (unshare folder with device)
							r["devices"].remove(n)
							break
						found = True
				if (not found) and (rid in folders) and folders[rid]:
					# Add new /<device> key (share folder with device)
					r["devices"].append({
					   "addresses" : None,
					   "deviceID" : nid,
					   "name" : "",
					   "certName" : "",
					   "compression" : "metadata"
						})
		else:
			EditorDialog.store_value(self, key, w)
開發者ID:acolomb,項目名稱:syncthing-gtk,代碼行數:43,代碼來源:deviceeditor.py


注:本文中的syncthing_gtk.editordialog.EditorDialog.store_value方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。