本文整理匯總了Python中syncthing_gtk.editordialog.EditorDialog.set_value方法的典型用法代碼示例。如果您正苦於以下問題:Python EditorDialog.set_value方法的具體用法?Python EditorDialog.set_value怎麽用?Python EditorDialog.set_value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類syncthing_gtk.editordialog.EditorDialog
的用法示例。
在下文中一共展示了EditorDialog.set_value方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: set_value
# 需要導入模塊: from syncthing_gtk.editordialog import EditorDialog [as 別名]
# 或者: from syncthing_gtk.editordialog.EditorDialog import set_value [as 別名]
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)
示例2: set_value
# 需要導入模塊: from syncthing_gtk.editordialog import EditorDialog [as 別名]
# 或者: from syncthing_gtk.editordialog.EditorDialog import set_value [as 別名]
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)
示例3: set_value
# 需要導入模塊: from syncthing_gtk.editordialog import EditorDialog [as 別名]
# 或者: from syncthing_gtk.editordialog.EditorDialog import set_value [as 別名]
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)
示例4: set_value
# 需要導入模塊: from syncthing_gtk.editordialog import EditorDialog [as 別名]
# 或者: from syncthing_gtk.editordialog.EditorDialog import set_value [as 別名]
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)
示例5: set_value
# 需要導入模塊: from syncthing_gtk.editordialog import EditorDialog [as 別名]
# 或者: from syncthing_gtk.editordialog.EditorDialog import set_value [as 別名]
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)
示例6: set_value
# 需要導入模塊: from syncthing_gtk.editordialog import EditorDialog [as 別名]
# 或者: from syncthing_gtk.editordialog.EditorDialog import set_value [as 別名]
def set_value(self, key, value):
if key == "addresses":
self.values[key] = [ strip_v(x) for x in value.split(",") ]
else:
return EditorDialog.set_value(self, key, value)