/usr/lib/gdesklets/config/ConfigDPI.py is in gdesklets 0.36.1-5.
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 | from ConfigWidget import ConfigWidget
from utils.datatypes import *
import gtk
class ConfigDPI(ConfigWidget):
def __init__(self, name, getter, setter, caller):
ConfigWidget.__init__(self, name, getter, setter, caller)
self._register_property("value", TYPE_INT, self._setp_value,
self._getp, "", doc = "DPI value")
def get_widgets(self):
vbox = gtk.VBox(spacing = 3)
vbox.show()
hbox = gtk.HBox(spacing = 6)
hbox.show()
vbox.add(hbox)
lbl = gtk.Label("dpi:")
hbox.pack_start(lbl, False, False)
spin = gtk.SpinButton()
spin.show()
spin.set_range(10, 500)
spin.set_increments(1, 10)
spin.set_digits(0)
spin.connect("value-changed", self.__on_change)
hbox.pack_start(spin, False, False)
self.__line = gtk.Viewport()
self.__line.show()
self.__line.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("grey80"))
hbox.pack_start(self.__line, False, False)
lbl = gtk.Label("<-- 5 cm / 1.97\" -->")
lbl.show()
lbl.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("black"))
self.__line.add(lbl)
self.__label = gtk.Label("")
self.__label.show()
vbox.add(self.__label)
self.__box = vbox
self.__spin = spin
return (vbox,)
def __on_change(self, src, *args):
value = int(src.get_value())
self.__set_line(value)
self._set_config(value)
def __set_line(self, dpi):
width = int(5 * (1 / 2.54) * dpi)
self.__line.set_size_request(width, 10)
def _set_enabled(self, value): self.__box.set_sensitive(value)
def _set_label(self, value): self.__label.set_markup(value)
def _setp_value(self, key, value):
self.__spin.set_value(value)
self._setp(key, value)
|