You are not logged in.

#601 2010-10-24 01:07:12

zeltak
Member
From: New England
Registered: 2010-08-07
Posts: 168

Re: Ranger, a textbased filemanager

hi

i know im probably stupid but i cant setup atool to unpack files like i want. ive tried this:

class aunpack(Command):

    def execute(self):
            action = ['shell aunpack %s']
            self.fm.execute_command(action, flags='d')

and also this:

class aunpack(Command):

    def execute(self):
            action = ['aunpack %f']
            self.fm.execute_console(action)


but i failed with both. if i issue this in the cli it works well:

:shell aunpack %f

it works well

can someone point me in the right direction?

thx

zeltak

Offline

#602 2010-10-24 12:23:29

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Ranger, a textbased filemanager

Just like the key binding:

class aunpack(Command):
    def execute(self):
        self.fm.execute_console("shell aunpack %s")

"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#603 2010-10-24 13:33:37

Sirsurthur
Member
Registered: 2009-02-02
Posts: 124

Re: Ranger, a textbased filemanager

Thanks again hut for this great app which is the only fm I am using now. Since last update, I noticed the lack a preview of some .srt files (subtitles). Ranger does not show for them any previews like it did before and says the following thing : "utf8 codec can't decode bytes in position x-x : invalid data".

Thanks for your help,
Sirsurthur

Offline

#604 2010-10-24 13:42:20

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Ranger, a textbased filemanager

and "ranger --debug" says what?


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#605 2010-10-24 14:00:49

Sirsurthur
Member
Registered: 2009-02-02
Posts: 124

Re: Ranger, a textbased filemanager

This :

ranger --debug
Traceback (most recent call last):
  File "/usr/lib/python3.1/site-packages/ranger/core/main.py", line 85, in main
    fm.loop()
  File "/usr/lib/python3.1/site-packages/ranger/core/fm.py", line 190, in loop
    loader.work()
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 234, in work
    self.fm.notify(err)
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 229, in work
    next(item.load_generator)
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 114, in generate
    self.signal_emit('after', process=process, loader=self)
  File "/usr/lib/python3.1/site-packages/ranger/ext/signals.py", line 96, in signal_emit
    fnc(signal)
  File "/usr/lib/python3.1/site-packages/ranger/core/actions.py", line 616, in on_after
    data[(-1, -1)] = open(path, 'r').read(1024 * 32)
  File "/usr/lib/python3.1/codecs.py", line 300, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 39-40: invalid data

Ranger crashed.  Please report this (including the traceback) at:
http://savannah.nongnu.org/bugs/?group= … nc=additem

Thanks smile

Offline

#606 2010-10-24 15:03:15

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Ranger, a textbased filemanager

And another question: I'm guessing you use scope.sh? Does this occur if you turn off scope? (e.g. by renaming scope.sh)

Until this is fixed (which might take a while), try using python2.6. It should work there.
(Edit PKGBUILD, replace "python" with "python2")

Last edited by hut (2010-10-24 15:03:49)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#607 2010-10-24 15:09:29

Sirsurthur
Member
Registered: 2009-02-02
Posts: 124

Re: Ranger, a textbased filemanager

Indeed I am using scope.sh. By renaiming it, ranger does not crash anymore but it still does not show any preview of this .srt files. For now, I am indeed using ranger with python 3.0.

I guess I will stay with ranger/python3 for now. It's not that a big issue but wanted you to be aware of it.

Thanks for your answers,
Sirsurthur

----
Edit : for your information, I also got this crash during a .pdf preview :

ranger --debug
Traceback (most recent call last):
  File "/usr/lib/python3.1/site-packages/ranger/core/main.py", line 85, in main
    fm.loop()
  File "/usr/lib/python3.1/site-packages/ranger/core/fm.py", line 190, in loop
    loader.work()
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 234, in work
    self.fm.notify(err)
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 229, in work
    next(item.load_generator)
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 98, in generate
    read = read.decode('utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 511: unexpected end of data

Last edited by Sirsurthur (2010-10-24 15:12:34)

Offline

#608 2010-10-24 15:26:11

sefsinalas
Member
From: Salta - Argentina
Registered: 2010-06-13
Posts: 14
Website

Re: Ranger, a textbased filemanager

how can i set wich application open each file?

Offline

#609 2010-10-24 15:36:04

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Ranger, a textbased filemanager

Sirsurthur wrote:

ranger --debug
Traceback (most recent call last):
  File "/usr/lib/python3.1/site-packages/ranger/core/main.py", line 85, in main
    fm.loop()
  File "/usr/lib/python3.1/site-packages/ranger/core/fm.py", line 190, in loop
    loader.work()
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 234, in work
    self.fm.notify(err)
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 229, in work
    next(item.load_generator)
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 98, in generate
    read = read.decode('utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 511: unexpected end of data

Aw. That looks bad. Did I mention that I hate encoding stuff?
Thanks for taking your time to report the bugs.

sefsinalas wrote:

how can i set wich application open each file?

First, run this:

ranger --copy-config=apps

And then edit ~/.config/ranger/apps.py.

There's documentation:
1. inside the file (~/.config/ranger/apps.py)
2. in the help chapter 2. Type "2?" in ranger

Last edited by hut (2010-10-24 15:39:28)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#610 2010-10-24 16:10:17

sefsinalas
Member
From: Salta - Argentina
Registered: 2010-06-13
Posts: 14
Website

Re: Ranger, a textbased filemanager

when i make ranger --copy-config=apps this is the result:

Usage: ranger [options] [path/filename]
ranger: error: no such option: --copy-config

and now?

Offline

#611 2010-10-24 16:24:42

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Ranger, a textbased filemanager

sefsinalas wrote:

when i make ranger --copy-config=apps this is the result:

Usage: ranger [options] [path/filename]
ranger: error: no such option: --copy-config

and now?

Oh. Okay, then try:

cp /usr/lib/python3.1/site-packages/ranger/defaults/apps.py ~/.config/ranger/apps.py

If this doesn't work, you can also type this in ranger =P

gRfdejyycd~/.config/ranger<ENTER>pp

"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#612 2010-10-24 18:40:19

zeltak
Member
From: New England
Registered: 2010-08-07
Posts: 168

Re: Ranger, a textbased filemanager

Hi hut

using your excellent advice i have a keyboard short (and command) to unpack files using atool. if anyone is interested its mapped to au:

map('au', fm.execute_console('shell aunpack %s'))


for the packing its a bit tricky since the apack command (apack myarchive.zip foo bar) expects a file name for the packed file in addition to the marked files.


is there a macro or other method i can use that will give the archive the name of the folder/first file slected to the packed files so i can use that? i currently have this:

map('ap', fm.execute_console('shell apack %s')) but i missing the file name part..any ideas?

thx

zeltak

Offline

#613 2010-10-24 19:23:41

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Ranger, a textbased filemanager

The simple way would be to modify the "@" binding:

map('@', fm.open_console('shell  %s', position=len('shell ')))

turn that into

map('ap', fm.open_console('shell apack  %s', position=len('shell apack ')))

Now you just have to type in the name for the package.

The thing you described needs a custom python function.


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#614 2010-10-24 19:50:21

zeltak
Member
From: New England
Registered: 2010-08-07
Posts: 168

Re: Ranger, a textbased filemanager

Thx hut, its perfect now smile

if you add a wiki to the site i can add the copy path and archive stuff to it smile

ranger is just perfection

thx

zeltaj

Offline

#615 2010-10-26 08:16:19

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Ranger, a textbased filemanager

Hi Hut, I have some new stuff for you to fix big_smile

I wanted to rename a file. The new name included a german umlaut (äöü), but ranger doesn't do this right. I think I remember that it used to work. Could you please fix that?

And there's something which would be very cool. Could you implement ranger to recognize, that it's started on tty and if so, ranger should use other applications, e.g. a tool named fbi for images, mplayer -vo fbdev2 for video etc. That would be very cool! smile But of course this shouldn't be a high priority, I just wanted to show the idea.

Offline

#616 2010-10-26 09:43:06

mentat
Member
From: France
Registered: 2009-01-13
Posts: 138
Website

Re: Ranger, a textbased filemanager

Hello Hut,

Can I suggest a new mouvement key for tab management:

gN : create a new tab with a defined path of the actual screen/tab (where you have typed the mouvement key).

Thx again for your work on ranger, the ultimate filemanager !

Offline

#617 2010-10-26 14:17:03

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Ranger, a textbased filemanager

zeltak wrote:

if you add a wiki to the site i can add the copy path and archive stuff to it smile

I think savannah only allows static content.
Perhaps we should use the github wiki for that?
Dunno.


Army wrote:

Hi Hut, I have some new stuff for you to fix big_smile

I wanted to rename a file. The new name included a german umlaut (äöü), but ranger doesn't do this right. I think I remember that it used to work. Could you please fix that?

Okay. Thats another python3 related encoding issue, I'll deal with that some other day.


Army wrote:

And there's something which would be very cool. Could you implement ranger to recognize, that it's started on tty and if so, ranger should use other applications, e.g. a tool named fbi for images, mplayer -vo fbdev2 for video etc. That would be very cool! smile But of course this shouldn't be a high priority, I just wanted to show the idea.

Are you familiar with manipulating apps.py?
Just add something like this to branch off between situations with and without X:

if 'DISPLAY' in os.environ:

(If it says os is undefined, add an "import os" first.)


mentat wrote:

Hello Hut,

Can I suggest a new mouvement key for tab management:

gN : create a new tab with a defined path of the actual screen/tab (where you have typed the mouvement key).

Thx again for your work on ranger, the ultimate filemanager !

Try gn`` or gn''


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#618 2010-10-26 15:40:07

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Ranger, a textbased filemanager

hut wrote:

Are you familiar with manipulating apps.py?
Just add something like this to branch off between situations with and without X:

if 'DISPLAY' in os.environ:

(If it says os is undefined, add an "import os" first.)

I was capable to edit the apps.py for my needs, but this tty vs xorg thing is too much for me, I don't know python that well. But thanks for these hints, I'll give it a try. Thanks!!

Last edited by Army (2010-10-26 15:40:20)

Offline

#619 2010-10-27 15:53:39

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Ranger, a textbased filemanager

Wow, that was easier than I expected, just took me two minutes smile Thanks a lot hut!

Offline

#620 2010-10-27 22:04:51

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Ranger, a textbased filemanager

JohannesSM64 wrote:

make Ranger's S set os.environ['PS1'], and make your shell rc a) not set PS1 if it's already set or b) append to it smile

Ack, I'm having trouble figuring out how to do this (different PS1 when in shell from hitting 'S')....I get the concept, but the execution is kicking my butt!

Thanks!
Scott

Last edited by firecat53 (2010-10-27 22:05:31)

Offline

#621 2010-10-27 22:15:53

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Ranger, a textbased filemanager

keys.py:

import os
map = keymanager.get_context('browser')
@map('S')
def betterS(arg):
    os.environ['RANGER_PS'] = 'RANGER $ '
    arg.fm.execute_command(os.environ['SHELL'])

.bashrc:

[ -z "$RANGER_PS" ] || PS1="$RANGER_PS"

Last edited by hut (2010-10-27 22:16:18)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#622 2010-10-27 22:18:49

sefsinalas
Member
From: Salta - Argentina
Registered: 2010-06-13
Posts: 14
Website

Re: Ranger, a textbased filemanager

how can i do to delete with the "Supr" key? and without the cuestion "Seriously?" ?

Offline

#623 2010-10-27 22:23:32

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Ranger, a textbased filemanager

sefsinalas wrote:

how can i do to delete with the "Supr" key? and without the cuestion "Seriously?" ?

The super key (windows key, right?) is technically not supported. I think even the terminal can't recognize it.


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#624 2010-10-27 22:25:02

sefsinalas
Member
From: Salta - Argentina
Registered: 2010-06-13
Posts: 14
Website

Re: Ranger, a textbased filemanager

nono...the "Del" key. The normal key to delete files in X11

Offline

#625 2010-10-27 22:30:06

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Ranger, a textbased filemanager

@hut:   Thanks! That works perfectly. Any idea how to get the escape codes to pass through for current directory, etc.? I tried using the unidecode module to process the values, but that didn't work.

Thanks!
Scott

Edit: Solved. I just set the Ranger PS1 with escape codes in .bashrc instead of setting it = RANGER_PS1.

Last edited by firecat53 (2010-10-27 22:45:15)

Offline

Board footer

Powered by FluxBB