本文整理汇总了Python中syncthing_gtk.EditorDialog类的典型用法代码示例。如果您正苦于以下问题:Python EditorDialog类的具体用法?Python EditorDialog怎么用?Python EditorDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EditorDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __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:Rongya,项目名称:syncthing-gtk,代码行数:7,代码来源:deviceeditor.py
示例2: 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" : False
})
else:
EditorDialog.store_value(self, key, w)
开发者ID:Rongya,项目名称:syncthing-gtk,代码行数:31,代码来源:deviceeditor.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:LenzGr,项目名称:syncthing-gtk,代码行数:28,代码来源:foldereditor.py
示例4: 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:Newman101,项目名称:syncthing-gtk,代码行数:9,代码来源:uisettingsdialog.py
示例5: __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 bellow or click on <b>Download</b> "
"button to download latest Syncthing package.") % (exe,)
))
开发者ID:Rongya,项目名称:syncthing-gtk,代码行数:11,代码来源:finddaemondialog.py
示例6: 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:LenzGr,项目名称:syncthing-gtk,代码行数:13,代码来源:foldereditor.py
示例7: store_value
def store_value(self, key, w):
if key == "vDevices": # Still very special case
devices = [ {
"Addresses" : None,
"DeviceID" : b.get_tooltip_text(),
"Name" : "",
"CertName" : "",
"Compression" : False
}
for b in self["vDevices"].get_children()
if b.get_active()
]
self.set_value("Devices", devices)
else:
EditorDialog.store_value(self, key, w)
开发者ID:LenzGr,项目名称:syncthing-gtk,代码行数:15,代码来源:foldereditor.py
示例8: get_value
def get_value(self, key):
if key == "ListenAddress":
return ",".join([ x.strip() for x in self.values[key]])
elif key == "MaxSendKbpsEnabled":
return (self.values["MaxSendKbps"] != 0)
else:
return EditorDialog.get_value(self, key)
开发者ID:bboerner,项目名称:syncthing-gui,代码行数:7,代码来源:daemonsettings.py
示例9: set_value
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)
开发者ID:Rongya,项目名称:syncthing-gtk,代码行数:32,代码来源:daemonsettings.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:Newman101,项目名称:syncthing-gtk,代码行数:16,代码来源:uisettingsdialog.py
示例11: 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_end(b, False, False, 0)
b.set_active(folder["id"] in rids)
self["vFolders"].show_all()
else:
EditorDialog.display_value(self, key, w)
开发者ID:Rongya,项目名称:syncthing-gtk,代码行数:18,代码来源:deviceeditor.py
示例12: __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 bellow 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 bellow") % (exe,)
))
self.hide_download_button()
开发者ID:nagyist,项目名称:syncthing-gtk,代码行数:20,代码来源:finddaemondialog.py
示例13: 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
else:
return EditorDialog.store_value(self, key, w)
开发者ID:bboerner,项目名称:syncthing-gui,代码行数:11,代码来源:uisettings.py
示例14: 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:LenzGr,项目名称:syncthing-gtk,代码行数:13,代码来源:foldereditor.py
示例15: 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:Newman101,项目名称:syncthing-gtk,代码行数:13,代码来源:uisettingsdialog.py
示例16: set_value
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)
开发者ID:bboerner,项目名称:syncthing-gui,代码行数:14,代码来源:daemonsettings.py
示例17: get_value
def get_value(self, key):
if key == "ListenAddress":
return ", ".join([ x.strip() for x in self.values[key]])
elif key == "GlobalAnnServers":
if "GlobalAnnServer" in self.values:
# For Syncthing < 0.9.10
return self.values["GlobalAnnServer"]
return ", ".join([ x.strip() for x in self.values["GlobalAnnServers"]])
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:Rongya,项目名称:syncthing-gtk,代码行数:16,代码来源:daemonsettings.py
示例18: __init__
def __init__(self, app):
EditorDialog.__init__(self, app, "daemon-settings.glade",
"Syncthing Daemon Settings")
开发者ID:bboerner,项目名称:syncthing-gui,代码行数:3,代码来源:daemonsettings.py
示例19: get_value
def get_value(self, key):
if key == "Addresses":
return ",".join([ x.strip() for x in self.values[key]])
else:
return EditorDialog.get_value(self, key)
开发者ID:Rongya,项目名称:syncthing-gtk,代码行数:5,代码来源:deviceeditor.py
示例20: set_value
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)
开发者ID:Rongya,项目名称:syncthing-gtk,代码行数:5,代码来源:deviceeditor.py
注:本文中的syncthing_gtk.EditorDialog类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论