aboutsummaryrefslogtreecommitdiffstats
path: root/lvc/widgets/gtk/controls.py
diff options
context:
space:
mode:
authorJesús Eduardo <heckyel@hyperbola.info>2018-01-14 19:01:08 -0500
committerJesús Eduardo <heckyel@hyperbola.info>2018-01-14 19:01:08 -0500
commit10251d991656d6a22f2f5124921b083afecedbba (patch)
tree1a5e2adc4abc2ebbceac5aa99acfa3975c7314c3 /lvc/widgets/gtk/controls.py
parent80227a9d85812abdc1d33fb4ecbdf19a7c23f75d (diff)
downloadlibrevideoconverter-10251d991656d6a22f2f5124921b083afecedbba.tar.lz
librevideoconverter-10251d991656d6a22f2f5124921b083afecedbba.tar.xz
librevideoconverter-10251d991656d6a22f2f5124921b083afecedbba.zip
pep8 en lvc/widgets/gtk/controls.py
Diffstat (limited to 'lvc/widgets/gtk/controls.py')
-rw-r--r--lvc/widgets/gtk/controls.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/lvc/widgets/gtk/controls.py b/lvc/widgets/gtk/controls.py
index 26ce6d6..aad1cd7 100644
--- a/lvc/widgets/gtk/controls.py
+++ b/lvc/widgets/gtk/controls.py
@@ -37,6 +37,7 @@ import layout
from .base import Widget
from .simple import Label
+
class BinBaselineCalculator(object):
"""Mixin class that defines the baseline method for gtk.Bin subclasses,
where the child is the label that we are trying to get the baseline for.
@@ -51,8 +52,10 @@ class BinBaselineCalculator(object):
metrics = pango_context.get_metrics(self._widget.style.font_desc)
return pango.PIXELS(metrics.get_descent()) + ypad
+
class TextEntry(Widget):
entry_class = gtk.Entry
+
def __init__(self, initial_text=None):
Widget.__init__(self)
self.create_signal('activate')
@@ -111,13 +114,16 @@ class NumberEntry(TextEntry):
else:
self._widget.set_text(self.previous_text)
+
class SecureTextEntry(TextEntry):
def __init__(self, initial_text=None):
TextEntry.__init__(self, initial_text)
self.set_invisible(True)
+
class MultilineTextEntry(Widget):
entry_class = gtk.TextView
+
def __init__(self, initial_text=None, border=False):
Widget.__init__(self)
self.set_widget(self.entry_class())
@@ -148,6 +154,7 @@ class MultilineTextEntry(Widget):
def set_editable(self, editable):
self._widget.set_editable(editable)
+
class Checkbox(Widget, BinBaselineCalculator):
"""Widget that the user can toggle on or off."""
@@ -184,7 +191,8 @@ class Checkbox(Widget, BinBaselineCalculator):
focus_width = self._widget.style_get_property('focus-line-width')
focus_padding = self._widget.style_get_property('focus-padding')
return (indicator_size + 3 * indicator_spacing + 2 * (focus_width +
- focus_padding))
+ focus_padding))
+
class RadioButtonGroup(Widget, BinBaselineCalculator):
"""RadioButtonGroup.
@@ -221,6 +229,7 @@ class RadioButtonGroup(Widget, BinBaselineCalculator):
else:
mem._widget.set_active(False)
+
class RadioButton(Widget, BinBaselineCalculator):
"""RadioButton."""
def __init__(self, label, group=None, color=None):
@@ -251,6 +260,7 @@ class RadioButton(Widget, BinBaselineCalculator):
def set_selected(self):
self.group.set_selected(self)
+
class Button(Widget, BinBaselineCalculator):
def __init__(self, text, style='normal', width=None):
Widget.__init__(self)
@@ -283,6 +293,7 @@ class Button(Widget, BinBaselineCalculator):
def set_color(self, color):
self.label.set_color(color)
+
class OptionMenu(Widget):
def __init__(self, options):
Widget.__init__(self)