/usr/lib/gdesklets/config/DaemonConfigger.py is in gdesklets 0.36.1-5+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | from StateSaver import DefaultStateSaver
from ConfigDialog import ConfigDialog
from main import ICON, VERSION
from utils.datatypes import *
import settings
import getopt
import sys
class DaemonConfigger(ConfigDialog):
"""
Configuration Dialog for the daemon.
"""
__ITEMS = (
("title", {"label": _("Editor to view/edit the desklet source code")}),
("uri", {"label": _("Your favorite editor"),
"bind": "editor"}),
("title", {"label": _("Screen Resolution (DPI)")}),
("dpi", {"label": "<small>" +
_("Adjust the value above so that the bar will be "
"exactly <b>5 cm</b> or <b>1.97\"</b> wide") +
"</small>",
"bind": "dpi", "value": 96}),
("title", {"label": _("Behavior")}),
("boolean", {"label": _("Show _tray icon (takes effect after restart)"),
"bind": "trayicon"}),
("boolean", {"label": _("Show _notification while loading a desklet"),
"bind": "loadsplash"}),
("keybinding", {"label": _("Key for toggling Float mode:"),
"bind": "float_key"})
)
def __init__(self, path=""):
self.__backend = DefaultStateSaver()
ConfigDialog.__init__(self, path)
self.set_property("title", _("Configuration"))
self.set_banner(ICON, "<big>gDesklets Configuration</big>\n"
"Version %s" % (VERSION,))
self._set_setter(self.__setter)
self._set_getter(self.__getter)
self._set_caller(self.__caller)
self.build(self.__ITEMS)
self.__load_config()
self.__read_cmd_line()
def __setter(self, key, value, datatype):
if (key == "editor"):
settings.editor = value
elif (key == "dpi"):
settings.dpi = value
elif (key == "float_key"):
settings.float_key = value
elif (key == "loadsplash"):
settings.show_load_splash = value
elif (key == "trayicon"):
settings.show_tray_icon = value
self.__backend.set_key(key, value)
def __getter(self, key):
if (key == "editor"):
return settings.editor
elif (key == "dpi"):
return settings.dpi
elif (key == "float_key"):
return settings.float_key
elif (key == "loadsplash"):
return settings.show_load_splash
elif (key == "trayicon"):
return settings.show_tray_icon
else:
return "gDesklets killed a kitten!"
def __caller(self, *args): pass
def __load_config(self):
settings.editor = self.__backend.get_key("editor", settings.editor)
settings.dpi = self.__backend.get_key("dpi", settings.dpi)
settings.float_key = self.__backend.get_key("float_key",
settings.float_key)
settings.show_load_splash = self.__backend.get_key("loadsplash",
settings.show_load_splash)
settings.show_tray_icon = self.__backend.get_key("trayicon",
settings.show_tray_icon)
def __read_cmd_line(self):
OPTIONS = ("sm-client-id=", "sm-config-prefix=", "sm-disable",
"no-tray-icon")
#
# Parses the given list of command line arguments. This is usually
# sys.argv[1:].
#
try:
opts, rest = getopt.getopt(sys.argv[1:], "nop:v", OPTIONS)
except getopt.GetoptError:
return
for o, a in opts:
if (o == "--no-tray-icon"):
settings.show_tray_icon = False
elif (o in ("--sm-client-id", "--sm-config-prefix",
"--sm-disable")):
pass
|