def test_set_config(self, dummy_window, app, initial_config_parametrized):
     """Make sure setting the field values works as expected."""
     dialog = PreferencesDialog(dummy_window, app, initial_config_parametrized)
     another_config_parametrized = initial_config_parametrized
     dialog._set_config(another_config_parametrized)
     for key, (_label, widget) in dialog._fields.items():
         assert widget.get_config_value() == initial_config_parametrized[key]
Exemplo n.º 2
0
 def test_init(self, dummy_window, app, config, empty_initial):
     """Make instantiation works as expected."""
     if empty_initial:
         config = {}
     result = PreferencesDialog(dummy_window, app, config)
     grids = result.get_content_area().get_children()[0].get_children()
     # This assumes 2 children per config entry (label and widget).
     grid_entry_counts = [len(g.get_children()) / 2 for g in grids]
     assert sum(grid_entry_counts) == 8
 def test_set_config(self, dummy_window, app, initial_config_parametrized):
     """Make sure setting the field values works as expected."""
     dialog = PreferencesDialog(dummy_window, app,
                                initial_config_parametrized)
     another_config_parametrized = initial_config_parametrized
     dialog._set_config(another_config_parametrized)
     for key, (_label, widget) in dialog._fields.items():
         assert widget.get_config_value(
         ) == initial_config_parametrized[key]
    def test_get_config(self, dummy_window, app, initial_config_parametrized):
        """
        Make sure retrieval of field values works as expected.

        In particular we need to make sure that unicode/utf-8 handling works as
        expected.
        """
        dialog = PreferencesDialog(dummy_window, app, initial_config_parametrized)
        result = dialog.get_config()
        assert result == initial_config_parametrized
    def test_get_config(self, dummy_window, app, initial_config_parametrized):
        """
        Make sure retrieval of field values works as expected.

        In particular we need to make sure that unicode/utf-8 handling works as
        expected.
        """
        dialog = PreferencesDialog(dummy_window, app,
                                   initial_config_parametrized)
        result = dialog.get_config()
        assert result == initial_config_parametrized
Exemplo n.º 6
0
 def _on_preferences_button(self, button):
     """Bring up, process and shut down preferences dialog."""
     def get_initial():
         """Return current values as a dict."""
         return self._app._config
     parent = get_parent_window(self)
     dialog = PreferencesDialog(parent, parent.app, get_initial())
     response = dialog.run()
     if response == Gtk.ResponseType.APPLY:
         config = dialog.get_config()
         self._app.save_config(config)
     else:
         pass
     dialog.destroy()
Exemplo n.º 7
0
    def _on_preferences_action(self, action, parameter):
        """Bring up, process and shut down preferences dialog."""
        def get_initial():
            """Return current values as a dict."""
            return self._config

        dialog = PreferencesDialog(self.window, self, get_initial())
        response = dialog.run()
        if response == Gtk.ResponseType.APPLY:
            config = dialog.get_config()
            self.save_config(config)
        else:
            pass
        dialog.destroy()
Exemplo n.º 8
0
    def _on_preferences_button(self, button):
        """Bring up, process and shut down preferences dialog."""
        def get_initial():
            """Return current values as a dict."""
            return self._app._config

        parent = get_parent_window(self)
        dialog = PreferencesDialog(parent, parent.app, get_initial())
        response = dialog.run()
        if response == Gtk.ResponseType.APPLY:
            config = dialog.get_config()
            self._app.save_config(config)
        else:
            pass
        dialog.destroy()
 def test_init(self, dummy_window, app, config):
     """Make instantiation works as expected."""
     result = PreferencesDialog(dummy_window, app, config)
     grid = result.get_content_area().get_children()[0]
     # This assumes 2 children per config entry (label and widget).
     assert len(grid.get_children()) / 2 == len(config.keys())
 def test_init(self, dummy_window, app, config):
     """Make instantiation works as expected."""
     result = PreferencesDialog(dummy_window, app, config)
     grid = result.get_content_area().get_children()[0]
     # This assumes 2 children per config entry (label and widget).
     assert len(grid.get_children()) / 2 == len(config.keys())