about summary refs log tree commit diff stats
path: root/ranger/shared/settings.py
blob: cf1c00c800692ffd9b8af1f91c9f046edd8e5cb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from inspect import isclass, ismodule
from ranger.ext.openstruct import OpenStruct
from ranger.gui.colorscheme import ColorScheme

ALLOWED_SETTINGS = """
show_hidden scroll_offset directories_first
preview_files max_history_size colorscheme
apps keys
""".split()

# overwrite single default options with custom options
from ranger.defaults import options
try:
	import options as custom_options
	for setting in ALLOWED_SETTINGS:
		if hasattr(custom_options, setting):
			setattr(options, setting, getattr(custom_options, setting))
		elif not hasattr(options, setting):
			raise Exception("Following option was not defined: " + setting)
except ImportError:
	pass

# If a module is specified as the colorscheme, replace it with one
# valid colorscheme inside that module.

if isclass(options.colorscheme) and \
		issubclass(options.colorscheme, ColorScheme):
	options.colorscheme = options.colorscheme()

elif ismodule(options.colorscheme):
	for var_name in dir(options.colorscheme):
		var = getattr(options.colorscheme, var_name)
		if var != ColorScheme and isclass(var) and issubclass(var, ColorScheme):
			options.colorscheme = var()
			break
	else:
		raise Exception("The colorscheme module contains no valid colorscheme!")

else:
	raise Exception("Cannot locate colorscheme!")


# -- globalize the settings --
class SettingsAware(object):
	settings = OpenStruct()

for setting in ALLOWED_SETTINGS:
	SettingsAware.settings[setting] = getattr(options, setting)
div>
dac83357 ^
9e5e87ca ^
a03bbc82 ^
dac83357 ^
9e5e87ca ^
a03bbc82 ^
dac83357 ^
9e5e87ca ^
531f14c9 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
         

                                                                          

                 
                                                        

                                                              







                                                                             


                                           
 
       
 
               
                                                             
 
              
                                                            
 
               
                                                             
 
              
                                                            
 
                
                                                              
 
               
                                                             
 
             
                                                           
 
               
                                                             
 
            
                                                          

              
#!/bin/sh
# Translate SubX by running the self-hosted translator in emulated mode on
# Linux or BSD or Mac.
#
# Possible knobs:
#   Whether to run a phase natively or in emulated mode.
#     Just always emulate for now since we debug on non-Linux.
#   Whether to stop after a phase.
#     Just always run all phases, but print out phases so it's clear where an
#     error happens.
#   Whether to trace a phase. Whether to always trace or rerun with tracing
#   enabled after an error.
#     Leave tracing to other scripts. We save intermediate files so it's easy
#     to rerun a single phase afterwards.
#   Whether to run a phase with debug information. (Need to juggle multiple
#   sets of debug files.)
#     Again, that's for subsequent scripts.

set -e

./build

echo "  braces"
cat $*          |./bootstrap_bin run apps/braces   > a.braces

echo "  calls"
cat a.braces    |./bootstrap_bin run apps/calls    > a.calls

echo "  sigils"
cat a.calls     |./bootstrap_bin run apps/sigils   > a.sigils

echo "  tests"
cat a.sigils    |./bootstrap_bin run apps/tests    > a.tests

echo "  dquotes"
cat a.tests     |./bootstrap_bin run apps/dquotes  > a.dquotes

echo "  assort"
cat a.dquotes   |./bootstrap_bin run apps/assort   > a.assort

echo "  pack"
cat a.assort    |./bootstrap_bin run apps/pack     > a.pack

echo "  survey"
cat a.pack      |./bootstrap_bin run apps/survey   > a.survey

echo "  hex"
cat a.survey    |./bootstrap_bin run apps/hex      > a.elf

chmod +x a.elf