Preferences/__init__.py

branch
5_5_x
changeset 3916
1d54f7cd2de7
parent 3915
c6aa0bccd7d8
child 3925
5afc73bf9c57
equal deleted inserted replaced
3915:c6aa0bccd7d8 3916:1d54f7cd2de7
15 needed with the statement 'import Preferences'. Do not use 15 needed with the statement 'import Preferences'. Do not use
16 'from Preferences import *' to import it. 16 'from Preferences import *' to import it.
17 """ 17 """
18 18
19 from __future__ import unicode_literals 19 from __future__ import unicode_literals
20 try:
21 basestring # __IGNORE_WARNING__
22 except NameError:
23 basestring = str
20 24
21 import os 25 import os
22 import fnmatch 26 import fnmatch
23 import shutil 27 import shutil
24 import json 28 import json
1496 try: 1500 try:
1497 profiles = prefClass.settings.value("UI/ViewProfiles") 1501 profiles = prefClass.settings.value("UI/ViewProfiles")
1498 except TypeError: 1502 except TypeError:
1499 profiles = None 1503 profiles = None
1500 if profiles is not None: 1504 if profiles is not None:
1505 if isinstance(profiles, basestring):
1506 profiles = eval(profiles)
1501 viewProfiles = {} 1507 viewProfiles = {}
1502 for name in ["edit", "debug"]: 1508 for name in ["edit", "debug"]:
1503 viewProfiles[name] = [ 1509 viewProfiles[name] = [
1504 QByteArray(profiles[name][4]), 1510 QByteArray(profiles[name][4]),
1505 profiles[name][5][:], 1511 profiles[name][5][:],
1506 [] 1512 []
1507 ] 1513 ]
1508 for b in profiles[name][6]: 1514 for b in profiles[name][6]:
1509 viewProfiles[name][2].append(QByteArray(b)) 1515 viewProfiles[name][2].append(QByteArray(b))
1516 # correct some entries
1517 while (len(viewProfiles[name][1]) < len(
1518 prefClass.uiDefaults["ViewProfiles2"][name][1])):
1519 viewProfiles[name][1].append(True)
1520 while len(viewProfiles[name][2]) < len(
1521 prefClass.uiDefaults["ViewProfiles2"][name][2]):
1522 viewProfiles[name][2].append(QByteArray())
1510 else: 1523 else:
1511 # use the defaults 1524 # use the defaults
1512 viewProfiles = prefClass.uiDefaults["ViewProfiles2"] 1525 viewProfiles = prefClass.uiDefaults["ViewProfiles2"]
1513 # Remove unused setting 1526 # Remove unused setting
1514 prefClass.settings.remove("UI/ViewProfiles") 1527 prefClass.settings.remove("UI/ViewProfiles")

eric ide

mercurial