Example #1
0
 def test_update_ordered_dict_key(self):
     self.ordered_dict = OrderedDict()
     self.ordered_dict["default"] = "Some stuff"
     self.ordered_dict["pythoncheck"] = "Somemore stuff"
     self.ordered_dict = update_ordered_dict_key(self.ordered_dict,
                                                 "default", "coala")
     self.assertTrue("coala" in self.ordered_dict)
     self.assertEqual(
         "OrderedDict([('coala', 'Some stuff'), "
         "('pythoncheck', 'Somemore stuff')])", self.ordered_dict.__str__())
     self.ordered_dict = update_ordered_dict_key(self.ordered_dict, "coala",
                                                 "section")
     self.assertTrue("section" in self.ordered_dict)
     self.assertEqual(
         "OrderedDict([('section', 'Some stuff'), "
         "('pythoncheck', 'Somemore stuff')])", self.ordered_dict.__str__())
Example #2
0
 def test_update_ordered_dict_key(self):
     self.ordered_dict = OrderedDict()
     self.ordered_dict["default"] = "Some stuff"
     self.ordered_dict["pythoncheck"] = "Somemore stuff"
     self.ordered_dict = update_ordered_dict_key(self.ordered_dict,
                                                 "default",
                                                 "coala")
     self.assertTrue("coala" in self.ordered_dict)
     self.assertEqual("OrderedDict([('coala', 'Some stuff'), "
                      "('pythoncheck', 'Somemore stuff')])",
                      self.ordered_dict.__str__())
     self.ordered_dict = update_ordered_dict_key(self.ordered_dict,
                                                 "coala",
                                                 "section")
     self.assertTrue("section" in self.ordered_dict)
     self.assertEqual("OrderedDict([('section', 'Some stuff'), "
                      "('pythoncheck', 'Somemore stuff')])",
                      self.ordered_dict.__str__())
Example #3
0
 def test_update_ordered_dict_key(self):
     self.ordered_dict = OrderedDict()
     self.ordered_dict['default'] = 'Some stuff'
     self.ordered_dict['pythoncheck'] = 'Somemore stuff'
     self.ordered_dict = update_ordered_dict_key(self.ordered_dict,
                                                 'default',
                                                 'coala')
     self.assertTrue('coala' in self.ordered_dict)
     self.assertEqual("OrderedDict([('coala', 'Some stuff'), "
                      "('pythoncheck', 'Somemore stuff')])",
                      self.ordered_dict.__str__())
     self.ordered_dict = update_ordered_dict_key(self.ordered_dict,
                                                 'coala',
                                                 'section')
     self.assertTrue('section' in self.ordered_dict)
     self.assertEqual("OrderedDict([('section', 'Some stuff'), "
                      "('pythoncheck', 'Somemore stuff')])",
                      self.ordered_dict.__str__())
Example #4
0
 def update_section_name(self, widget, arg, old_name, section_view):
     section_view.set_name(widget.get_name())
     self.sections_dict[old_name].name = widget.get_name()
     self.sections_dict = update_ordered_dict_key(self.sections_dict,
                                                  old_name,
                                                  widget.get_name())
     widget.connect("edited", self.update_section_name, widget.get_name())
     conf_writer = ConfWriter(self.src + '/.coafile')
     conf_writer.write_sections(self.sections_dict)
     conf_writer.close()
 def update_section_name(self, widget, arg, old_name, section_view):
     section_view.set_name(widget.get_name())
     self.sections_dict[old_name].name = widget.get_name()
     self.sections_dict = update_ordered_dict_key(self.sections_dict,
                                                  old_name,
                                                  widget.get_name())
     widget.connect("edited", self.update_section_name, widget.get_name())
     conf_writer = ConfWriter(self.src+'/.coafile')
     conf_writer.write_sections(self.sections_dict)
     conf_writer.close()
Example #6
0
 def update_setting(self, key, new_key=None, new_value=None):
     """
     Updates a setting with new values.
     :param key:       The old key string.
     :param new_key:   The new key string.
     :param new_value: The new value for the setting
     """
     if new_key is not None:
         self.contents[key].key = new_key
         self.contents = update_ordered_dict_key(self.contents, key, new_key)
     if new_value is not None:
         if new_key is not None:
             self.contents[new_key].value = new_value
         else:
             self.contents[key].value = new_value
Example #7
0
 def update_setting(self, key, new_key=None, new_value=None):
     """
     Updates a setting with new values.
     :param key:       The old key string.
     :param new_key:   The new key string.
     :param new_value: The new value for the setting
     """
     if new_key is not None:
         self.contents[key].key = new_key
         self.contents = update_ordered_dict_key(self.contents, key,
                                                 new_key)
     if new_value is not None:
         if new_key is not None:
             self.contents[new_key].value = new_value
         else:
             self.contents[key].value = new_value