Exemplo n.º 1
0
    def setUp(self):
        self.settings_dir = tempfile.mkdtemp()
        handle, name = tempfile.mkstemp(dir=self.settings_dir, text=True)
        self.filename = name
        fle = open(name, 'w')
        try:
            fle.write(SETTINGS_TEXT)
            fle.close()

            self.settings = load_settings_from_file(self.filename, BaseSettings)

        finally:
            fle.close()

        workspaces_dir = self.settings.get_workspaces_dir()
        os.mkdir(workspaces_dir)
        workspace_filename = os.path.join(workspaces_dir, 'ni.workspace')
        fle = open(workspace_filename, 'w')
        fle.write(WORKSPACE_TEXT)
        fle.close()
Exemplo n.º 2
0
    def test_save(self):
        self.settings['indent_width'] = 2
        self.settings.save()

        new_settings = load_settings_from_file(self.filename, BaseSettings)
        assert new_settings['indent_width'] == 2
Exemplo n.º 3
0
def load_gtk_settings():
    settings_filepath = os.path.join(SETTINGS_DIR, SETTINGS_FILENAME)
    return load_settings_from_file(settings_filepath, GtkSettings)