summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-14 00:24:10 +0200
committerhut <hut@lavabit.com>2010-04-14 00:24:10 +0200
commit04ce666a809f461db7477edc7884beb4d466deff (patch)
tree1c6785fe6a989e723781e2bcce9426a60123b2a5
parentdaa224d86348f0e0fa39d09feef43e34df56d780 (diff)
parent19c1fa4f622ffd1597943f0005ba58a30b170bb4 (diff)
downloadranger-04ce666a809f461db7477edc7884beb4d466deff.tar.gz
Merge branch 'devel' into newkey
Conflicts:
	ranger/__main__.py
	ranger/defaults/keys.py
	ranger/gui/widgets/console.py
-rw-r--r--README19
-rw-r--r--TODO2
-rw-r--r--ranger/__main__.py6
-rw-r--r--ranger/core/environment.py3
-rw-r--r--ranger/core/fm.py3
-rw-r--r--ranger/gui/widgets/console.py13
-rw-r--r--ranger/gui/widgets/statusbar.py8
-rw-r--r--ranger/shared/__init__.py7
8 files changed, 39 insertions, 22 deletions
diff --git a/README b/README
index 429aefa1..7d042929 100644
--- a/README
+++ b/README
@@ -124,6 +124,25 @@ Also, see the file HACKING for more detailed instructions on
 modifying the program.
 
 
+Roadmap
+-------
+
+Short term:
+
+* A cleaner and more flexible key configuration file
+* Performance improvements everywhere
+* Simplification of the code
+
+Long term:
+
+* One stable branch that you can rely on not crashing
+* A plugin system
+* Separate ranger into multiple programs:
+  1. One daemon running in the background for slow IO operations
+  2. A file launcher (ideally an already existing one)
+  3. The actual program containing unseparable parts
+
+
 Tips
 ----
 
diff --git a/TODO b/TODO
index 6be34f8c..715ebc1b 100644
--- a/TODO
+++ b/TODO
@@ -71,7 +71,7 @@ Bugs
    (X) #54  10/01/23  max_dirsize_for_autopreview not working
    ( ) #60  10/02/05  utf support improvable
    (X) #62  10/02/15  curs_set can raise an exception
-   (X) #65  10/02/16  "source ranger ranger some/file.txt" shouldn't cd after exit
+   ( ) #65  10/02/16  "source ranger ranger some/file.txt" shouldn't cd after exit
    (X) #67  10/03/08  terminal title in tty
    (X) #69  10/03/11  tab-completion breaks with Apps subclass
    (X) #73  10/03/21  when clicking on the first column, it goes 1x down
diff --git a/ranger/__main__.py b/ranger/__main__.py
index 863eadd5..2aae6343 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -75,7 +75,8 @@ 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 (EnvironmentAware, FileManagerAware,
+			SettingsAware)
 	from ranger.gui.defaultui import DefaultUI as UI
 	from ranger.fsobject.file import File
 
@@ -111,12 +112,13 @@ def main():
 	else:
 		path = '.'
 
-	Environment(path)
+	EnvironmentAware._assign(Environment(path))
 	SettingsAware._setup_keys()
 
 	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 d83003b1..b712683a 100644
--- a/ranger/core/environment.py
+++ b/ranger/core/environment.py
@@ -63,9 +63,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 459620c6..495b9f13 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -57,9 +57,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/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 3228c511..c93a4f38 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -20,15 +20,20 @@ commands, searching and executing files.
 
 import string
 import curses
+import re
 from collections import deque
 
 from . import Widget
 from ranger.defaults import commands
 from ranger.gui.widgets.console_mode import is_valid_mode, mode_to_class
 from ranger import log, relpath_conf
+from ranger.core.runner import ALLOWED_FLAGS
 from ranger.ext.shell_escape import shell_quote
 from ranger.container.keymap import CommandArgs
 from ranger.ext.get_executables import get_executables
+from ranger.ext.direction import Direction
+from ranger.container import History
+from ranger.container.history import HistoryEmptyException
 import ranger
 
 DEFAULT_HISTORY = 0
@@ -45,7 +50,6 @@ class _CustomTemplate(string.Template):
 class Console(Widget):
 	mode = None
 	visible = False
-	commandlist = None
 	last_cursor_mode = None
 	prompt = ':'
 	copy = ''
@@ -58,7 +62,6 @@ class Console(Widget):
 	historypaths = []
 
 	def __init__(self, win):
-		from ranger.container import History
 		Widget.__init__(self, win)
 		self.clear()
 		self.histories = []
@@ -195,7 +198,6 @@ class Console(Widget):
 		self.on_line_change()
 
 	def history_move(self, n):
-		from ranger.container.history import HistoryEmptyException
 		try:
 			current = self.history.current()
 		except HistoryEmptyException:
@@ -385,7 +387,6 @@ class SearchConsole(Console):
 		self.history = self.histories[SEARCH_HISTORY]
 
 	def execute(self):
-		import re
 		if self.fm.env.cwd:
 			regexp = re.compile(self.line, re.L | re.U | re.I)
 			self.fm.env.last_search = regexp
@@ -419,6 +420,8 @@ class OpenConsole(ConsoleWithTab):
 
 	def init(self):
 		self.history = self.histories[OPEN_HISTORY]
+		OpenConsole.prompt = "{0}@{1} $ ".format(self.env.username,
+				self.env.hostname)
 
 	def execute(self):
 		command, flags = self._parse()
@@ -610,13 +613,11 @@ class QuickOpenConsole(ConsoleWithTab):
 
 		return None
 
-
 	def _is_app(self, arg):
 		return self.fm.apps.has(arg) or \
 			(not self._is_flags(arg) and arg in get_executables())
 
 	def _is_flags(self, arg):
-		from ranger.core.runner import ALLOWED_FLAGS
 		return all(x in ALLOWED_FLAGS for x in arg)
 
 	def _is_mode(self, arg):
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index 78666a3d..caf5786e 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -145,10 +145,7 @@ class StatusBar(Widget):
 			target = self.column.target.pointed_obj
 		else:
 			target = self.env.at_level(0).pointed_obj
-
-		if target is None \
-				or not target.accessible \
-				or (target.is_directory and target.files is None):
+		if target is None or not target.accessible:
 			return
 
 		perms = target.get_permission_string()
@@ -204,9 +201,6 @@ class StatusBar(Widget):
 			return
 
 		target = self.column.target
-		if target is None:
-			return
-
 		if target is None \
 				or not target.accessible \
 				or (target.is_directory and target.files is None):
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
f='#n604'>604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969