def filter(self, tag, value):
     spls = config.get("editing", "split_on").decode('utf-8', 'replace')
     spls = spls.split()
     return "\n".join(util.split_value(value, spls))
Exemple #2
0
 def __init__(self, tag, value):
     super(SplitValues, self).__init__(_("Split into _Multiple Values"))
     self.set_image(gtk.image_new_from_stock(gtk.STOCK_FIND_AND_REPLACE, gtk.ICON_SIZE_MENU))
     spls = config.get("editing", "split_on").decode("utf-8", "replace").split()
     self.set_sensitive(len(util.split_value(value, spls)) > 1)
Exemple #3
0
 def activated(self, tag, value):
     spls = config.get("editing", "split_on").decode("utf-8", "replace").split()
     return [(tag, value) for value in util.split_value(value, spls)]
Exemple #4
0
 def test_wordboundry(self):
     self.failUnlessEqual(
         util.split_value("Andromeda and the Band", ["and"]),
         ["Andromeda", "the Band"])
Exemple #5
0
 def test_unicode_wordboundry(self):
     val = '\xe3\x81\x82&\xe3\x81\x84'.decode('utf-8')
     self.failUnlessEqual(util.split_value(val), val.split("&"))
Exemple #6
0
 def test_no_splitters(self):
     self.failUnlessEqual(util.split_value("a b", []), ["a b"])
Exemple #7
0
 def test_two_splitters(self):
     self.failUnlessEqual(
         util.split_value("a, b and c", [",", "and"]), ["a", "b and c"])
Exemple #8
0
 def test_custom_splitter(self):
     self.failUnlessEqual(util.split_value("a b", [" "]), ["a", "b"])
Exemple #9
0
 def test_double(self):
     self.failUnlessEqual(util.split_value("a, b"), ["a", "b"])
Exemple #10
0
 def test_single(self):
     self.failUnlessEqual(util.split_value("a b"), ["a b"])