Ejemplo n.º 1
0
    def _parse_theme_file(self, f):
        contents = {}

        for line in f:
            # regex matching is easier by stripping leading/trailing whitespace
            line = line.strip()

            if Xparser.valid(line):
                # try matchig a line with rgb values
                match = Xparser.rgb(line)
                if match:
                    contents[match['name']] = match['value']
                    continue

                # rgb match failed, try with hex
                match = Xparser.hex(line)
                if match:
                    contents[match['name']] = match['value']
        return contents
Ejemplo n.º 2
0
    def _parse_theme_file(self, f):
        contents = {}

        for line in f:
            # regex matching is easier by stripping leading/trailing whitespace
            line = line.strip()

            if Xparser.valid(line):
                # try matchig a line with rgb values
                match = Xparser.rgb(line)
                if match:
                    contents[match['name']] = match['value']
                    continue

                # rgb match failed, try with hex
                match = Xparser.hex(line)
                if match:
                    contents[match['name']] = match['value']
        return contents
Ejemplo n.º 3
0
 def test_urxvt_dot_hex(self):
     line = "URxvt.color5: #aabbcc"
     self.assertTrue(Xparser.valid(line))
     output = Xparser.hex(line)
     self.assertEqual(output, self.expected)
Ejemplo n.º 4
0
 def test_generic_hex(self):
     line = "*color5: #aabbcc"
     self.assertTrue(Xparser.valid(line))
     output = Xparser.hex(line)
     self.assertEqual(output, self.expected)
Ejemplo n.º 5
0
 def test_urxvt_dot_hex(self):
     line = "URxvt.color5: #aabbcc"
     self.assertTrue(Xparser.valid(line))
     output = Xparser.hex(line)
     self.assertEqual(output, self.expected)
Ejemplo n.º 6
0
 def test_generic_hex(self):
     line = "*color5: #aabbcc"
     self.assertTrue(Xparser.valid(line))
     output = Xparser.hex(line)
     self.assertEqual(output, self.expected)