summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/__main__.py5
-rw-r--r--ranger/core/environment.py3
-rw-r--r--ranger/core/fm.py3
-rw-r--r--ranger/shared/__init__.py7
4 files changed, 10 insertions, 8 deletions
diff --git a/ranger/__main__.py b/ranger/__main__.py
index 674ad8f6..98ce47da 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -75,7 +75,7 @@ def main():
 	from ranger.ext import curses_interrupt_handler
 	from ranger.core.fm import FM
 	from ranger.core.environment import Environment
-	from ranger.shared.settings import SettingsAware
+	from ranger.shared import *
 	from ranger.gui.defaultui import DefaultUI as UI
 	from ranger.fsobject.file import File
 
@@ -111,11 +111,12 @@ def main():
 	else:
 		path = '.'
 
-	Environment(path)
+	EnvironmentAware._assign(Environment(path))
 
 	try:
 		my_ui = UI()
 		my_fm = FM(ui=my_ui)
+		FileManagerAware._assign(my_fm)
 
 		# Run the file manager
 		my_fm.initialize()
diff --git a/ranger/core/environment.py b/ranger/core/environment.py
index 00b152d3..e5deda07 100644
--- a/ranger/core/environment.py
+++ b/ranger/core/environment.py
@@ -58,9 +58,6 @@ class Environment(SettingsAware, SignalDispatcher):
 		self.hostname = socket.gethostname()
 		self.home_path = os.path.expanduser('~')
 
-		from ranger.shared import EnvironmentAware
-		EnvironmentAware.env = self
-
 		self.signal_bind('move', self._set_cf_from_signal, priority=0.1,
 				weak=True)
 
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index 626ce838..224ef06f 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -58,9 +58,6 @@ class FM(Actions, SignalDispatcher):
 		self.run = Runner(ui=self.ui, apps=self.apps,
 				logfunc=mylogfunc)
 
-		from ranger.shared import FileManagerAware
-		FileManagerAware.fm = self
-
 		self.log.append('Ranger {0} started! Process ID is {1}.' \
 				.format(__version__, os.getpid()))
 		self.log.append('Running on Python ' + sys.version.replace('\n',''))
diff --git a/ranger/shared/__init__.py b/ranger/shared/__init__.py
index a476bd5f..048b9e7a 100644
--- a/ranger/shared/__init__.py
+++ b/ranger/shared/__init__.py
@@ -20,9 +20,16 @@ class Awareness(object):
 
 class EnvironmentAware(Awareness):
 	env = None
+	@staticmethod
+	def _assign(instance):
+		EnvironmentAware.env = instance
+
 
 class FileManagerAware(Awareness):
 	fm = None
+	@staticmethod
+	def _assign(instance):
+		FileManagerAware.fm = instance
 
 from .mimetype import MimeTypeAware
 from .settings import SettingsAware
ui/bar.py?id=ea87d00524778fd7188180acb1119d0ecb43613e'>ea87d005 ^
9cce9fab ^

ea87d005 ^
9cce9fab ^










ea87d005 ^
9cce9fab ^




9cce9fab ^


76aee8ea ^
ea87d005 ^
9cce9fab ^





ea87d005 ^
9cce9fab ^




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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137