[Skencil-commits] r724 - skencil/branches/skencil-0.6/src/Sketch/Base
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Sep 22 18:42:25 CEST 2010
Author: igor_n
Date: 2010-09-22 18:42:24 +0200 (Wed, 22 Sep 2010)
New Revision: 724
Modified:
skencil/branches/skencil-0.6/src/Sketch/Base/configutil.py
Log:
mixed indents are removed
Modified: skencil/branches/skencil-0.6/src/Sketch/Base/configutil.py
===================================================================
--- skencil/branches/skencil-0.6/src/Sketch/Base/configutil.py 2010-09-22 16:35:15 UTC (rev 723)
+++ skencil/branches/skencil-0.6/src/Sketch/Base/configutil.py 2010-09-22 16:42:24 UTC (rev 724)
@@ -23,7 +23,7 @@
import sys, os
import config
-from warn import warn_tb, warn, USER
+from warn import warn_tb, USER
from Sketch import PointType
from Sketch.Lib import util
@@ -37,7 +37,7 @@
'plugin_dir')
join = os.path.join
for dir in dirs:
- setattr(config, dir, join(base_dir, getattr(config, dir)))
+ setattr(config, dir, join(base_dir, getattr(config, dir)))
config.font_path.append(config.fontmetric_dir)
check_path(config.font_path)
@@ -59,16 +59,16 @@
def load_user_preferences():
# Load the user specific configuration.
if os.path.isdir(config.user_config_dir):
- sys.path.insert(0, config.user_config_dir)
+ sys.path.insert(0, config.user_config_dir)
filename = os.path.join(config.user_config_dir, config.user_settings_file)
if os.path.isfile(filename):
- try:
- execfile(filename, {'preferences':config.preferences})
- except:
- warn_tb(USER, "Cannot read the preferences file")
+ try:
+ execfile(filename, {'preferences':config.preferences})
+ except:
+ warn_tb(USER, "Cannot read the preferences file")
try:
- import userhooks
+ import userhooks
except ImportError:
tb = sys.exc_info()[2]
try:
@@ -82,71 +82,70 @@
finally:
del tb
except:
- warn_tb(USER, "Cannot import the userhooks file")
+ warn_tb(USER, "Cannot import the userhooks file")
def save_repr(obj):
# XXX get rid of this...
if type(obj) == PointType:
- return 'Point(%g, %g)' % tuple(obj)
+ return 'Point(%g, %g)' % tuple(obj)
else:
- return `obj`
+ return `obj`
def save_user_preferences():
preferences = config.preferences
if len(preferences.__dict__) == 0:
- return
+ return
filename = os.path.join(config.user_config_dir, config.user_settings_file)
try:
- util.create_directory(config.user_config_dir)
- file = open(filename, 'w')
+ util.create_directory(config.user_config_dir)
+ file = open(filename, 'w')
except (IOError, os.error), value:
- import sys
- sys.stderr('cannot write preferences into %s: %s'
- % (`filename`, value[1]))
- return
+ sys.stderr('cannot write preferences into %s: %s'
+ % (`filename`, value[1]))
+ return
file.write('#### -*- python -*-\n'
'# This file was automatically created by Sketch.\n\n')
- #'\nfrom Sketch.config import preferences, Point\n\n')
+ #'\nfrom Sketch.config import preferences, Point\n\n')
defaults = config.ProgramDefaults.__dict__
items = preferences.__dict__.items()
items.sort()
for key, value in items:
- if defaults.has_key(key) and defaults[key] == value:
- continue
- file.write('preferences.%s = %s\n' % (key, save_repr(value)))
+ if defaults.has_key(key) and defaults[key] == value:
+ continue
+ file.write('preferences.%s = %s\n' % (key, save_repr(value)))
def add_program_default(key, value):
setattr(config.ProgramDefaults, key, value)
def get_preference(key, default):
if hasattr(config.preferences, key):
- return getattr(config.preferences, key)
+ return getattr(config.preferences, key)
return default
def add_mru_file(filename):
if not filename:
- return
+ return
mru_list = config.preferences.mru_files
if filename in mru_list:
- mru_list.remove(filename)
+ mru_list.remove(filename)
mru_list.insert(0, filename)
config.preferences.mru_files = mru_list[:4]
def remove_mru_file(filename):
if not filename:
- return
+ return
mru_list = config.preferences.mru_files
if filename in mru_list:
- mru_list.remove(filename)
- if len(mru_list) < 4:
- mru_list = mru_list + ['', '', '', '']
- config.preferences.mru_files = mru_list[:4]
+ mru_list.remove(filename)
+ if len(mru_list) < 4:
+ mru_list = mru_list + ['', '', '', '']
+ config.preferences.mru_files = mru_list[:4]
More information about the Skencil-commits
mailing list