You are not logged in.

#1076 2011-09-30 16:54:24

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

Re: Ranger, a textbased filemanager

Some news: I simplified the keybinding module which should reduce rangers startup time by about 40%. (PS: or rather, this fixes the startup time increase of another recent patch...)

Additionally, the configuration file "keys.py" is now obsolete. Keybindings are defined with the :map command instead of using python code.

:map <key> <command>

You can put your map commands into the new configuration file ~/.config/ranger/rc.conf. This file simply contains a list of commands which are executed on startup. Get the default one here or by running "ranger --copy-config=rc".

Bear with me, some things do not work 100% yet and the man page is outdated.

Last edited by hut (2011-09-30 23:04:40)


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

Offline

#1077 2011-09-30 18:20:57

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

Re: Ranger, a textbased filemanager

Hi Hut,

With latest updates, I get following bugs :

ranger
Ranger version: 1.4.3, executed with python 3.2.2
Locale: fr_FR.UTF-8
Current file: None
Traceback (most recent call last):
  File "/usr/lib/python3.2/site-packages/ranger/container/settingobject.py", line 86, in __getattr__
    return self._settings[name]
KeyError: '__call__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.2/site-packages/ranger/core/main.py", line 79, in main
    load_settings(fm, arg.clean)
  File "/usr/lib/python3.2/site-packages/ranger/core/helper.py", line 98, in load_settings
    comcont.load_commands_from_object(fm, dir(Actions))
  File "/usr/lib/python3.2/site-packages/ranger/api/commands.py", line 60, in load_commands_from_object
    if hasattr(attribute, '__call__'):
  File "/usr/lib/python3.2/site-packages/ranger/container/settingobject.py", line 94, in __getattr__
    " in the defaults!".format(name))
Exception: The option `__call__' was not defined in the defaults!

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


and


ranger --copy-config=rc
creating: /home/julien/.config/ranger/rc.conf
  ERROR: [Errno 2] Aucun fichier ou dossier de ce type: '/usr/lib/python3.2/site-packages/ranger/defaults/rc.conf'


Hope it helps.

Sirsurthur

Offline

#1078 2011-09-30 19:54:50

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

Re: Ranger, a textbased filemanager

Fixed, thanks for the report


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

Offline

#1079 2011-09-30 19:57:41

Veedrac
Member
Registered: 2011-07-19
Posts: 81

Re: Ranger, a textbased filemanager

EDIT: Ninja'd, sorry.

Last edited by Veedrac (2011-09-30 19:58:03)

Offline

#1080 2011-10-01 00:15:49

Revolt
Member
From: Portugal
Registered: 2009-06-11
Posts: 71
Website

Re: Ranger, a textbased filemanager

Since you're on a development spree, could you look into the uwid function on utfwidth.py?

On my system, if you browse to a folder with an accent like 'Prática' and you have multiple tabs open, you can't see some or all of the tab numbers. I've pinpointed the culprit to being the use of utf_byte_length which, on a python3 code, shouldn't be used since all strings are unicode by default and accessing them by index should already take into account their byte size (afaik). In particular, 'á' is marked as having a byte length of 2 and, therefore, the string slice will result in 'át' (if I'm not mistaken) which seems to mess up the calculations.

By replacing all instances of bytelen with 1 on that function, everything works ok. I've seen that you added some python3 specific code on some parts of the code so maybe you could add a special case there aswell?

Last edited by Revolt (2011-10-01 00:18:16)

Offline

#1081 2011-10-01 03:35:55

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

Re: Ranger, a textbased filemanager

Revolt wrote:

Since you're on a development spree, could you look into the uwid function on utfwidth.py?

On my system, if you browse to a folder with an accent like 'Prática' and you have multiple tabs open, you can't see some or all of the tab numbers. I've pinpointed the culprit to being the use of utf_byte_length which, on a python3 code, shouldn't be used since all strings are unicode by default and accessing them by index should already take into account their byte size (afaik). In particular, 'á' is marked as having a byte length of 2 and, therefore, the string slice will result in 'át' (if I'm not mistaken) which seems to mess up the calculations.

By replacing all instances of bytelen with 1 on that function, everything works ok. I've seen that you added some python3 specific code on some parts of the code so maybe you could add a special case there aswell?

Thanks for the hint. It would be good to know which python version you use, (I tried 2.6, 3.1 and 3.2; all of them produce different results) and which changes you did exactly.

Maybe I should also mention that unicode in ranger currently works best with python 2.6 and I don't remember having any problems with it in a long time.


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

Offline

#1082 2011-10-01 08:21:20

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

Re: Ranger, a textbased filemanager

Hi Hut,

Thanks for the updates ! I like the new "statusbar" that works like a popup window. Shall the bookmarks appear in the same window (and not at the left up corner) ?

Best regards,
Sirsurthur

Offline

#1083 2011-10-01 09:42:24

Revolt
Member
From: Portugal
Registered: 2009-06-11
Posts: 71
Website

Re: Ranger, a textbased filemanager

hut wrote:

Thanks for the hint. It would be good to know which python version you use, (I tried 2.6, 3.1 and 3.2; all of them produce different results) and which changes you did exactly.

Maybe I should also mention that unicode in ranger currently works best with python 2.6 and I don't remember having any problems with it in a long time.

Using 3.2.2 here.

I think I just found something on the >=2.4 python lib that seems to do exactly what the utfwidth.py tries to do.

Take a look at the following pages, specifically, the east_asian_width function:
http://docs.python.org/library/unicoded … nicodedata
http://docs.python.org/py3k/library/uni … nicodedata
http://unicode.org/reports/tr11/

Offline

#1084 2011-10-01 16:36:37

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

Re: Ranger, a textbased filemanager

Revolt wrote:
hut wrote:

Thanks for the hint. It would be good to know which python version you use, (I tried 2.6, 3.1 and 3.2; all of them produce different results) and which changes you did exactly.

Maybe I should also mention that unicode in ranger currently works best with python 2.6 and I don't remember having any problems with it in a long time.

Using 3.2.2 here.

I think I just found something on the >=2.4 python lib that seems to do exactly what the utfwidth.py tries to do.

Take a look at the following pages, specifically, the east_asian_width function:
http://docs.python.org/library/unicoded … nicodedata
http://docs.python.org/py3k/library/uni … nicodedata
http://unicode.org/reports/tr11/

Nice, that makes much of my code obsolete.

I fixed things and unicode works well in these places now: directory listing, statusbar, titlebar, console (input, output, cursor movement).

Can you please confirm this? Especially with japanese characters? (レンジャ)

Last edited by hut (2011-10-01 16:40:00)


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

Offline

#1085 2011-10-01 18:18:57

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

Re: Ranger, a textbased filemanager

Hey hut, nice new code, I like it! Great to see that you are still active on ranger.

Offline

#1086 2011-10-01 19:37:51

PotatoesMaster
Member
From: France
Registered: 2010-08-26
Posts: 54

Re: Ranger, a textbased filemanager

@hut:
Thanks again for your work. wink

This may help you to track bugs:

There are no bindings on log screen, so we are stuck after pressing `W`.

Typo spotted in rc.conf: map yn shell -d echo -n %%f   | xsel -i
narg=quantifier is missing to bindings dd, da, dr, yy, ya and yr. This breaks these bindings when used without a quantifier sad


Executing ranger -c results as:

Traceback (most recent call last):
  File "/usr/lib/python3.2/site-packages/ranger/core/main.py", line 79, in main
    load_settings(fm, arg.clean)
  File "/usr/lib/python3.2/site-packages/ranger/core/helper.py", line 168, in load_settings
    from ranger.defaults import commands, keys, apps
ImportError: cannot import name keys

An other error occurs after removing 'keys' from the import line above.

and ranger --list-unused-keys:

Traceback (most recent call last):
  File "/usr/lib/python3.2/site-packages/ranger/core/main.py", line 85, in main
    for key in sorted(special_keys.values()):
TypeError: unorderable types: int() < tuple()

Last edited by PotatoesMaster (2011-10-01 19:51:57)

Offline

#1087 2011-10-01 20:05:33

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

Re: Ranger, a textbased filemanager

Thank you for looking over it.

Normally, narg=quantifier is added for you by ranger, but that mechanism had a little bug. You only have to add it manually when using the eval command.

I fixed/am fixing the other things, thanks again.


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

Offline

#1088 2011-10-02 01:34:16

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Ranger, a textbased filemanager

hut wrote:

Can you please confirm this? Especially with japanese characters? (レンジャ)

It's working hut, I tried it with CJK character.

There's a problem with ranger when using

draw_borders = True

Error message

Ranger version: 1.4.3, executed with python 3.2.2
Locale: en_US.UTF-8
Current file: /home/igndenok/Desktop
Traceback (most recent call last):
  File "/usr/lib/python3.2/site-packages/ranger/core/main.py", line 103, in main
    fm.loop()
  File "/usr/lib/python3.2/site-packages/ranger/core/fm.py", line 198, in loop
    ui.redraw()
  File "/usr/lib/python3.2/site-packages/ranger/gui/ui.py", line 249, in redraw
    self.draw()
  File "/usr/lib/python3.2/site-packages/ranger/gui/ui.py", line 275, in draw
    DisplayableContainer.draw(self)
  File "/usr/lib/python3.2/site-packages/ranger/gui/displayable.py", line 268, in draw
    displayable.draw()
  File "/usr/lib/python3.2/site-packages/ranger/gui/widgets/browserview.py", line 103, in draw
    self._draw_borders()
AttributeError: 'BrowserView' object has no attribute '_draw_borders'

Ranger crashed.  Please report this traceback at:
http://savannah.nongnu.org/bugs/?group=ranger&func=additem

Last edited by igndenok (2011-10-02 01:41:25)


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#1089 2011-10-02 01:49:18

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

Re: Ranger, a textbased filemanager

Oops. I must have accidently removed that code. Added back in, thanks.


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

Offline

#1090 2011-10-02 06:41:31

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Ranger, a textbased filemanager

hut, still no binding in preview (display_file) pager screen (after press i)?!
Can't scroll up/down, if I press <Left> or <Right> there's an error message in statusbar

unsupported operand type(s) for +: 'NoneType' and 'int'

Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#1091 2011-10-02 12:29:19

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

Re: Ranger, a textbased filemanager

igndenok wrote:

hut, still no binding in preview (display_file) pager screen (after press i)?!
Can't scroll up/down, if I press <Left> or <Right> there's an error message in statusbar

unsupported operand type(s) for +: 'NoneType' and 'int'

I fixed it by changing the default rc.conf. Could it be that you don't see the changes because you have a custom (old) rc.conf?


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

Offline

#1092 2011-10-02 13:03:44

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

Re: Ranger, a textbased filemanager

Hut, will you tell us when everything's reimplemented in this new rc.conf style? Would be good to know, because in case I see something's missing, I don't know if you forgot it or if you just still have to add it.

In case you are already finished, will you reimplement the ability to switch between tabs with Alt+Right / Alt+Left? I prefer this over gt and gT. If you won't implement it, for all the others

map <a-right> tab_move 1
map <a-left> tab_move -1

Offline

#1093 2011-10-02 13:49:03

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Ranger, a textbased filemanager

hut wrote:
igndenok wrote:

hut, still no binding in preview (display_file) pager screen (after press i)?!
Can't scroll up/down, if I press <Left> or <Right> there's an error message in statusbar

unsupported operand type(s) for +: 'NoneType' and 'int'

I fixed it by changing the default rc.conf. Could it be that you don't see the changes because you have a custom (old) rc.conf?

You're right, it's my mistake.
Awesome. big_smile


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#1094 2011-10-02 13:54:13

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

Re: Ranger, a textbased filemanager

Army wrote:

Hut, will you tell us when everything's reimplemented in this new rc.conf style? Would be good to know, because in case I see something's missing, I don't know if you forgot it or if you just still have to add it.

In case you are already finished, will you reimplement the ability to switch between tabs with Alt+Right / Alt+Left? I prefer this over gt and gT. If you won't implement it, for all the others

map <a-right> tab_move 1
map <a-left> tab_move -1

Thanks. I am done with the rc.conf for now, so please report anything. FYI, things that I intentionally changed:
1. Removed "O" and "<F1>" in the console (redundant)
2. The keys ^V and u^V, will be replaced by a proper visual mode later.
3. the ability to type stuff like d5j, will be added later. Use 5dj for now.
4. =123 is now 123=

And the hjkl keys don't work in the log yet. Will be fixed later.


igndenok wrote:

You're right, it's my mistake.
Awesome. big_smile

I recommend to have minimal config files with only custom changes instead of copying the whole files, unless you never update :>

Last edited by hut (2011-10-02 14:41:50)


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

Offline

#1095 2011-10-02 17:11:18

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Ranger, a textbased filemanager

hut, using ranger 1.5.0
I can't create bookmark shortcut using number (because I have bookmark shortcut using number). e.g.: m1, m2, ...

hut wrote:

I recommend to have minimal config files with only custom changes instead of copying the whole files, unless you never update :>

Yeah, usually I copying the whole file and adding/modifying some. I use this approach because it's easier to look some forgotten keybinding
in my ~/.config/ranger instead /usr/lib/pythonX.Y/site-packages/ranger/defaults. Thanks for remind me smile


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#1096 2011-10-02 17:24:23

Revolt
Member
From: Portugal
Registered: 2009-06-11
Posts: 71
Website

Re: Ranger, a textbased filemanager

Loving the changes and no more utf8 problems! Nice! big_smile

Offline

#1097 2011-10-02 17:38:12

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

Re: Ranger, a textbased filemanager

igndenok wrote:

hut, using ranger 1.5.0
I can't create bookmark shortcut using number (because I have bookmark shortcut using number). e.g.: m1, m2, ...

Works now.

Revolt wrote:

Loving the changes and no more utf8 problems! Nice! big_smile

Yup, I'm happy the terror is over. I think I procrastinated that for years.


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

Offline

#1098 2011-10-02 18:05:31

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

Re: Ranger, a textbased filemanager

Great changes Hut !

Will your utf8 code changes help to preview text files with special characters (problem to decode them) ?

Best regards,

Sirsurthur

Offline

#1099 2011-10-03 02:25:30

sant527
Member
Registered: 2009-06-21
Posts: 273

Re: Ranger, a textbased filemanager

I liked ranger very much.

I have few questions. I want to view my pdf files in detached way from ranger. I want to continue back with the ranger rather than closing the pdf and then use ranger.

I found the code in the apps.py

if f.extension in ('pdf', ):
                                return self.either(c, 'foxitreader', 'okular'
, 'gimp')

what to do now.


Also I want ranger to show the size of the directories ( not the number of files) but the size in MB or GB. And I want to sort  as per this size.

Offline

#1100 2011-10-03 04:04:58

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

Re: Ranger, a textbased filemanager

sant527 wrote:
if f.extension in ('pdf', ):
                                return self.either(c, 'foxitreader', 'okular'
, 'gimp')

Between the two lines, add

c.flags += 'd'
sant527 wrote:

Also I want ranger to show the size of the directories ( not the number of files) but the size in MB or GB. And I want to sort  as per this size.

That is currently not supported


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

Offline

Board footer

Powered by FluxBB