<commit_before># encoding: iso-8859-1
import gtk

from kiwi.datatypes import ValidationError
from kiwi.ui.widgets.combobox import ComboBoxEntry
from kiwi.ui.delegates import Delegate, SlaveDelegate

class Dialog(Delegate):
    def __init__(self):
        Delegate.__init__(self, gladefile='lang',
                          widgets=['ok_button'],
                          delete_handler=self.quit_if_last)
        self.register_validate_function(self.validity)

    def validity(self, data):
        self.ok_button.set_sensitive(data)

    def on_ok_button__clicked(self, button):
        raise SystemExit
    
class English(SlaveDelegate):
    def __init__(self):
        box = gtk.HBox(spacing=6)
        box.set_border_width(6)
        box.show()
        
        label = gtk.Label("Number:")
        label.show()
        box.pack_start(label, False, False)

        combo = ComboBoxEntry()
        combo.set_property('model-attribute', 'number')
        combo.set_property('data-type', 'str')
        combo.prefill(['One', 'Two', 'Three'])
        combo.show()
        box.pack_start(combo)
        self.combo = combo
        
        SlaveDelegate.__init__(self, toplevel=box, widgets=['combo'])

    def on_combo__validate(self, widget, data):
        if data != 'Two':
            return ValidationError("foo")

class Swedish(SlaveDelegate):
    def __init__(self):
        box = gtk.HBox(spacing=6)
        box.set_border_width(6)
        box.show()
        
        label = gtk.Label("Nummer:")
        label.show()
        box.pack_start(label, False, False)

        combo = ComboBoxEntry()
        combo.set_property('model-attribute', 'nummer')
        combo.set_property('data-type', 'str')
        combo.prefill(['Ett', u'Tv', 'Tre'])
        combo.show()
        box.pack_start(combo)
        self.combo = combo
        
        SlaveDelegate.__init__(self, toplevel=box, widgets=['combo'])

    def on_combo__validate(self, widget, data):
        if data != 'Tre':
            return ValidationError("bar")

class EnglishModel:
    pass

class SwedishModel:
    # Sylvia Saint?
    pass

dialog = Dialog()

# English
babe = EnglishModel()
babe.number = 'One'

eng = English()
eng.show()<commit_msg>whitespace<commit_after># encoding: iso-8859-1
import gtk

from kiwi.datatypes import ValidationError
from kiwi.ui.widgets.combobox import ComboBoxEntry
from kiwi.ui.delegates import Delegate, SlaveDelegate

class Dialog(Delegate):
    def __init__(self):
        Delegate.__init__(self, gladefile='lang',
                          widgets=['ok_button'],
                          delete_handler=self.quit_if_last)
        self.register_validate_function(self.validity)

    def validity(self, data):
        self.ok_button.set_sensitive(data)

    def on_ok_button__clicked(self, button):
        raise SystemExit

class English(SlaveDelegate):
    def __init__(self):
        box = gtk.HBox(spacing=6)
        box.set_border_width(6)
        box.show()

        label = gtk.Label("Number:")
        label.show()
        box.pack_start(label, False, False)

        combo = ComboBoxEntry()
        combo.set_property('model-attribute', 'number')
        combo.set_property('data-type', 'str')
        combo.prefill(['One', 'Two', 'Three'])
        combo.show()
        box.pack_start(combo)
        self.combo = combo

        SlaveDelegate.__init__(self, toplevel=box, widgets=['combo'])

    def on_combo__validate(self, widget, data):
        if data != 'Two':
            return ValidationError("foo")

class Swedish(SlaveDelegate):
    def __init__(self):
        box = gtk.HBox(spacing=6)
        box.set_border_width(6)
        box.show()

        label = gtk.Label("Nummer:")
        label.show()
        box.pack_start(label, False, False)

        combo = ComboBoxEntry()
        combo.set_property('model-attribute', 'nummer')
        combo.set_property('data-type', 'str')
        combo.prefill(['Ett', u'Tv', 'Tre'])
        combo.show()
        box.pack_start(combo)
        self.combo = combo

        SlaveDelegate.__init__(self, toplevel=box, widgets=['combo'])

    def on_combo__validate(self, widget, data):
        if data != 'Tre':
            return ValidationError("bar")

class EnglishModel:
    pass

class SwedishModel:
    # Sylvia Saint?
    pass

dialog = Dialog()

# English
babe = EnglishModel()
babe.number = 'One'

eng = English()
eng.show()
{'fraction_non_alphanumeric': 0.12343429742655432, 'fraction_numerical': 0.004099294010475973, 'mean_word_length': 2.5505254648342763, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '335149', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1373, 'n_words': 263}