Esempio n. 1
0
def test__load_hooks_settings__no_widget(prefs):
    hook_show_command = "on_show.sh"
    prefs.client.get_string.return_value = hook_show_command
    prefs.get_widget.return_value = None
    PrefsDialog._load_hooks_settings(prefs)
    prefs.client.get_string.assert_any_call(KEY("/hooks/show"))
    prefs.get_widget.assert_any_call("hook_show")
Esempio n. 2
0
def test__load_hooks_settings__no_setting(prefs, widget):
    prefs.client.get_string.return_value = None
    prefs.get_widget.return_value = widget
    PrefsDialog._load_hooks_settings(prefs)
    prefs.client.get_string.assert_any_call(KEY("/hooks/show"))
    prefs.get_widget.assert_any_call("hook_show")
    assert not widget.set_active.called
Esempio n. 3
0
def test__load_hooks_settings__no_setting(prefs, widget):
    prefs.client.get_string.return_value = None
    prefs.get_widget.return_value = widget
    PrefsDialog._load_hooks_settings(prefs)
    prefs.client.get_string.assert_any_call(KEY("/hooks/show"))
    prefs.get_widget.assert_any_call("hook_show")
    assert not widget.set_active.called
Esempio n. 4
0
def test__load_hooks_settings__no_widget(prefs):
    hook_show_command = "on_show.sh"
    prefs.client.get_string.return_value = hook_show_command
    prefs.get_widget.return_value = None
    PrefsDialog._load_hooks_settings(prefs)
    prefs.client.get_string.assert_any_call(KEY("/hooks/show"))
    prefs.get_widget.assert_any_call("hook_show")
Esempio n. 5
0
def test__load_hooks_settings__works(prefs, widget):
    hook_show_command = "on_show.sh"
    prefs.client.get_string.return_value = hook_show_command
    prefs.get_widget.return_value = widget
    PrefsDialog._load_hooks_settings(prefs)
    prefs.client.get_string.assert_any_call(KEY("/hooks/show"))
    prefs.get_widget.assert_any_call("hook_show")
    widget.set_text.assert_called_once_with(hook_show_command)
Esempio n. 6
0
def test__load_hooks_settings__works(prefs, widget):
    hook_show_command = "on_show.sh"
    prefs.client.get_string.return_value = hook_show_command
    prefs.get_widget.return_value = widget
    PrefsDialog._load_hooks_settings(prefs)
    prefs.client.get_string.assert_any_call(KEY("/hooks/show"))
    prefs.get_widget.assert_any_call("hook_show")
    widget.set_text.assert_called_once_with(hook_show_command)
Esempio n. 7
0
def test__load_hooks_settings__called(prefs):
    def se(key):
        """side effect for correctly mocking load_configs"""
        if key == KEY('/general/window_halignment'):
            return 0
        return None
    prefs.client.get_int.side_effect = se
    prefs.client.get_string.return_value = ''
    PrefsDialog.load_configs(prefs)
    assert prefs._load_hooks_settings.called
    assert prefs._load_default_shell_settings.called
    assert prefs._load_screen_settings.called
Esempio n. 8
0
def test__load_hooks_settings__called(prefs):
    def se(key):
        """side effect for correctly mocking load_configs"""
        if key == KEY('/general/window_halignment'):
            return 0
        return None

    prefs.client.get_int.side_effect = se
    prefs.client.get_string.return_value = ''
    PrefsDialog.load_configs(prefs)
    assert prefs._load_hooks_settings.called
    assert prefs._load_default_shell_settings.called
    assert prefs._load_screen_settings.called
Esempio n. 9
0
 def show_prefs(self, *args):
     # TODO DBUS ONLY
     # TODO TRAY ONLY
     """Hides the main window and creates an instance of the
     Preferences window.
     """
     self.hide()
     PrefsDialog(self.settings).show()
Esempio n. 10
0
 def show_prefs(self, *args):
     """Hides the main window and creates an instance of the
     Preferences window.
     """
     self.hide()
     PrefsDialog().show()
Esempio n. 11
0
 def on_show_preferences(self, *args):
     self.notebook.guake.hide()
     PrefsDialog(self.settings).show()
Esempio n. 12
0
 def on_show_preferences(self, user_data):
     self.guake.hide()
     PrefsDialog(self.guake.settings).show()