本文整理汇总了Python中syncthing_gtk.EditorDialog.set_value方法的典型用法代码示例。如果您正苦于以下问题:Python EditorDialog.set_value方法的具体用法?Python EditorDialog.set_value怎么用?Python EditorDialog.set_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类syncthing_gtk.EditorDialog
的用法示例。
在下文中一共展示了EditorDialog.set_value方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_value
# 需要导入模块: from syncthing_gtk import EditorDialog [as 别名]
# 或者: from syncthing_gtk.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 import EditorDialog [as 别名]
# 或者: from syncthing_gtk.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)
示例3: set_value
# 需要导入模块: from syncthing_gtk import EditorDialog [as 别名]
# 或者: from syncthing_gtk.EditorDialog import set_value [as 别名]
def set_value(self, key, value):
if key == "ListenAddress":
self.values[key] = [ x.strip() for x in value.split(",") ]
elif key == "GlobalAnnServers":
self.values[key] = [ x.strip() for x in value.split(",") ]
if "GlobalAnnServer" in self.values:
# For Syncthing < 0.9.10
if len(self.values[key]) > 0:
self.values["GlobalAnnServer"] = self.values[key][0]
else:
self.values["GlobalAnnServer"] = ""
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
print "MaxSendKbpsEnabled : MaxSendKbps zeroed"
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)
示例4: set_value
# 需要导入模块: from syncthing_gtk import EditorDialog [as 别名]
# 或者: from syncthing_gtk.EditorDialog import set_value [as 别名]
def set_value(self, key, value):
if key == "ListenAddress":
self.values[key] = [ x.strip() for x in value.split(",") ]
elif key == "URAccepted":
self.values[key] = 1 if value else 0
elif key == "MaxSendKbpsEnabled":
if value:
if self.values["MaxSendKbps"] <= 0:
self.values["MaxSendKbps"] = 1
else:
self.values["MaxSendKbps"] = 0
self.find_widget_by_id("vMaxSendKbps").get_adjustment().set_value(self.values["MaxSendKbps"])
else:
return EditorDialog.set_value(self, key, value)
示例5: set_value
# 需要导入模块: from syncthing_gtk import EditorDialog [as 别名]
# 或者: from syncthing_gtk.EditorDialog import set_value [as 别名]
def set_value(self, key, value):
if key == "Addresses":
self.values[key] = [ x.strip() for x in value.split(",") ]
else:
return EditorDialog.set_value(self, key, value)