def test_column_wrapping(self): # Test column wrapping text c = ColumnWidget([(15, [self.w1, self.w2, self.w3]), (10, [self.w4, self.w5])], spacing=1) c.render(80) expected_result = [u"Můj krásný Krásný", u"dlouhý text dlouhý", u"Test text", u"Test 2 podruhé", u" Test 3"] res_lines = c.get_lines() self.evaluate_result(res_lines, expected_result)
def test_column_widget(self): # Test column text c = ColumnWidget([(20, [self.w1, self.w2, self.w3]), (25, [self.w4, self.w5]), (15, [self.w1, self.w2, self.w3])], spacing=3) c.render(80) res_lines = c.get_lines() expected_result = [u"Můj krásný dlouhý Krásný dlouhý text Můj krásný", u"text podruhé dlouhý text", u"Test Test 3 Test", u"Test 2 Test 2"] self.evaluate_result(res_lines, expected_result)
def _prep_text(i, entry): number = TextWidget("%2d)" % i) title = TextWidget(_(entry.title)) value = getdeepattr(self.args, entry.attribute) value = TextWidget(value) return ColumnWidget([(3, [number]), (None, [title, value])], 1)
def _prep_password(i, entry): number = TextWidget("%2d)" % i) title = TextWidget(_(entry.title)) value = "" if len(getdeepattr(self.args, entry.attribute)) > 0: value = _("Password set.") value = TextWidget(value) return ColumnWidget([(3, [number]), (None, [title, value])], 1)
def _prep_check(i, entry): number = TextWidget("%2d)" % i) value = getdeepattr(self.args, entry.attribute) ch = CheckboxWidget(title=_(entry.title), completed=bool(value)) return ColumnWidget([(3, [number]), (None, [ch])], 1)