aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lvc/widgets/gtk/simple.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/lvc/widgets/gtk/simple.py b/lvc/widgets/gtk/simple.py
index 102fcd4..dd94f4d 100644
--- a/lvc/widgets/gtk/simple.py
+++ b/lvc/widgets/gtk/simple.py
@@ -36,6 +36,7 @@ import pango
from lvc.widgets import widgetconst
from .base import Widget, Bin
+
class Image(object):
def __init__(self, path):
try:
@@ -54,7 +55,7 @@ class Image(object):
width = int(round(width))
height = int(round(height))
resized_pixbuf = self.pixbuf.scale_simple(width, height,
- gtk.gdk.INTERP_BILINEAR)
+ gtk.gdk.INTERP_BILINEAR)
return TransformedImage(resized_pixbuf)
def resize_for_space(self, width, height):
@@ -65,7 +66,7 @@ class Image(object):
return self.resize(ratio * self.width, ratio * self.height)
def crop_and_scale(self, src_x, src_y, src_width, src_height, dest_width,
- dest_height):
+ dest_height):
"""Crop an image then scale it.
The image will be cropped to the rectangle (src_x, src_y, src_width,
@@ -73,23 +74,26 @@ class Image(object):
(dest_width, dest_height)
"""
dest = gtk.gdk.Pixbuf(self.pixbuf.get_colorspace(),
- self.pixbuf.get_has_alpha(),
- self.pixbuf.get_bits_per_sample(), dest_width, dest_height)
+ self.pixbuf.get_has_alpha(),
+ self.pixbuf.get_bits_per_sample(),
+ dest_width, dest_height)
scale_x = dest_width / float(src_width)
scale_y = dest_height / float(src_height)
self.pixbuf.scale(dest, 0, 0, dest_width, dest_height,
- -src_x * scale_x, -src_y * scale_y, scale_x, scale_y,
- gtk.gdk.INTERP_BILINEAR)
+ -src_x * scale_x, -src_y * scale_y,
+ scale_x, scale_y, gtk.gdk.INTERP_BILINEAR)
return TransformedImage(dest)
+
class TransformedImage(Image):
def __init__(self, pixbuf):
# XXX intentionally not calling direct super's __init__; we should do
# this differently
self._set_pixbuf(pixbuf)
+
class ImageDisplay(Widget):
def __init__(self, image=None):
Widget.__init__(self)
@@ -103,6 +107,7 @@ class ImageDisplay(Widget):
else:
self._widget.clear()
+
class AnimatedImageDisplay(Widget):
def __init__(self, path):
Widget.__init__(self)
@@ -120,6 +125,7 @@ class AnimatedImageDisplay(Widget):
else:
self._widget.clear()
+
class Label(Widget):
"""Widget that displays simple text."""
def __init__(self, text="", color=None):
@@ -208,6 +214,7 @@ class Label(Widget):
def show(self):
self._widget.show()
+
class Scroller(Bin):
def __init__(self, horizontal, vertical):
Bin.__init__(self)
@@ -257,6 +264,7 @@ class SolidBackground(Bin):
self.modify_style('base', gtk.STATE_NORMAL, self.make_color(color))
self.modify_style('bg', gtk.STATE_NORMAL, self.make_color(color))
+
class Expander(Bin):
def __init__(self, child=None):
Bin.__init__(self)
@@ -269,7 +277,7 @@ class Expander(Bin):
# just set the background to white there because that's what should
# happen in the item list.
self.modify_style('bg', gtk.STATE_PRELIGHT,
- gtk.gdk.color_parse('white'))
+ gtk.gdk.color_parse('white'))
def set_spacing(self, spacing):
self._widget.set_spacing(spacing)
@@ -282,6 +290,7 @@ class Expander(Bin):
def set_expanded(self, expanded):
self._widget.set_expanded(expanded)
+
class ProgressBar(Widget):
def __init__(self):
Widget.__init__(self)
@@ -304,6 +313,7 @@ class ProgressBar(Widget):
self._widget.pulse()
return True
+
class HLine(Widget):
"""A horizontal separator. Not to be confused with HSeparator, which is is
a DrawingArea, not a Widget.