本文整理汇总了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)