Exemplo n.º 1
0
 def complete_configuration(text):
     if not text:
         completions = Configurations.list_configurations()[:]
     else:
         completions = [
             x for x in Configurations.list_configurations()
             if x.startswith(text)
         ]
     return completions
Exemplo n.º 2
0
    def test_load_configuration(self):
        Configuration().core_clear()
        rsp = RsParameters()
        self.assertEquals("test_rs_paras", rsp.configuration_name())

        rsp.max_items_in_list = 5566
        rsp.save_configuration_as("realy_not_a_name_for_config")
        self.assertEquals("realy_not_a_name_for_config",
                          rsp.configuration_name())

        rsp = RsParameters(config_name="realy_not_a_name_for_config")
        self.assertEquals(5566, rsp.max_items_in_list)

        self.assertTrue("realy_not_a_name_for_config" in
                        Configurations.list_configurations())

        Configurations.remove_configuration("realy_not_a_name_for_config")

        with self.assertRaises(Exception) as context:
            RsParameters(config_name="realy_not_a_name_for_config")
        self.assertIsInstance(context.exception, ValueError)

        Configuration().reset()
        rsp = RsParameters()
        self.assertEquals("realy_not_a_name_for_config",
                          rsp.configuration_name())
Exemplo n.º 3
0
 def on_menu_open_config_about_to_show(self):
     self.menu_open_config.clear()
     for child in self.config_action_group.children():
         self.config_action_group.removeAction(child)
     current_name = Configurations.current_configuration_name()
     for name in Configurations.list_configurations():
         action = QAction(name, self)
         action.setCheckable(True)
         action.setData(name)
         self.config_action_group.addAction(action)
         self.menu_open_config.addAction(action)
         if name == current_name:
             action.setChecked(True)
Exemplo n.º 4
0
    def do_list_configurations(self, line):
        """
list_configurations::

    List saved configurations

        """
        print("====================")
        print("Saved configurations")
        print("====================")
        for config in Configurations.list_configurations():
            print(config)
        print("")
        print("====================")
Exemplo n.º 5
0
 def test_list_configurations(self):
     configurations = Configurations()
     for c in configurations.list_configurations():
         print(c)
Exemplo n.º 6
0
 def populate_model(self):
     self.list_model.clear()
     for cfg in Configurations.list_configurations():
         item = QStandardItem(cfg)
         self.list_model.appendRow(item)