- Make inklevel widget easier to read (bug #576930).

This commit is contained in:
Tim Waugh 2010-03-25 16:29:48 +00:00
parent 1a36267ba8
commit 775d956b09
2 changed files with 80 additions and 1 deletions

View File

@ -0,0 +1,72 @@
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
+++ system-config-printer-1.2.0/gtkinklevel.py 2010-03-25 16:25:55.108235939 +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
@@ -90,6 +91,25 @@ class GtkInkLevel (gtk.DrawingArea):
ctx.set_source_rgb (1, 1, 1)
ctx.fill ()
+ ctx.set_line_width (thickness / 2)
+
+ ctx.move_to (0.03, 0.5)
+ ctx.line_to (0.9, 0.5)
+ ctx.set_source_rgb (r, g, b)
+ ctx.set_dash ([0.1])
+ ctx.stroke ()
+
+ ctx.move_to (0, 0.75)
+ ctx.line_to (1, 0.75)
+ ctx.set_source_rgb (r, g, b)
+ ctx.set_dash ([0.05])
+ ctx.stroke ()
+
+ ctx.move_to (0.15, 0.25)
+ ctx.line_to (0.6, 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
--- system-config-printer-1.2.0/system-config-printer.py.inklevel 2010-03-25 16:25:37.904233984 +0000
+++ system-config-printer-1.2.0/system-config-printer.py 2010-03-25 16:26:07.037359284 +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)

View File

@ -7,7 +7,7 @@
Summary: A printer administration tool Summary: A printer administration tool
Name: system-config-printer Name: system-config-printer
Version: 1.2.0 Version: 1.2.0
Release: 7%{?dist} Release: 8%{?dist}
License: GPLv2+ License: GPLv2+
URL: http://cyberelk.net/tim/software/system-config-printer/ URL: http://cyberelk.net/tim/software/system-config-printer/
Group: System Environment/Base Group: System Environment/Base
@ -26,6 +26,7 @@ Patch6: system-config-printer-cdi-filename.patch
Patch7: system-config-printer-reconnect-error.patch Patch7: system-config-printer-reconnect-error.patch
Patch8: system-config-printer-downloadable-drivers.patch Patch8: system-config-printer-downloadable-drivers.patch
Patch9: system-config-printer-JobCancel.patch Patch9: system-config-printer-JobCancel.patch
Patch10: system-config-printer-inklevel.patch
Patch100: system-config-printer-pycups-build.patch Patch100: system-config-printer-pycups-build.patch
@ -114,6 +115,9 @@ printers.
# Use new JobCancelPurge cups-pk-helper method (bug #576496). # Use new JobCancelPurge cups-pk-helper method (bug #576496).
%patch9 -p1 -b .JobCancel %patch9 -p1 -b .JobCancel
# Make inklevel widget easier to read (bug #576930).
%patch10 -p1 -b .inklevel
pushd pycups-%{pycups_version} pushd pycups-%{pycups_version}
# Fixed pycups build with new distutils. # Fixed pycups build with new distutils.
@ -236,6 +240,9 @@ rm -rf %buildroot
exit 0 exit 0
%changelog %changelog
* Thu Mar 25 2010 Tim Waugh <twaugh@redhat.com> - 1.2.0-8
- Make inklevel widget easier to read (bug #576930).
* Wed Mar 24 2010 Tim Waugh <twaugh@redhat.com> - 1.2.0-7 * Wed Mar 24 2010 Tim Waugh <twaugh@redhat.com> - 1.2.0-7
- Use new JobCancelPurge cups-pk-helper method (bug #576496). - Use new JobCancelPurge cups-pk-helper method (bug #576496).