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


Python editordialog.EditorDialog類代碼示例

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


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

示例1: store_value

 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,代碼行數:27,代碼來源:deviceeditor.py

示例2: set_value

	def set_value(self, key, value):
		if key == "versioning":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "type"))
			self.values["versioning"]["type"] = value
		elif key == "keepVersions":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "keep"))
			self.values["versioning"]["params"]["keep"] = str(int(value))
		elif key == "cleanoutDays":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "cleanoutDays"))
			self.values["versioning"]["params"]["cleanoutDays"] = str(int(value))
		elif key == "maxAge":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "maxAge"))
			self.values["versioning"]["params"]["maxAge"] = str(int(value) * 86400) # days to seconds
		elif key == "command":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "command"))
			self.values["versioning"]["params"]["command"] = value
		elif key == "versionsPath":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "versionsPath"))
			self.values["versioning"]["params"]["versionsPath"] = value
		elif key in ("readOnly", "receiveonly"):
			if self["vreadOnly"].get_active():
				self.values["type"] = "sendonly"
			elif self["vreceiveOnly"].get_active():
				self.values["type"] = "receiveonly"
			else:
				self.values["type"] = "sendreceive"
		else:
			EditorDialog.set_value(self, key, value)
開發者ID:syncthing,項目名稱:syncthing-gtk,代碼行數:34,代碼來源:foldereditor.py

示例3: set_value

	def set_value(self, key, value):
		if key == "versioning":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "type"))
			self.values["versioning"]["type"] = value
		elif key == "keepVersions":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "keep"))
			self.values["versioning"]["params"]["keep"] = str(int(value))
		elif key == "maxAge":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "maxAge"))
			self.values["versioning"]["params"]["maxAge"] = str(int(value) * 86400) # days to seconds
		elif key == "versionsPath":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "versionsPath"))
			self.values["versioning"]["params"]["versionsPath"] = value
		elif key == "inotify":
			l = self.app.config["use_inotify"]
			if value:
				if not self.id in l:
					l.append(self.id)
			else:
				while self.id in l:
					l.remove(self.id)
			self.app.config["use_inotify"] = l
		else:
			EditorDialog.set_value(self, key, value)
開發者ID:GeoffreyFrogeye,項目名稱:syncthing-gtk,代碼行數:28,代碼來源:foldereditor.py

示例4: __init__

	def __init__(self, app, is_new, id=None):
		EditorDialog.__init__(self, app,
			"device-edit.glade",
			"New Device" if is_new else "Edit Device"
			)
		self.id = id
		self.is_new = is_new
開發者ID:syncthing,項目名稱:syncthing-gtk,代碼行數:7,代碼來源:deviceeditor.py

示例5: __init__

	def __init__(self, app, is_new, id=None, path=None):
		EditorDialog.__init__(self, app,
			"folder-edit.glade",
			"New Shared Folder" if is_new else "Edit Shared Folder"
			)
		self.id = id
		self.path = path
		self.is_new = is_new
開發者ID:GeoffreyFrogeye,項目名稱:syncthing-gtk,代碼行數:8,代碼來源:foldereditor.py

示例6: set_value

	def set_value(self, key, value):
		if key == "autostart":
			set_run_on_startup(value, "Syncthing-GTK", get_executable(),
				"/usr/share/syncthing-gtk/icons/st-logo-128.png",
				"GUI for Syncthing")
		elif key == "daemon_priority":
			return EditorDialog.set_value(self, key, int(value))
		else:
			return EditorDialog.set_value(self, key, value)
開發者ID:syncthing,項目名稱:syncthing-gtk,代碼行數:9,代碼來源:uisettingsdialog.py

示例7: store_value

	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,代碼行數:10,代碼來源:foldereditor.py

示例8: display_value

	def display_value(self, key, w):
		if key == "vdevices":
			# Very special case
			nids = [ n["deviceID"] for n in self.get_value("devices") ]
			for device in self.app.devices.values():
				if device["id"] != self.app.daemon.get_my_id():
					b = Gtk.CheckButton(device.get_title(), False)
					b.set_tooltip_text(device["id"])
					self["vdevices"].pack_end(b, False, False, 0)
					b.set_active(device["id"] in nids)
			self["vdevices"].show_all()
		else:
			EditorDialog.display_value(self, key, w)
開發者ID:GeoffreyFrogeye,項目名稱:syncthing-gtk,代碼行數:13,代碼來源:foldereditor.py

示例9: get_value

 def get_value(self, key):
     if key == "addresses":
         return ",".join([strip_v(x) for x in self.values[key]])
     elif key == "compression":
         val = EditorDialog.get_value(self, key)
         # For syncthing <= 0.10.25
         if val in (True, "true"):
             return "always"
         elif val in (False, "false"):
             return "never"
         else:
             return val
     else:
         return EditorDialog.get_value(self, key)
開發者ID:nagyist,項目名稱:syncthing-gtk,代碼行數:14,代碼來源:deviceeditor.py

示例10: store_value

	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,代碼行數:16,代碼來源:uisettingsdialog.py

示例11: set_value

	def set_value(self, key, value):
		if key == "listenAddresses":
			self.values[key] = [ x.strip(" \t") for x in value.split(",") ]
		elif key == "globalAnnounceServers":
			self.values[key] = [ x.strip(" \t") for x in value.split(",") ]
		elif key == "urAccepted":
			self.values[key] = 1 if value else -1
		elif key == "maxSendKbpsEnabled":
			if value:
				if self.values["maxSendKbps"] <= 0:
					self.values["maxSendKbps"] = 1
					self.find_widget_by_id("vmaxSendKbps").get_adjustment().set_value(self.values["maxSendKbps"])
			else:
				self.values["maxSendKbps"] = 0
				self.find_widget_by_id("vmaxSendKbps").get_adjustment().set_value(self.values["maxSendKbps"])
		elif key == "maxRecvKbpsEnabled":
			if value:
				if self.values["maxRecvKbps"] <= 0:
					self.values["maxRecvKbps"] = 1
					self.find_widget_by_id("vmaxRecvKbps").get_adjustment().set_value(self.values["maxRecvKbps"])
			else:
				self.values["maxRecvKbps"] = 0
				self.find_widget_by_id("vmaxRecvKbps").get_adjustment().set_value(self.values["maxRecvKbps"])
		else:
			return EditorDialog.set_value(self, key, value)
開發者ID:syncthing,項目名稱:syncthing-gtk,代碼行數:25,代碼來源:daemonsettings.py

示例12: display_value

	def display_value(self, key, w):
		if key == "vfolders":
			# Even more special case
			rids = [ ]
			# Get list of folders that share this device
			for r in self.config["folders"]:
				for n in r["devices"]:
					if n["deviceID"] == self.id:
						rids.append(r["id"])
			# Create CheckButtons
			for folder in reversed(sorted(self.app.folders.values(), key=lambda x : x["id"])):
				b = Gtk.CheckButton(folder["path"], False)
				b.set_tooltip_text(folder["id"])
				self["vfolders"].pack_start(b, False, False, 0)
				b.set_active(folder["id"] in rids)
			self["vfolders"].show_all()
		else:
			EditorDialog.display_value(self, key, w)
開發者ID:syncthing,項目名稱:syncthing-gtk,代碼行數:18,代碼來源:deviceeditor.py

示例13: set_value

	def set_value(self, key, value):
		if key == "versioning":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "type"))
			self.values["versioning"]["type"] = value
		elif key == "keepVersions":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "keep"))
			self.values["versioning"]["params"]["keep"] = str(int(value))
		elif key == "cleanoutDays":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "cleanoutDays"))
			self.values["versioning"]["params"]["cleanoutDays"] = str(int(value))
		elif key == "maxAge":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "maxAge"))
			self.values["versioning"]["params"]["maxAge"] = str(int(value) * 86400) # days to seconds
		elif key == "command":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "command"))
			self.values["versioning"]["params"]["command"] = value
		elif key == "versionsPath":
			# Create structure if needed
			self.create_dicts(self.values, ("versioning", "params", "versionsPath"))
			self.values["versioning"]["params"]["versionsPath"] = value
		elif key == "readOnly":
			self.values["type"] = "readonly" if value else "readwrite"
		elif key == "inotify":
			id = self.id
			if id is None:
				# Happens when saving new folder
				id = self["vid"].get_text().strip()
			l = self.app.config["use_inotify"]
			if value:
				if not id in l:
					l.append(id)
			else:
				while id in l:
					l.remove(id)
			self.app.config["use_inotify"] = l
		else:
			EditorDialog.set_value(self, key, value)
開發者ID:acolomb,項目名稱:syncthing-gtk,代碼行數:42,代碼來源:foldereditor.py

示例14: __init__

	def __init__(self, app):
		EditorDialog.__init__(self, app, "find-daemon.glade",
			_("Can't invoke the daemon"))
		self.app = app
		exe = "syncthing.exe" if IS_WINDOWS else _("Syncthing binary")
		self["lblMessage"].set_markup("%s\n%s" % (
			_("Syncthing daemon binary cannot be found."),
			_("If you have Syncthing installed, please, set path to "
			  "%s below or click on <b>Download</b> "
			  "button to download latest Syncthing package.") % (exe,)
		))
		if IS_XP or StDownloader is None:
			# Downloading is not offered on XP (github will not talk to it)
			# or if StDownloader module is not packaged
			self["lblMessage"].set_markup("%s\n%s" % (
				_("Syncthing daemon binary cannot be found."),
				_("If you have Syncthing installed, please, set path to "
				  "%s below") % (exe,)
			))
			self.hide_download_button()
開發者ID:syncthing,項目名稱:syncthing-gtk,代碼行數:20,代碼來源:finddaemondialog.py

示例15: store_value

	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,代碼行數:41,代碼來源:deviceeditor.py


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