本文整理汇总了Python中syncthing_gtk.editordialog.EditorDialog类的典型用法代码示例。如果您正苦于以下问题:Python EditorDialog类的具体用法?Python EditorDialog怎么用?Python EditorDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EditorDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: display_value
def display_value(self, key, w):
if key == "vautostart_daemon":
value = self.get_value(key[1:])
if value == 0: self["rbOnStartWait"].set_active(True)
elif value == 1: self["rbOnStartRun"].set_active(True)
else: self["rbOnStartAsk"].set_active(True)
elif key == "vautokill_daemon":
value = self.get_value(key[1:])
if value == 1: self["rbOnExitTerminate"].set_active(True)
elif value == 0: self["rbOnExitLeave"].set_active(True)
else: self["rbOnExitAsk"].set_active(True)
else:
return EditorDialog.display_value(self, key, w)
开发者ID:syncthing,项目名称:syncthing-gtk,代码行数:13,代码来源:uisettingsdialog.py
示例17: get_value
def get_value(self, key):
if key == "listenAddresses":
return ", ".join([ strip_v(x) for x in self.values[key]])
elif key == "globalAnnounceServers":
return ", ".join([ strip_v(x) for x in self.values["globalAnnounceServers"]])
elif key == "urAccepted":
return (self.values["urAccepted"] == 1)
elif key == "maxSendKbpsEnabled":
return (self.values["maxSendKbps"] != 0)
elif key == "maxRecvKbpsEnabled":
return (self.values["maxRecvKbps"] != 0)
else:
return EditorDialog.get_value(self, key)
开发者ID:syncthing,项目名称:syncthing-gtk,代码行数:13,代码来源:daemonsettings.py
示例18: get_value
def get_value(self, key):
if key == "keepVersions":
return self.get_burried_value("versioning/params/keep", self.values, 0, int)
elif key == "maxAge":
return self.get_burried_value("versioning/params/maxAge", self.values, 0, int) / 86400 # seconds to days
elif key == "versionsPath":
return self.get_burried_value("versioning/params/versionsPath", self.values, "")
elif key == "versioning":
return self.get_burried_value("versioning/type", self.values, "")
elif key == "inotify":
return self.id in self.app.config["use_inotify"]
else:
return EditorDialog.get_value(self, key)
开发者ID:GeoffreyFrogeye,项目名称:syncthing-gtk,代码行数:13,代码来源:foldereditor.py
示例19: get_value
def get_value(self, key):
if key == "keepVersions":
return self.get_burried_value("versioning/params/keep", self.values, 0, int)
elif key == "maxAge":
return self.get_burried_value("versioning/params/maxAge", self.values, 0, int) / 86400 # seconds to days
elif key == "cleanoutDays":
return self.get_burried_value("versioning/params/cleanoutDays", self.values, 0, int)
elif key == "command":
return self.get_burried_value("versioning/params/command", self.values, "")
elif key == "versionsPath":
return self.get_burried_value("versioning/params/versionsPath", self.values, "")
elif key == "readOnly":
return self.get_burried_value("type", self.values, "") in ("readonly", "sendonly")
elif key == "receiveOnly":
return self.get_burried_value("type", self.values, "") in ("receiveonly")
elif key == "versioning":
return self.get_burried_value("versioning/type", self.values, "")
else:
return EditorDialog.get_value(self, key)
开发者ID:syncthing,项目名称:syncthing-gtk,代码行数:19,代码来源:foldereditor.py
示例20: __init__
def __init__(self, app):
EditorDialog.__init__(self, app, "daemon-settings.glade",
_("Syncthing Daemon Settings"))
开发者ID:syncthing,项目名称:syncthing-gtk,代码行数:3,代码来源:daemonsettings.py
注:本文中的syncthing_gtk.editordialog.EditorDialog类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论