~ci-train-bot/unity/unity-ubuntu-disco-3336

« back to all changes in this revision

Viewing changes to tools/migration-scripts/02_unity_setup_text_scale_factor

UnitySettings: use the ubuntu-schemas path for scaling settings

Also remove unused parts of EMConverter (LP: #1721082)

Approved by: Andrea Azzarone

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python3
2
2
# -*- coding: utf-8 -*-
3
 
# Copyright (C) 2014-2015 Canonical
 
3
# Copyright (C) 2014-2017 Canonical
4
4
#
5
5
# Authors:
6
6
#  Marco Trevisan <marco.trevisan@canonical.com>
25
25
GNOME_TEXT_SCALE_FACTOR = "text-scaling-factor";
26
26
 
27
27
UNITY_UI_SETTINGS = "com.canonical.Unity.Interface";
28
 
UNITY_UI_SETTINGS_PATH = "/com/canonical/unity/interface/"
29
28
UNITY_TEXT_SCALE_FACTOR = "text-scale-factor";
30
29
 
31
30
gnome_ui_schema = Gio.SettingsSchemaSource.get_default().lookup(GNOME_UI_SETTINGS, recursive=False)
35
34
 
36
35
text_scale_factor = Gio.Settings(settings_schema=gnome_ui_schema).get_double(GNOME_TEXT_SCALE_FACTOR)
37
36
 
38
 
# gsettings doesn't work directly, the key is somewhat reverted. Work one level under then: dconf!
39
 
# Gio.Settings(schema=UNITY_UI_SETTINGS).set_int(UNITY_TEXT_SCALE_FACTOR, text_scale_factor)
40
 
from subprocess import Popen, PIPE, STDOUT
41
 
p = Popen(("dconf load "+UNITY_UI_SETTINGS_PATH).split(), stdout=PIPE, stdin=PIPE, stderr=STDOUT)
42
 
p.communicate(input=bytes("[/]\n"+UNITY_TEXT_SCALE_FACTOR+"={}".format(text_scale_factor), 'utf-8'))
 
37
Gio.Settings.new(UNITY_UI_SETTINGS).set_double(UNITY_TEXT_SCALE_FACTOR, text_scale_factor)
 
38
Gio.Settings.sync()