From 6e215f71e58a945f55dca8b5769296ef52256a0e Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Mon, 14 Oct 2019 12:23:29 +1030 Subject: Add support for more apps in rifle default config - audacity - firefox dev edition - scribus projects - sc (cli spreadsheet editor) - krita image editor Also fix existing regex patterns for video|audio. --- ranger/config/rifle.conf | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf index 8c48760e..88675123 100644 --- a/ranger/config/rifle.conf +++ b/ranger/config/rifle.conf @@ -94,7 +94,7 @@ ext 1 = man "$1" ext s[wmf]c, has zsnes, X = zsnes "$1" ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1" ext nes, has fceux, X = fceux "$1" -ext exe = wine "$1" +ext exe, has wine = wine "$1" name ^[mM]akefile$ = make #-------------------------------------------- @@ -118,17 +118,19 @@ ext midi?, terminal, has wildmidi = wildmidi -- "$@" #-------------------------------------------- # Video/Audio with a GUI #------------------------------------------- -mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@" -mime ^video|audio, has smplayer, X, flag f = smplayer "$@" +mime ^video|^audio, has gmplayer, X, flag f = gmplayer -- "$@" +mime ^video|^audio, has smplayer, X, flag f = smplayer "$@" mime ^video, has mpv, X, flag f = mpv -- "$@" mime ^video, has mpv, X, flag f = mpv --fs -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" mime ^video, has mplayer, X, flag f = mplayer -- "$@" mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@" -mime ^video|audio, has vlc, X, flag f = vlc -- "$@" -mime ^video|audio, has totem, X, flag f = totem -- "$@" -mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@" +mime ^video|^audio, has vlc, X, flag f = vlc -- "$@" +mime ^video|^audio, has totem, X, flag f = totem -- "$@" +mime ^video|^audio, has totem, X, flag f = totem --fullscreen -- "$@" +mime ^audio, has audacity, X, flag f = audacity -- "$@" +ext aup, has audacity, X, flag f = audacity -- "$@" #-------------------------------------------- # Video without X @@ -153,6 +155,7 @@ ext pdf, has epdfview, X, flag f = epdfview -- "$@" ext pdf, has qpdfview, X, flag f = qpdfview "$@" ext pdf, has open, X, flag f = open "$@" +ext sc, has sc, = sc -- "$@" ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER" ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@" @@ -174,6 +177,8 @@ ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@" ext cbr, has zathura, X, flag f = zathura -- "$@" ext cbz, has zathura, X, flag f = zathura -- "$@" +ext sla, has scribus, X, flag f = scribus -- "$@" + #------------------------------------------- # Images #------------------------------------------- @@ -193,7 +198,9 @@ mime ^image, has geeqie, X, flag f = geeqie -- "$@" mime ^image, has gpicview, X, flag f = gpicview -- "$@" mime ^image, has gwenview, X, flag f = gwenview -- "$@" mime ^image, has gimp, X, flag f = gimp -- "$@" +mime ^image, has krita, X, flag f = krita -- "$@" ext xcf, X, flag f = gimp -- "$@" +ext kra, has krita, X, flag f = krita -- "$@" #------------------------------------------- # Archives -- cgit 1.4.1-2-gfad0 From 1481d2a6136052ceb5f4410e2922564229721cb4 Mon Sep 17 00:00:00 2001 From: Myk Date: Sat, 1 Aug 2020 18:35:14 +1000 Subject: Test for and follow tab changes in multipane mode --- ranger/gui/widgets/statusbar.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index fd44613e..6499135f 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -42,6 +42,7 @@ class StatusBar(Widget): # pylint: disable=too-many-instance-attributes self.column = column self.settings.signal_bind('setopt.display_size_in_status_bar', self.request_redraw, weak=True) + self.fm.signal_bind('tab.change', self.request_redraw, weak=True) def request_redraw(self): self.need_redraw = True @@ -52,9 +53,14 @@ class StatusBar(Widget): # pylint: disable=too-many-instance-attributes def clear_message(self): self.msg = None - def draw(self): + def draw(self): # pylint: disable=too-many-branches """Draw the statusbar""" + if self.fm.ui.viewmode == self.fm.ui.ALLOWED_VIEWMODES[1]: + if self.column != self.fm.ui.browser.main_column: + self.column = self.fm.ui.browser.main_column + self.need_redraw = True + if self.hint and isinstance(self.hint, str): if self.old_hint != self.hint: self.need_redraw = True -- cgit 1.4.1-2-gfad0 From c5229b4f56c1c6fb6ec3bc5c6e7c621fa53cfe05 Mon Sep 17 00:00:00 2001 From: Myk Date: Sat, 1 Aug 2020 22:04:52 +1000 Subject: Handle all column changes --- ranger/gui/widgets/statusbar.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index 6499135f..b3484ac4 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -43,6 +43,7 @@ class StatusBar(Widget): # pylint: disable=too-many-instance-attributes self.settings.signal_bind('setopt.display_size_in_status_bar', self.request_redraw, weak=True) self.fm.signal_bind('tab.change', self.request_redraw, weak=True) + self.fm.signal_bind('setop.viewmode', self.request_redraw, weak=True) def request_redraw(self): self.need_redraw = True @@ -56,10 +57,9 @@ class StatusBar(Widget): # pylint: disable=too-many-instance-attributes def draw(self): # pylint: disable=too-many-branches """Draw the statusbar""" - if self.fm.ui.viewmode == self.fm.ui.ALLOWED_VIEWMODES[1]: - if self.column != self.fm.ui.browser.main_column: - self.column = self.fm.ui.browser.main_column - self.need_redraw = True + if self.column != self.fm.ui.browser.main_column: + self.column = self.fm.ui.browser.main_column + self.need_redraw = True if self.hint and isinstance(self.hint, str): if self.old_hint != self.hint: -- cgit 1.4.1-2-gfad0 From 4cb09a536923334d443853f3da5b7481d0c40d03 Mon Sep 17 00:00:00 2001 From: Myk Date: Sun, 2 Aug 2020 20:02:52 +1000 Subject: Add handler for tab.layoutchange --- ranger/gui/widgets/statusbar.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index b3484ac4..06893b46 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -43,6 +43,7 @@ class StatusBar(Widget): # pylint: disable=too-many-instance-attributes self.settings.signal_bind('setopt.display_size_in_status_bar', self.request_redraw, weak=True) self.fm.signal_bind('tab.change', self.request_redraw, weak=True) + self.fm.signal_bind('tab.layoutchange', self.request_redraw, weak=True) self.fm.signal_bind('setop.viewmode', self.request_redraw, weak=True) def request_redraw(self): -- cgit 1.4.1-2-gfad0 From ab71442b4a4f19784b01cfc4cb9c2995fdb7d6f3 Mon Sep 17 00:00:00 2001 From: Myk Date: Thu, 6 Aug 2020 21:59:46 +1000 Subject: unbind from tab.change --- ranger/gui/widgets/statusbar.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index 06893b46..4873c07a 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -42,7 +42,6 @@ class StatusBar(Widget): # pylint: disable=too-many-instance-attributes self.column = column self.settings.signal_bind('setopt.display_size_in_status_bar', self.request_redraw, weak=True) - self.fm.signal_bind('tab.change', self.request_redraw, weak=True) self.fm.signal_bind('tab.layoutchange', self.request_redraw, weak=True) self.fm.signal_bind('setop.viewmode', self.request_redraw, weak=True) -- cgit 1.4.1-2-gfad0 From 11a4264a9a77faa44f0ae67add2c140bdbd4f7ab Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 4 Oct 2020 16:24:44 +0200 Subject: Fix encoding of cached filenames A typo crept into the encoding of paths used for the hashes of cached images. The error handler "backslashescape" doesn't exist, it should've been "backslashreplace." Fixes #2119 --- ranger/core/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index ba31db58..adfbe94d 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -1025,7 +1025,7 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m inode = stat(path).st_ino inode_path = "{0}{1}".format(str(inode), path) if PY3: - inode_path = inode_path.encode('utf-8', 'backslashescape') + inode_path = inode_path.encode('utf-8', 'backslashreplace') return '{0}.jpg'.format(sha512(inode_path).hexdigest()) def get_preview(self, fobj, width, height): -- cgit 1.4.1-2-gfad0 From 0770cd5ca3cac4b42c2185dcebe1ab8f17ba881f Mon Sep 17 00:00:00 2001 From: toonn Date: Fri, 6 Nov 2020 14:24:08 +0100 Subject: Fix rifle rule alignment --- ranger/config/rifle.conf | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf index 88675123..be929ea4 100644 --- a/ranger/config/rifle.conf +++ b/ranger/config/rifle.conf @@ -120,17 +120,17 @@ ext midi?, terminal, has wildmidi = wildmidi -- "$@" #------------------------------------------- mime ^video|^audio, has gmplayer, X, flag f = gmplayer -- "$@" mime ^video|^audio, has smplayer, X, flag f = smplayer "$@" -mime ^video, has mpv, X, flag f = mpv -- "$@" -mime ^video, has mpv, X, flag f = mpv --fs -- "$@" -mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" -mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" -mime ^video, has mplayer, X, flag f = mplayer -- "$@" -mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@" +mime ^video, has mpv, X, flag f = mpv -- "$@" +mime ^video, has mpv, X, flag f = mpv --fs -- "$@" +mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" +mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" +mime ^video, has mplayer, X, flag f = mplayer -- "$@" +mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@" mime ^video|^audio, has vlc, X, flag f = vlc -- "$@" mime ^video|^audio, has totem, X, flag f = totem -- "$@" mime ^video|^audio, has totem, X, flag f = totem --fullscreen -- "$@" -mime ^audio, has audacity, X, flag f = audacity -- "$@" -ext aup, has audacity, X, flag f = audacity -- "$@" +mime ^audio, has audacity, X, flag f = audacity -- "$@" +ext aup, has audacity, X, flag f = audacity -- "$@" #-------------------------------------------- # Video without X @@ -177,7 +177,7 @@ ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@" ext cbr, has zathura, X, flag f = zathura -- "$@" ext cbz, has zathura, X, flag f = zathura -- "$@" -ext sla, has scribus, X, flag f = scribus -- "$@" +ext sla, has scribus, X, flag f = scribus -- "$@" #------------------------------------------- # Images @@ -199,8 +199,8 @@ mime ^image, has gpicview, X, flag f = gpicview -- "$@" mime ^image, has gwenview, X, flag f = gwenview -- "$@" mime ^image, has gimp, X, flag f = gimp -- "$@" mime ^image, has krita, X, flag f = krita -- "$@" -ext xcf, X, flag f = gimp -- "$@" ext kra, has krita, X, flag f = krita -- "$@" +ext xcf, X, flag f = gimp -- "$@" #------------------------------------------- # Archives -- cgit 1.4.1-2-gfad0 From a8105b082f94729669d0509f07c98aa566c0278f Mon Sep 17 00:00:00 2001 From: Zoran Plesivcak Date: Sun, 8 Nov 2020 10:40:13 +0000 Subject: Allow $PAGER to contain spaces (handle pager flags) This change is similar to: c826091a74e88102ca1795ab9798dd8b8498f653 . See the referenced commit for the explanation. Note that $PAGER is not a strictly better than "$PAGER". In the cases where the pager executable in PAGER contains spaces e.g. "/path with spaces/bin/less" the "$PAGER" works correctly and $PAGER doesn't. This occurrence is much less frequent than pager in PAGER containing flags, e.g. "less -R" which works correctly with $PAGER, but doesn't with "$PAGER". This change is a desirable trade-off. --- ranger/config/rifle.conf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf index f4d8f012..c9834224 100644 --- a/ranger/config/rifle.conf +++ b/ranger/config/rifle.conf @@ -86,9 +86,9 @@ ext x?html?, has w3m, terminal = w3m "$@" #------------------------------------------- # Define the "editor" for text files as first action mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@" -mime ^text, label pager = "$PAGER" -- "$@" +mime ^text, label pager = $PAGER -- "$@" !mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php = ${VISUAL:-$EDITOR} -- "$@" -!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php = "$PAGER" -- "$@" +!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php = $PAGER -- "$@" ext 1 = man "$1" ext s[wmf]c, has zsnes, X = zsnes "$1" @@ -156,7 +156,7 @@ ext pdf, has qpdfview, X, flag f = qpdfview "$@" ext pdf, has open, X, flag f = open "$@" ext sc, has sc, = sc -- "$@" -ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER" +ext docx?, has catdoc, terminal = catdoc -- "$@" | $PAGER ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@" ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@" @@ -207,15 +207,15 @@ ext xcf, X, flag f = gimp -- "$@" #------------------------------------------- # avoid password prompt by providing empty password -ext 7z, has 7z = 7z -p l "$@" | "$PAGER" +ext 7z, has 7z = 7z -p l "$@" | $PAGER # This requires atool -ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER" -ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER" +ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | $PAGER +ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | $PAGER ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@" ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@" # Listing and extracting archives without atool: -ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER" +ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | $PAGER ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done ext zip, has unzip = unzip -l "$1" | less @@ -275,7 +275,7 @@ label open, has open = open -- "$@" # Define the editor for non-text files + pager as last action !mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php = ask label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php = ${VISUAL:-$EDITOR} -- "$@" -label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php = "$PAGER" -- "$@" +label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php = $PAGER -- "$@" ###################################################################### -- cgit 1.4.1-2-gfad0 From bd56b2538e7ba8b6edcdb490edd8374176e55bd6 Mon Sep 17 00:00:00 2001 From: Zoran Plesivcak Date: Sun, 8 Nov 2020 10:52:27 +0000 Subject: Update the docs to reflect changes to code Changes to code in: - previous commit (THIS_COMMIT^) - c826091a74e88102ca1795ab9798dd8b8498f653 --- doc/rifle.1 | 4 ++-- doc/rifle.pod | 4 ++-- examples/rifle_different_file_opener.conf | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/rifle.1 b/doc/rifle.1 index b3dd6373..4e213a8a 100644 --- a/doc/rifle.1 +++ b/doc/rifle.1 @@ -216,8 +216,8 @@ List all the different methods: .PP .Vb 4 \& $ rifle \-l helloworld.py -\& 0:editor::"$EDITOR" \-\- "$@" -\& 1:pager::"$PAGER" \-\- "$@" +\& 0:editor::$EDITOR \-\- "$@" +\& 1:pager::$PAGER \-\- "$@" \& 2:::python \-\- "$1" .Ve .PP diff --git a/doc/rifle.pod b/doc/rifle.pod index e0abaa3b..0cd34478 100644 --- a/doc/rifle.pod +++ b/doc/rifle.pod @@ -117,8 +117,8 @@ Specifies the directory for configuration files. Defaults to F<$HOME/.config>. List all the different methods: $ rifle -l helloworld.py - 0:editor::"$EDITOR" -- "$@" - 1:pager::"$PAGER" -- "$@" + 0:editor::$EDITOR -- "$@" + 1:pager::$PAGER -- "$@" 2:::python -- "$1" Display its content by opening it with "cat": diff --git a/examples/rifle_different_file_opener.conf b/examples/rifle_different_file_opener.conf index 695f27c6..b806b820 100644 --- a/examples/rifle_different_file_opener.conf +++ b/examples/rifle_different_file_opener.conf @@ -5,5 +5,5 @@ else = xdg-open "$1" # You need an "editor" and "pager" in order to use certain functions in ranger: -label editor = "$EDITOR" -- "$@" -label pager = "$PAGER" -- "$@" +label editor = $EDITOR -- "$@" +label pager = $PAGER -- "$@" -- cgit 1.4.1-2-gfad0 From e71b935362812cac0170f376cf0fafd99983310f Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 8 Nov 2020 13:43:08 +0100 Subject: Regenerate rifle man page --- doc/rifle.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/rifle.1 b/doc/rifle.1 index 4e213a8a..6b676162 100644 --- a/doc/rifle.1 +++ b/doc/rifle.1 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "RIFLE 1" -.TH RIFLE 1 "rifle-1.9.3" "2020-02-08" "rifle manual" +.TH RIFLE 1 "rifle-1.9.3" "2020-11-08" "rifle manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l -- cgit 1.4.1-2-gfad0 From 7e588057fd54ea36cfba3170f1b107461c0bf9ee Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 21:09:02 +0100 Subject: Add new py3 specific pylint warnings to disabled --- .pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index 3fdcbaa8..994ddf62 100644 --- a/.pylintrc +++ b/.pylintrc @@ -13,7 +13,7 @@ max-branches=16 [FORMAT] max-line-length = 99 enable=no-absolute-import,old-division -disable=cyclic-import,duplicate-code,fixme,import-outside-toplevel,locally-disabled,locally-enabled,missing-docstring,no-else-break,no-else-continue,no-else-raise,no-else-return,redefined-variable-type,stop-iteration-return,useless-object-inheritance +disable=cyclic-import,duplicate-code,fixme,import-outside-toplevel,locally-disabled,locally-enabled,missing-docstring,no-else-break,no-else-continue,no-else-raise,no-else-return,raise-missing-from,redefined-variable-type,stop-iteration-return,super-with-arguments,useless-object-inheritance [TYPECHECK] ignored-classes=ranger.core.actions.Actions -- cgit 1.4.1-2-gfad0 From d323678ec06693ed15319f7dc883c9da96722965 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 21:09:57 +0100 Subject: Unalign code because bad-whitspace was removed --- ranger/config/commands.py | 31 +++++++++++++++---------------- ranger/container/settings.py | 10 ++++------ ranger/gui/color.py | 36 ++++++++++++++++++------------------ 3 files changed, 37 insertions(+), 40 deletions(-) diff --git a/ranger/config/commands.py b/ranger/config/commands.py index b7b02e73..9031e7a2 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1465,22 +1465,21 @@ class scout(Command): Multiple flags can be combined. For example, ":scout -gpt" would create a :filter-like command using globbing. """ - # pylint: disable=bad-whitespace - AUTO_OPEN = 'a' - OPEN_ON_ENTER = 'e' - FILTER = 'f' - SM_GLOB = 'g' - IGNORE_CASE = 'i' - KEEP_OPEN = 'k' - SM_LETTERSKIP = 'l' - MARK = 'm' - UNMARK = 'M' - PERM_FILTER = 'p' - SM_REGEX = 'r' - SMART_CASE = 's' - AS_YOU_TYPE = 't' - INVERT = 'v' - # pylint: enable=bad-whitespace + + AUTO_OPEN = "a" + OPEN_ON_ENTER = "e" + FILTER = "f" + SM_GLOB = "g" + IGNORE_CASE = "i" + KEEP_OPEN = "k" + SM_LETTERSKIP = "l" + MARK = "m" + UNMARK = "M" + PERM_FILTER = "p" + SM_REGEX = "r" + SMART_CASE = "s" + AS_YOU_TYPE = "t" + INVERT = "v" def __init__(self, *args, **kwargs): super(scout, self).__init__(*args, **kwargs) diff --git a/ranger/container/settings.py b/ranger/container/settings.py index 7549325a..677ea3b8 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -14,13 +14,11 @@ from ranger.gui.colorscheme import _colorscheme_name_to_class # Use these priority constants to trigger events at specific points in time # during processing of the signals "setopt" and "setopt." -# pylint: disable=bad-whitespace -SIGNAL_PRIORITY_RAW = 2.0 # signal.value will be raw -SIGNAL_PRIORITY_SANITIZE = 1.0 # (Internal) post-processing signal.value -SIGNAL_PRIORITY_BETWEEN = 0.6 # sanitized signal.value, old fm.settings.XYZ -SIGNAL_PRIORITY_SYNC = 0.2 # (Internal) updating fm.settings.XYZ +SIGNAL_PRIORITY_RAW = 2.0 # signal.value will be raw +SIGNAL_PRIORITY_SANITIZE = 1.0 # (Internal) post-processing signal.value +SIGNAL_PRIORITY_BETWEEN = 0.6 # sanitized signal.value, old fm.settings.XYZ +SIGNAL_PRIORITY_SYNC = 0.2 # (Internal) updating fm.settings.XYZ SIGNAL_PRIORITY_AFTER_SYNC = 0.1 # after fm.settings.XYZ was updated -# pylint: enable=bad-whitespace ALLOWED_SETTINGS = { diff --git a/ranger/gui/color.py b/ranger/gui/color.py index 8f6439c7..81d8b44b 100644 --- a/ranger/gui/color.py +++ b/ranger/gui/color.py @@ -49,27 +49,27 @@ def get_color(fg, bg): return COLOR_PAIRS[key] -# pylint: disable=invalid-name,bad-whitespace -black = curses.COLOR_BLACK -blue = curses.COLOR_BLUE -cyan = curses.COLOR_CYAN -green = curses.COLOR_GREEN -magenta = curses.COLOR_MAGENTA -red = curses.COLOR_RED -white = curses.COLOR_WHITE -yellow = curses.COLOR_YELLOW -default = -1 - -normal = curses.A_NORMAL -bold = curses.A_BOLD -blink = curses.A_BLINK -reverse = curses.A_REVERSE -underline = curses.A_UNDERLINE -invisible = curses.A_INVIS +# pylint: disable=invalid-name +black = curses.COLOR_BLACK +blue = curses.COLOR_BLUE +cyan = curses.COLOR_CYAN +green = curses.COLOR_GREEN +magenta = curses.COLOR_MAGENTA +red = curses.COLOR_RED +white = curses.COLOR_WHITE +yellow = curses.COLOR_YELLOW +default = -1 + +normal = curses.A_NORMAL +bold = curses.A_BOLD +blink = curses.A_BLINK +reverse = curses.A_REVERSE +underline = curses.A_UNDERLINE +invisible = curses.A_INVIS dim = curses.A_DIM default_colors = (default, default, normal) -# pylint: enable=invalid-name,bad-whitespace +# pylint: enable=invalid-name curses.setupterm() # Adding BRIGHT to a color achieves what `bold` was used for. -- cgit 1.4.1-2-gfad0 From 6572e37c5f9526ad0f2a41c2f654a3cdf31db112 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 21:10:57 +0100 Subject: Shortcut py2 incompatible pytest tests Three of our pytest tests aren't compatible with python 2 by returning early from these testcases and always making them pass, we avoid false negatives in CI results. --- tests/pylint/test_py2_compat.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/pylint/test_py2_compat.py b/tests/pylint/test_py2_compat.py index a5d2e284..08c8de31 100644 --- a/tests/pylint/test_py2_compat.py +++ b/tests/pylint/test_py2_compat.py @@ -5,6 +5,8 @@ import py2_compat import astroid import pylint.testutils +from sys import version_info +PY2 = version_info[0] < 3 class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase): CHECKER_CLASS = py2_compat.Py2CompatibilityChecker @@ -42,6 +44,9 @@ class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase): self.checker.visit_classdef(from_new) def test_print_without_import(self): + if PY2: + return + print_function_call = astroid.extract_node(""" print("Print function call without importing print_function") """) @@ -73,6 +78,9 @@ class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase): self.checker.visit_call(nested_print_function_call) def test_print_late_import(self): + if PY2: + return + early_print_function_call = astroid.extract_node(""" print("Nested print with import in scope") #@ def f(): @@ -91,6 +99,9 @@ class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase): self.checker.visit_call(early_print_function_call) def test_implicit_format_spec(self): + if PY2: + return + implicit_format_spec = astroid.extract_node(""" "{}".format("implicit") #@ """) -- cgit 1.4.1-2-gfad0 From 94e823c17cf408827551efd8e3ce9ae77f865519 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 22:41:53 +0100 Subject: Drop py3 specific pylint for ranger/config --- ranger/config/.pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/config/.pylintrc b/ranger/config/.pylintrc index cc79f97c..316bf189 100644 --- a/ranger/config/.pylintrc +++ b/ranger/config/.pylintrc @@ -5,4 +5,4 @@ class-rgx=[a-z][a-z0-9_]{1,30}$ [FORMAT] max-line-length = 99 max-module-lines=3000 -disable=duplicate-code,fixme,import-outside-toplevel,locally-disabled,locally-enabled,missing-docstring,no-else-return +disable=duplicate-code,fixme,import-outside-toplevel,locally-disabled,locally-enabled,missing-docstring,no-else-return,super-with-arguments -- cgit 1.4.1-2-gfad0 From 4984fafed9018f80a2af03ecd8862fd449e2a87c Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 22:46:29 +0100 Subject: Fix test_py2_compat formatting --- tests/pylint/test_py2_compat.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pylint/test_py2_compat.py b/tests/pylint/test_py2_compat.py index 08c8de31..bd1ace65 100644 --- a/tests/pylint/test_py2_compat.py +++ b/tests/pylint/test_py2_compat.py @@ -8,6 +8,7 @@ import pylint.testutils from sys import version_info PY2 = version_info[0] < 3 + class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase): CHECKER_CLASS = py2_compat.Py2CompatibilityChecker -- cgit 1.4.1-2-gfad0 From 9c69b4aecb87fc6120cd8ce85e0f0020397199ef Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 19:33:12 +0100 Subject: Add formatting to make output for clarity --- Makefile | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 82a6153a..1653ceb9 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,9 @@ FILTER ?= . CWD = $(shell pwd) +bold := $(shell tput bold) +sgr0 := $(shell tput sgr0) + default: test compile @echo 'Run `make options` for a list of all options' @@ -91,39 +94,45 @@ TEST_PATHS_MAIN = \ TEST_PATH_CONFIG = ./ranger/config test_pylint: - @echo "Running pylint..." + @echo "$(bold)Running pylint...$(sgr0)" pylint $(TEST_PATHS_MAIN) pylint --rcfile=$(TEST_PATH_CONFIG)/.pylintrc $(TEST_PATH_CONFIG) test_flake8: - @echo "Running flake8..." + @echo "$(bold)Running flake8...$(sgr0)" flake8 $(TEST_PATHS_MAIN) $(TEST_PATH_CONFIG) + @echo test_doctest: - @echo "Running doctests..." + @echo "$(bold)Running doctests...$(sgr0)" @set -e; \ for FILE in $(shell grep -IHm 1 doctest -r ranger | grep $(FILTER) | cut -d: -f1); do \ echo "Testing $$FILE..."; \ RANGER_DOCTEST=1 PYTHONPATH=".:"$$PYTHONPATH ${PYTHON} $$FILE; \ done + @echo test_pytest: - @echo "Running py.test tests..." + @echo "$(bold)Running py.test tests...$(sgr0)" py.test tests + @echo test_py: test_pylint test_flake8 test_doctest test_pytest test_other - @echo "Finished python and documentation tests!" + @echo "$(bold)Finished python and documentation tests!$(sgr0)" + @echo test_shellcheck: - @echo "Running shellcheck..." + @echo "$(bold)Running shellcheck...$(sgr0)" sed '2,$$s/^\(\s*\)#/\1/' ./ranger/data/scope.sh | shellcheck -a - + @echo test_other: - @echo "Checking completeness of man page..." + @echo "$(bold)Checking completeness of man page...$(sgr0)" @tests/manpage_completion_test.py + @echo test: test_py test_shellcheck - @echo "Finished testing: All tests passed!" + @echo "$(bold)Finished testing: All tests passed!$(sgr0)" doc/ranger.1: doc/ranger.pod README.md pod2man --stderr --center='ranger manual' \ -- cgit 1.4.1-2-gfad0 From 9ed367206da27f62b503a88d1020385dc06d00e3 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 19:57:28 +0100 Subject: Change "sgr0" to "normal" for legibility --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 1653ceb9..0cb35bd4 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ FILTER ?= . CWD = $(shell pwd) bold := $(shell tput bold) -sgr0 := $(shell tput sgr0) +normal := $(shell tput sgr0) default: test compile @echo 'Run `make options` for a list of all options' @@ -94,17 +94,17 @@ TEST_PATHS_MAIN = \ TEST_PATH_CONFIG = ./ranger/config test_pylint: - @echo "$(bold)Running pylint...$(sgr0)" + @echo "$(bold)Running pylint...$(normal)" pylint $(TEST_PATHS_MAIN) pylint --rcfile=$(TEST_PATH_CONFIG)/.pylintrc $(TEST_PATH_CONFIG) test_flake8: - @echo "$(bold)Running flake8...$(sgr0)" + @echo "$(bold)Running flake8...$(normal)" flake8 $(TEST_PATHS_MAIN) $(TEST_PATH_CONFIG) @echo test_doctest: - @echo "$(bold)Running doctests...$(sgr0)" + @echo "$(bold)Running doctests...$(normal)" @set -e; \ for FILE in $(shell grep -IHm 1 doctest -r ranger | grep $(FILTER) | cut -d: -f1); do \ echo "Testing $$FILE..."; \ @@ -113,26 +113,26 @@ test_doctest: @echo test_pytest: - @echo "$(bold)Running py.test tests...$(sgr0)" + @echo "$(bold)Running py.test tests...$(normal)" py.test tests @echo test_py: test_pylint test_flake8 test_doctest test_pytest test_other - @echo "$(bold)Finished python and documentation tests!$(sgr0)" + @echo "$(bold)Finished python and documentation tests!$(normal)" @echo test_shellcheck: - @echo "$(bold)Running shellcheck...$(sgr0)" + @echo "$(bold)Running shellcheck...$(normal)" sed '2,$$s/^\(\s*\)#/\1/' ./ranger/data/scope.sh | shellcheck -a - @echo test_other: - @echo "$(bold)Checking completeness of man page...$(sgr0)" + @echo "$(bold)Checking completeness of man page...$(normal)" @tests/manpage_completion_test.py @echo test: test_py test_shellcheck - @echo "$(bold)Finished testing: All tests passed!$(sgr0)" + @echo "$(bold)Finished testing: All tests passed!$(normal)" doc/ranger.1: doc/ranger.pod README.md pod2man --stderr --center='ranger manual' \ -- cgit 1.4.1-2-gfad0 From 16380bc58754851dd6fc9392619d70a0564d45c0 Mon Sep 17 00:00:00 2001 From: Fedor Date: Mon, 18 Nov 2019 03:16:16 +0100 Subject: Fix ranger freeze after shell command during kitty preview --- ranger/ext/img_display.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index f056db3b..5ca55cc1 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -683,7 +683,7 @@ class KittyImageDisplayer(ImageDisplayer, FileManagerAware): self.stdbout.flush() # kitty doesn't seem to reply on deletes, checking like we do in draw() # will slows down scrolling with timeouts from select - self.image_id -= 1 + self.image_id = (0, self.image_id) self.fm.ui.win.redrawwin() self.fm.ui.win.refresh() -- cgit 1.4.1-2-gfad0 From ab7a2b4b4b2de146695fe25fce2d4cf3d1a10047 Mon Sep 17 00:00:00 2001 From: Fedor Date: Mon, 18 Nov 2019 15:43:31 +0100 Subject: add forgotten max --- ranger/ext/img_display.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index 5ca55cc1..31112071 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -683,7 +683,7 @@ class KittyImageDisplayer(ImageDisplayer, FileManagerAware): self.stdbout.flush() # kitty doesn't seem to reply on deletes, checking like we do in draw() # will slows down scrolling with timeouts from select - self.image_id = (0, self.image_id) + self.image_id = max(0, self.image_id) self.fm.ui.win.redrawwin() self.fm.ui.win.refresh() -- cgit 1.4.1-2-gfad0 From 5a02902253b76fe39f36b9a63a52a24fba0c7142 Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 15 Nov 2020 19:07:31 +0100 Subject: Add decrement When adding the max function call the decrementing was dropped. Fixes #1603 --- ranger/ext/img_display.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index 31112071..b738f458 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -683,7 +683,7 @@ class KittyImageDisplayer(ImageDisplayer, FileManagerAware): self.stdbout.flush() # kitty doesn't seem to reply on deletes, checking like we do in draw() # will slows down scrolling with timeouts from select - self.image_id = max(0, self.image_id) + self.image_id = max(0, self.image_id - 1) self.fm.ui.win.redrawwin() self.fm.ui.win.refresh() -- cgit 1.4.1-2-gfad0 From 47b116e1414e7dadeb949e83c3ac75e334e009b1 Mon Sep 17 00:00:00 2001 From: Ethan Kiang Date: Wed, 23 Oct 2019 03:31:17 -0400 Subject: Added draw_borders setting support for view_multipane --- ranger/gui/widgets/view_multipane.py | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py index 9661d31e..b2b1fdd3 100644 --- a/ranger/gui/widgets/view_multipane.py +++ b/ranger/gui/widgets/view_multipane.py @@ -3,6 +3,7 @@ from __future__ import (absolute_import, division, print_function) +import curses from ranger.gui.widgets.view_base import ViewBase from ranger.gui.widgets.browsercolumn import BrowserColumn @@ -43,6 +44,58 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors self.add_child(column) self.resize(self.y, self.x, self.hei, self.wid) + def draw(self): + ViewBase.draw(self) + + if self.settings.draw_borders: + draw_borders = self.settings.draw_borders.lower() + if draw_borders in ['both', 'true']: # 'true' for backwards compat. + border_types = ['separators', 'outline'] + else: + border_types = [draw_borders] + self._draw_borders(border_types) + + def _draw_borders(self, border_types): + # Referenced from ranger.gui.widgets.view_miller + win = self.win + + self.color('in_browser', 'border') + + left_start = 0 + right_end = self.wid - 1 + + # Draw the outline borders + if 'outline' in border_types: + try: + win.hline(0, left_start, curses.ACS_HLINE, right_end - left_start) + win.hline(self.hei - 1, left_start, curses.ACS_HLINE, right_end - left_start) + win.vline(1, left_start, curses.ACS_VLINE, self.hei - 2) + win.vline(1, right_end, curses.ACS_VLINE, self.hei - 2) + # Draw the four corners + self.addch(0, left_start, curses.ACS_ULCORNER) + self.addch(self.hei - 1, left_start, curses.ACS_LLCORNER) + self.addch(0, right_end, curses.ACS_URCORNER) + self.addch(self.hei - 1, right_end, curses.ACS_LRCORNER) + except curses.error: + pass + + # Draw the column separators + if 'separators' in border_types: + for child in self.columns[:-1]: + x = child.x + child.wid + y = self.hei - 1 + try: + win.vline(1, x, curses.ACS_VLINE, y - 1) + if 'outline' in border_types: + self.addch(0, x, curses.ACS_TTEE, 0) + self.addch(y, x, curses.ACS_BTEE, 0) + else: + self.addch(0, x, curses.ACS_VLINE, 0) + self.addch(y, x, curses.ACS_VLINE, 0) + except curses.error: + # boundary out of index safety + pass + def resize(self, y, x, hei=None, wid=None): ViewBase.resize(self, y, x, hei, wid) column_width = int((wid - len(self.columns) + 1) / len(self.columns)) -- cgit 1.4.1-2-gfad0 From 476f9703592259969b1f194ca5924edf9753b87d Mon Sep 17 00:00:00 2001 From: Ethan Kiang Date: Sat, 26 Oct 2019 22:09:41 -0400 Subject: Fixed borders drawing over the 1st and last directory pylint flake8 errors fixed --- ranger/gui/widgets/view_multipane.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py index b2b1fdd3..0ff849c9 100644 --- a/ranger/gui/widgets/view_multipane.py +++ b/ranger/gui/widgets/view_multipane.py @@ -45,6 +45,11 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors self.resize(self.y, self.x, self.hei, self.wid) def draw(self): + if self.need_clear: + self.win.erase() + self.need_redraw = True + self.need_clear = False + ViewBase.draw(self) if self.settings.draw_borders: @@ -54,6 +59,12 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors else: border_types = [draw_borders] self._draw_borders(border_types) + if self.draw_bookmarks: + self._draw_bookmarks() + elif self.draw_hints: + self._draw_hints() + elif self.draw_info: + self._draw_info(self.draw_info) def _draw_borders(self, border_types): # Referenced from ranger.gui.widgets.view_miller @@ -98,11 +109,18 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors def resize(self, y, x, hei=None, wid=None): ViewBase.resize(self, y, x, hei, wid) + + border_type = self.settings.draw_borders.lower() + if border_type in ['outline', 'both', 'true']: + # 'true' for backwards compat., no height pad needed for 'separators' + pad = 1 + else: + pad = 0 column_width = int((wid - len(self.columns) + 1) / len(self.columns)) left = 0 top = 0 for column in self.columns: - column.resize(top, left, hei, max(1, column_width)) + column.resize(top + pad, left, hei - pad * 2, max(1, column_width)) left += column_width + 1 column.need_redraw = True self.need_redraw = True -- cgit 1.4.1-2-gfad0 From 8a9b020ee597f9b388c5aa6fca159cfdc7f9e163 Mon Sep 17 00:00:00 2001 From: Ethan Kiang Date: Fri, 6 Dec 2019 19:02:54 -0500 Subject: created floating style borders for multipane --- ranger/container/settings.py | 2 +- ranger/gui/widgets/view_multipane.py | 71 +++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/ranger/container/settings.py b/ranger/container/settings.py index 677ea3b8..b38b31b5 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -104,7 +104,7 @@ ALLOWED_SETTINGS = { ALLOWED_VALUES = { 'cd_tab_case': ['sensitive', 'insensitive', 'smart'], 'confirm_on_delete': ['multiple', 'always', 'never'], - 'draw_borders': ['none', 'both', 'outline', 'separators'], + 'draw_borders': ['none', 'both', 'outline', 'separators', 'floating'], 'line_numbers': ['false', 'absolute', 'relative'], 'nested_ranger_warning': ['true', 'false', 'error'], 'one_indexed': [False, True], diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py index 0ff849c9..7e8108a6 100644 --- a/ranger/gui/widgets/view_multipane.py +++ b/ranger/gui/widgets/view_multipane.py @@ -66,52 +66,63 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors elif self.draw_info: self._draw_info(self.draw_info) + def _draw_border_rectangle(self, left_start, right_end): + win = self.win + win.hline(0, left_start, curses.ACS_HLINE, right_end - left_start) + win.hline(self.hei - 1, left_start, curses.ACS_HLINE, right_end - left_start) + win.vline(1, left_start, curses.ACS_VLINE, self.hei - 2) + win.vline(1, right_end, curses.ACS_VLINE, self.hei - 2) + # Draw the four corners + self.addch(0, left_start, curses.ACS_ULCORNER) + self.addch(self.hei - 1, left_start, curses.ACS_LLCORNER) + self.addch(0, right_end, curses.ACS_URCORNER) + self.addch(self.hei - 1, right_end, curses.ACS_LRCORNER) + def _draw_borders(self, border_types): # Referenced from ranger.gui.widgets.view_miller win = self.win - self.color('in_browser', 'border') left_start = 0 right_end = self.wid - 1 # Draw the outline borders - if 'outline' in border_types: - try: - win.hline(0, left_start, curses.ACS_HLINE, right_end - left_start) - win.hline(self.hei - 1, left_start, curses.ACS_HLINE, right_end - left_start) - win.vline(1, left_start, curses.ACS_VLINE, self.hei - 2) - win.vline(1, right_end, curses.ACS_VLINE, self.hei - 2) - # Draw the four corners - self.addch(0, left_start, curses.ACS_ULCORNER) - self.addch(self.hei - 1, left_start, curses.ACS_LLCORNER) - self.addch(0, right_end, curses.ACS_URCORNER) - self.addch(self.hei - 1, right_end, curses.ACS_LRCORNER) - except curses.error: - pass - - # Draw the column separators - if 'separators' in border_types: - for child in self.columns[:-1]: - x = child.x + child.wid - y = self.hei - 1 + if 'floating' not in border_types: + if 'outline' in border_types: try: - win.vline(1, x, curses.ACS_VLINE, y - 1) - if 'outline' in border_types: - self.addch(0, x, curses.ACS_TTEE, 0) - self.addch(y, x, curses.ACS_BTEE, 0) - else: - self.addch(0, x, curses.ACS_VLINE, 0) - self.addch(y, x, curses.ACS_VLINE, 0) + self._draw_border_rectangle(left_start, right_end) except curses.error: - # boundary out of index safety pass + # Draw the column separators + if 'separators' in border_types: + for child in self.columns[:-1]: + x = child.x + child.wid + y = self.hei - 1 + try: + win.vline(1, x, curses.ACS_VLINE, y - 1) + if 'outline' in border_types: + self.addch(0, x, curses.ACS_TTEE, 0) + self.addch(y, x, curses.ACS_BTEE, 0) + else: + self.addch(0, x, curses.ACS_VLINE, 0) + self.addch(y, x, curses.ACS_VLINE, 0) + except curses.error: + pass + else: + bordered_column = self.main_column + left_start = max(bordered_column.x, 0) + right_end = min(left_start + bordered_column.wid, self.wid - 1) + try: + self._draw_border_rectangle(left_start, right_end) + except curses.error: + pass + def resize(self, y, x, hei=None, wid=None): ViewBase.resize(self, y, x, hei, wid) border_type = self.settings.draw_borders.lower() - if border_type in ['outline', 'both', 'true']: + if border_type in ['outline', 'both', 'true', 'floating']: # 'true' for backwards compat., no height pad needed for 'separators' pad = 1 else: @@ -123,4 +134,4 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors column.resize(top + pad, left, hei - pad * 2, max(1, column_width)) left += column_width + 1 column.need_redraw = True - self.need_redraw = True + self.need_redraw = True \ No newline at end of file -- cgit 1.4.1-2-gfad0 From 0fbef5d48ca2ceb62aaf08643d548cb4da8373c0 Mon Sep 17 00:00:00 2001 From: Ethan Kiang Date: Fri, 6 Dec 2019 19:19:25 -0500 Subject: pylint fixes --- ranger/gui/widgets/view_multipane.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py index 7e8108a6..9ac8f7a8 100644 --- a/ranger/gui/widgets/view_multipane.py +++ b/ranger/gui/widgets/view_multipane.py @@ -117,7 +117,7 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors self._draw_border_rectangle(left_start, right_end) except curses.error: pass - + def resize(self, y, x, hei=None, wid=None): ViewBase.resize(self, y, x, hei, wid) @@ -134,4 +134,4 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors column.resize(top + pad, left, hei - pad * 2, max(1, column_width)) left += column_width + 1 column.need_redraw = True - self.need_redraw = True \ No newline at end of file + self.need_redraw = True -- cgit 1.4.1-2-gfad0 From 3620f8d440da118ffcbef6b49b6c61405c07cd43 Mon Sep 17 00:00:00 2001 From: Ethan Kiang Date: Thu, 5 Nov 2020 03:17:22 +0800 Subject: Fixed borders not redrawing upon setting change, renamed floating -> active-pane --- ranger/gui/widgets/view_multipane.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py index 9ac8f7a8..923c077f 100644 --- a/ranger/gui/widgets/view_multipane.py +++ b/ranger/gui/widgets/view_multipane.py @@ -17,6 +17,8 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors self.fm.signal_bind('tab.change', self._tabchange_handler) self.rebuild() + self.old_draw_borders = self.settings.draw_borders + def _layoutchange_handler(self): if self.fm.ui.browser == self: self.rebuild() @@ -87,7 +89,7 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors right_end = self.wid - 1 # Draw the outline borders - if 'floating' not in border_types: + if 'active-pane' not in border_types: if 'outline' in border_types: try: self._draw_border_rectangle(left_start, right_end) @@ -122,7 +124,7 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors ViewBase.resize(self, y, x, hei, wid) border_type = self.settings.draw_borders.lower() - if border_type in ['outline', 'both', 'true', 'floating']: + if border_type in ['outline', 'both', 'true', 'active-pane']: # 'true' for backwards compat., no height pad needed for 'separators' pad = 1 else: @@ -135,3 +137,10 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors left += column_width + 1 column.need_redraw = True self.need_redraw = True + + def poke(self): + ViewBase.poke(self) + + if self.old_draw_borders != self.settings.draw_borders: + self.resize(self.y, self.x, self.hei, self.wid) + self.old_draw_borders = self.settings.draw_borders -- cgit 1.4.1-2-gfad0 From 11e3add379562764d59982bc5dd0a0682a336509 Mon Sep 17 00:00:00 2001 From: Ethan Kiang Date: Thu, 5 Nov 2020 21:13:46 +0800 Subject: Use "draw_borders_multipane" instead and "draw_borders" as fallback --- ranger/container/settings.py | 1 + ranger/gui/widgets/view_multipane.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ranger/container/settings.py b/ranger/container/settings.py index b38b31b5..67b4d3b8 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -40,6 +40,7 @@ ALLOWED_SETTINGS = { "display_free_space_in_status_bar": bool, 'display_tags_in_all_columns': bool, 'draw_borders': str, + 'draw_borders_multipane': str, 'draw_progress_bar_in_status_bar': bool, 'flushinput': bool, 'freeze_files': bool, diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py index 923c077f..f55687d5 100644 --- a/ranger/gui/widgets/view_multipane.py +++ b/ranger/gui/widgets/view_multipane.py @@ -17,7 +17,10 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors self.fm.signal_bind('tab.change', self._tabchange_handler) self.rebuild() - self.old_draw_borders = self.settings.draw_borders + self.old_draw_borders = self._draw_borders_setting() + + def _draw_borders_setting(self): + return self.settings.draw_borders_multipane or self.settings.draw_borders def _layoutchange_handler(self): if self.fm.ui.browser == self: @@ -54,8 +57,8 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors ViewBase.draw(self) - if self.settings.draw_borders: - draw_borders = self.settings.draw_borders.lower() + if self._draw_borders_setting(): + draw_borders = self._draw_borders_setting() if draw_borders in ['both', 'true']: # 'true' for backwards compat. border_types = ['separators', 'outline'] else: @@ -123,7 +126,7 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors def resize(self, y, x, hei=None, wid=None): ViewBase.resize(self, y, x, hei, wid) - border_type = self.settings.draw_borders.lower() + border_type = self._draw_borders_setting() if border_type in ['outline', 'both', 'true', 'active-pane']: # 'true' for backwards compat., no height pad needed for 'separators' pad = 1 @@ -141,6 +144,6 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors def poke(self): ViewBase.poke(self) - if self.old_draw_borders != self.settings.draw_borders: + if self.old_draw_borders != self._draw_borders_setting(): self.resize(self.y, self.x, self.hei, self.wid) - self.old_draw_borders = self.settings.draw_borders + self.old_draw_borders = self._draw_borders_setting() -- cgit 1.4.1-2-gfad0 From fefa151e4e318af3f316592201261bddbcbe41ed Mon Sep 17 00:00:00 2001 From: Ethan Kiang Date: Thu, 5 Nov 2020 21:27:04 +0800 Subject: Update ALLOWED_VALUES in settings.py for draw_borders_multipane --- ranger/container/settings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ranger/container/settings.py b/ranger/container/settings.py index 67b4d3b8..fc89763d 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -105,7 +105,9 @@ ALLOWED_SETTINGS = { ALLOWED_VALUES = { 'cd_tab_case': ['sensitive', 'insensitive', 'smart'], 'confirm_on_delete': ['multiple', 'always', 'never'], - 'draw_borders': ['none', 'both', 'outline', 'separators', 'floating'], + 'draw_borders': ['none', 'both', 'outline', 'separators'], + 'draw_borders_multipane': ['none', 'both', 'outline', + 'separators', 'active-pane'], 'line_numbers': ['false', 'absolute', 'relative'], 'nested_ranger_warning': ['true', 'false', 'error'], 'one_indexed': [False, True], -- cgit 1.4.1-2-gfad0 From 3645972216c01bddccf32eefb4900fd3b2782e9a Mon Sep 17 00:00:00 2001 From: Ethan Kiang Date: Thu, 19 Nov 2020 00:56:12 +0800 Subject: Explicit truthy logic for draw_borders_multipane --- ranger/container/settings.py | 2 +- ranger/gui/widgets/view_multipane.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ranger/container/settings.py b/ranger/container/settings.py index fc89763d..e7d6775d 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -106,7 +106,7 @@ ALLOWED_VALUES = { 'cd_tab_case': ['sensitive', 'insensitive', 'smart'], 'confirm_on_delete': ['multiple', 'always', 'never'], 'draw_borders': ['none', 'both', 'outline', 'separators'], - 'draw_borders_multipane': ['none', 'both', 'outline', + 'draw_borders_multipane': [None, 'none', 'both', 'outline', 'separators', 'active-pane'], 'line_numbers': ['false', 'absolute', 'relative'], 'nested_ranger_warning': ['true', 'false', 'error'], diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py index f55687d5..0a4e3a25 100644 --- a/ranger/gui/widgets/view_multipane.py +++ b/ranger/gui/widgets/view_multipane.py @@ -20,7 +20,13 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors self.old_draw_borders = self._draw_borders_setting() def _draw_borders_setting(self): - return self.settings.draw_borders_multipane or self.settings.draw_borders + # If draw_borders_multipane has not been set, it defaults to `None` + # and we fallback to using draw_borders. Important to note: + # `None` is different from the string "none" referring to no borders + if self.settings.draw_borders_multipane != None: + return self.settings.draw_borders_multipane + else: + return self.settings.draw_borders def _layoutchange_handler(self): if self.fm.ui.browser == self: -- cgit 1.4.1-2-gfad0 From 87fec7f1a73b3042b47d160cefcaa303c63664ea Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 18 Nov 2020 18:45:17 +0100 Subject: Use identity rather than equality comparison for None --- ranger/gui/widgets/view_multipane.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py index 0a4e3a25..cef8d9a8 100644 --- a/ranger/gui/widgets/view_multipane.py +++ b/ranger/gui/widgets/view_multipane.py @@ -23,7 +23,7 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors # If draw_borders_multipane has not been set, it defaults to `None` # and we fallback to using draw_borders. Important to note: # `None` is different from the string "none" referring to no borders - if self.settings.draw_borders_multipane != None: + if self.settings.draw_borders_multipane is not None: return self.settings.draw_borders_multipane else: return self.settings.draw_borders -- cgit 1.4.1-2-gfad0 From ce1c27e1af12506f79f0120a617d30c99fffc18c Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 18 Nov 2020 18:52:54 +0100 Subject: Document draw_borders_multipane --- doc/ranger.1 | 14 ++++++++++++-- doc/ranger.pod | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/ranger.1 b/doc/ranger.1 index 50d6bb0f..f675da91 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.9.3" "2020-02-22" "ranger manual" +.TH RANGER 1 "ranger-1.9.3" "2020-11-18" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -974,6 +974,16 @@ Draw borders around or between the columns? Possible values are: \& separators draw only vertical lines between columns \& both both of the above .Ve +.IP "draw_borders_multipane [string]" 4 +.IX Item "draw_borders_multipane [string]" +Draw borders around or between the panes. This setting overrides +\&\fIdraw_borders\fR specifically for the multipane viewmode in case you want +different border styles in both viewmodes. There's one additional legal value +on top of those for \fIdraw_borders\fR: +.Sp +.Vb 1 +\& active\-pane draw an outline around the active pane only +.Ve .IP "draw_progress_bar_in_status_bar [bool]" 4 .IX Item "draw_progress_bar_in_status_bar [bool]" Draw a progress bar in the status bar which displays the average state of all diff --git a/doc/ranger.pod b/doc/ranger.pod index 3f41467d..693c6619 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -1026,6 +1026,16 @@ Draw borders around or between the columns? Possible values are: separators draw only vertical lines between columns both both of the above +=item draw_borders_multipane [string] + +Draw borders around or between the panes. This setting overrides +I specifically for the multipane viewmode in case you want +different border styles in both viewmodes. There's one additional legal value +on top of those for I: + + active-pane draw an outline around the active pane only + + =item draw_progress_bar_in_status_bar [bool] Draw a progress bar in the status bar which displays the average state of all -- cgit 1.4.1-2-gfad0 From fc3dcfe84cd5d0b4382a2dc6375d5a919ed9966c Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 18 Nov 2020 23:52:30 +0100 Subject: Remove redundant blank line in docs When documenting the draw_borders_multipane setting an extra blank line was added. --- doc/ranger.pod | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/ranger.pod b/doc/ranger.pod index 693c6619..bbdfd24e 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -1035,7 +1035,6 @@ on top of those for I: active-pane draw an outline around the active pane only - =item draw_progress_bar_in_status_bar [bool] Draw a progress bar in the status bar which displays the average state of all -- cgit 1.4.1-2-gfad0 From 7c4a0800543112bf56924d5fcb4fe458281b206e Mon Sep 17 00:00:00 2001 From: toonn Date: Tue, 24 Nov 2020 20:48:53 +0100 Subject: Change chmod maps The maps without explicit target only changed user permissions. The chmod utility changes all permissions when the target's omitted. This brings both more in line. Fixes #2161 --- ranger/config/rc.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index e1ed1b73..d7d79f97 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -627,13 +627,13 @@ eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg)) eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg)) eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg)) eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg)) -eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +{0} shell -f chmod +{0} %s".format(arg)) eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg)) eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg)) eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg)) eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg)) -eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -{0} shell -f chmod -{0} %s".format(arg)) # =================================================================== # == Define keys for the console -- cgit 1.4.1-2-gfad0 From 6fd49695111232df31358a67b11dc5ee3b8dbcfc Mon Sep 17 00:00:00 2001 From: chu4ng Date: Sat, 5 Dec 2020 06:29:33 +0300 Subject: Fix IndexError(list index out of range); Fix #2173. --- ranger/core/tab.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ranger/core/tab.py b/ranger/core/tab.py index 1771ffa2..b61a77cc 100644 --- a/ranger/core/tab.py +++ b/ranger/core/tab.py @@ -73,6 +73,8 @@ class Tab(FileManagerAware, SettingsAware): # pylint: disable=too-many-instance self._pointed_obj = self.thisdir.files[self._pointer] except TypeError: pass + except IndexError: + pass pointer = property(_get_pointer, _set_pointer) -- cgit 1.4.1-2-gfad0