From 0a61328082c4b92b0eea5ec4681e80d40fcf0951 Mon Sep 17 00:00:00 2001 From: Shaun Marshall Date: Mon, 6 Jan 2014 14:34:54 -0500 Subject: [PATCH 1/2] Rebound h from Help to hidden toggle --- README.rst | 2 +- docs/HISTORY.rst | 2 ++ src/tarman/__init__.py | 4 ++-- src/tarman/constants.py | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index f7bcb4d..49b2f9e 100644 --- a/README.rst +++ b/README.rst @@ -50,7 +50,7 @@ Key bindings ============ Key bindings are listed in HELP window, -you can access it by pressing *h* or *?* key. +you can access it by pressing the *?* key. {help_string} diff --git a/docs/HISTORY.rst b/docs/HISTORY.rst index b24122c..bf3d570 100644 --- a/docs/HISTORY.rst +++ b/docs/HISTORY.rst @@ -11,6 +11,8 @@ Changelog [Matej Cotman] - Logging to ~/.tarman.log [Matej Cotman] +- Added view toggle for hidden files/subdirectories + [Shaun Marshall] 0.1.2 (2013-08-13) diff --git a/src/tarman/__init__.py b/src/tarman/__init__.py index 794b253..2476f30 100644 --- a/src/tarman/__init__.py +++ b/src/tarman/__init__.py @@ -341,12 +341,12 @@ def loop(self): TextWin(self).show("Extracted to:\n{0}".format(s)) - elif self.ch in [ord('?'), curses.KEY_F1, ord('h')]: + elif self.ch in [ord('?'), curses.KEY_F1]: curses.curs_set(0) textwin = TextWin(self) textwin.show(HELP_STRING) - if self.ch == ord('.'): + if self.ch == ord('h') : if self.show_hiddens == True: self.show_hiddens = False else: diff --git a/src/tarman/constants.py b/src/tarman/constants.py index 9100a84..f307849 100644 --- a/src/tarman/constants.py +++ b/src/tarman/constants.py @@ -4,13 +4,13 @@ HELP_STRING = """Browser window key bindings: - c - create archive from selected files - e - extract selected files - - h/?/F1 - help window + - ?/F1 - help window - LEFT/BACKSPACE - go one directory up - q - quit - RIGHT/ENTER - go in to directory or archive - SPACE - select and unselect files - UP/DOWN - move up or down in browser - - . - toggle show/hide hidden files (".*") + - h - toggle show/hide hidden files (".*") Overlay window key bindings: - ENTER - confirm/ok From 08bb866189eb0a90bd71869a66eea66698cbf3a9 Mon Sep 17 00:00:00 2001 From: Shaun Marshall Date: Wed, 8 Jan 2014 12:21:52 -0500 Subject: [PATCH 2/2] Allowed for backwards navigation and shift-arrow +-5 offset --- docs/HISTORY.rst | 2 ++ src/tarman/__init__.py | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/HISTORY.rst b/docs/HISTORY.rst index 5f3129c..f7c0e5b 100644 --- a/docs/HISTORY.rst +++ b/docs/HISTORY.rst @@ -4,6 +4,8 @@ Changelog 0.1.4 (unreleased) ------------------ +- Added backwards (from init dir) and shift-arrow navigation + [Shaun Marshall] - Refactor unicode support for lower level functions. [Matej Cotman] - Fixed Hydra build error. diff --git a/src/tarman/__init__.py b/src/tarman/__init__.py index 478a563..b961ce0 100644 --- a/src/tarman/__init__.py +++ b/src/tarman/__init__.py @@ -52,7 +52,8 @@ def __init__(self, mainscr, stdscr, directory, encoding, show_hiddens): self.area = None self.container = FileSystem() self.directory = self.container.abspath(directory) - self.checked = DirectoryTree(self.directory, self.container) + self.root_directory = '/' + self.checked = DirectoryTree(self.root_directory, self.container) self.show_hiddens = show_hiddens self.chdir(self.directory) @@ -102,9 +103,6 @@ def chdir(self, newpath): if newpath is None: return False - if not newpath.startswith(self.directory): - return False - try: if self.area is None: oldsel = 0 @@ -221,10 +219,10 @@ def loop(self): elif self.ch == curses.KEY_DOWN: self.area.set_params(h, offset=1) - elif self.ch == curses.KEY_PPAGE: + elif self.ch in [curses.KEY_PPAGE, curses.KEY_SR]: self.area.set_params(h, offset=-5) - elif self.ch == curses.KEY_NPAGE: + elif self.ch in [curses.KEY_NPAGE, curses.KEY_SF]: self.area.set_params(h, offset=5) elif self.ch == 32: