system-config-printer/system-config-printer-inklevel.patch

79 lines
3.0 KiB
Diff
Raw Normal View History

diff -up system-config-printer-1.2.0/gtkinklevel.py.inklevel system-config-printer-1.2.0/gtkinklevel.py
--- system-config-printer-1.2.0/gtkinklevel.py.inklevel 2009-12-03 17:06:22.000000000 +0000
2010-03-26 10:36:13 +00:00
+++ system-config-printer-1.2.0/gtkinklevel.py 2010-03-26 10:34:15.981600493 +0000
@@ -1,7 +1,8 @@
#!/usr/bin/env python
-## Copyright (C) 2009 Tim Waugh <twaugh@redhat.com>
-## Copyright (C) 2009 Red Hat, Inc.
+## Copyright (C) 2010 Red Hat, Inc.
+## Authors:
+## Tim Waugh <twaugh@redhat.com>
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -56,10 +57,9 @@ class GtkInkLevel (gtk.DrawingArea):
ctx.translate (thickness, thickness)
ctx.scale (w - 2 * thickness, h - 2 * thickness)
thickness = max (ctx.device_to_user_distance (thickness, thickness))
- ctx.set_line_width (thickness)
- self.draw (ctx)
+ self.draw (ctx, thickness)
- def draw (self, ctx):
+ def draw (self, ctx, thickness):
r = self._color.red / 65535.0
g = self._color.green / 65535.0
b = self._color.blue / 65535.0
@@ -72,6 +72,7 @@ class GtkInkLevel (gtk.DrawingArea):
ctx.curve_to (0.0, 0.5, 0.1, 0.2, 0.5, 0.0)
ctx.close_path ()
ctx.set_source_rgb (r, g, b)
+ ctx.set_line_width (thickness)
ctx.stroke_preserve ()
if fill_point > 0.0:
grad_width = 0.10
2010-03-26 10:36:13 +00:00
@@ -90,6 +91,31 @@ class GtkInkLevel (gtk.DrawingArea):
ctx.set_source_rgb (1, 1, 1)
ctx.fill ()
+ ctx.set_line_width (thickness / 2)
+
2010-03-26 10:36:13 +00:00
+ ctx.move_to (0.5, 0.0)
+ ctx.line_to (0.5, 1.0)
+ ctx.set_source_rgb (r, g, b)
+ ctx.stroke ()
+
2010-03-26 10:36:13 +00:00
+ # 50% marker
+ ctx.move_to (0.4, 0.5)
+ ctx.line_to (0.6, 0.5)
+ ctx.set_source_rgb (r, g, b)
+ ctx.stroke ()
+
2010-03-26 10:36:13 +00:00
+ # 25% marker
+ ctx.move_to (0.45, 0.75)
+ ctx.line_to (0.55, 0.75)
+ ctx.set_source_rgb (r, g, b)
+ ctx.stroke ()
+
+ # 75% marker
+ ctx.move_to (0.45, 0.25)
+ ctx.line_to (0.55, 0.25)
+ ctx.set_source_rgb (r, g, b)
+ ctx.stroke ()
+
if __name__ == '__main__':
# Try it out.
import gobject
diff -up system-config-printer-1.2.0/system-config-printer.py.inklevel system-config-printer-1.2.0/system-config-printer.py
2010-03-26 10:36:13 +00:00
--- system-config-printer-1.2.0/system-config-printer.py.inklevel 2010-03-26 10:34:06.158727658 +0000
+++ system-config-printer-1.2.0/system-config-printer.py 2010-03-26 10:34:06.250725897 +0000
@@ -2681,6 +2681,7 @@ class GUI(GtkGUI, monitor.Watcher):
vbox = gtk.VBox (spacing=6)
subhbox = gtk.HBox ()
inklevel = gtkinklevel.GtkInkLevel (color, level)
+ inklevel.set_tooltip_text ("%d%%" % level)
subhbox.pack_start (inklevel, True, False, 0)
vbox.pack_start (subhbox, False, False, 0)
label = gtk.Label (name)