mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
attempt fixing jumpapplet, even though I think nobody uses it :)
This commit is contained in:
parent
8069ebf7e3
commit
48d2e68f4e
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
tags
|
||||
*.pyc
|
||||
*~
|
||||
*.tar.gz
|
||||
*.patch
|
||||
|
12
autojump
12
autojump
@ -141,6 +141,13 @@ def open_dic(dic_file, error_recovery=False):
|
||||
return open_dic(dic_file, True)
|
||||
else: return {} #if everything fails, return an empty file
|
||||
|
||||
def get_dic_file():
|
||||
if CONFIG_DIR == os.path.expanduser("~"):
|
||||
dic_file = CONFIG_DIR+"/.autojump_py"
|
||||
else:
|
||||
dic_file = CONFIG_DIR+"/autojump_py"
|
||||
return dic_file
|
||||
|
||||
def shell_utility():
|
||||
"""Run this when autojump is called as a shell utility"""
|
||||
try:
|
||||
@ -150,10 +157,7 @@ def shell_utility():
|
||||
print("Unknown command line argument: %s" % ex)
|
||||
exit(1)
|
||||
|
||||
if CONFIG_DIR == os.path.expanduser("~"):
|
||||
dic_file = CONFIG_DIR+"/.autojump_py"
|
||||
else:
|
||||
dic_file = CONFIG_DIR+"/autojump_py"
|
||||
dic_file = get_dic_file()
|
||||
path_dict = open_dic(dic_file)
|
||||
if ('-a', '') in optlist:
|
||||
# The home dir can be reached quickly by "cd"
|
||||
|
1
autojump.py
Symbolic link
1
autojump.py
Symbolic link
@ -0,0 +1 @@
|
||||
autojump
|
13
jumpapplet
13
jumpapplet
@ -24,6 +24,7 @@ import sys
|
||||
import pygtk
|
||||
pygtk.require('2.0')
|
||||
import gtk
|
||||
from autojump import open_dic,get_dic_file
|
||||
|
||||
defaults={}
|
||||
actions={}
|
||||
@ -57,19 +58,11 @@ def has_child_file(filename):
|
||||
return wrapper
|
||||
|
||||
#do the work
|
||||
def load_paths(filename="~/.autojump_py",maxpath=10):
|
||||
dic_file=os.path.expanduser(filename)
|
||||
|
||||
try:
|
||||
aj_file=open(dic_file)
|
||||
path_dict=cPickle.load(aj_file)
|
||||
aj_file.close()
|
||||
def load_paths(maxpath=10):
|
||||
path_dict=open_dic(get_dic_file())
|
||||
path_dict=path_dict.items()
|
||||
path_dict.sort(key=lambda x: x[1],reverse=True)
|
||||
|
||||
return [path for path,score in path_dict[:maxpath]]
|
||||
except IOError:
|
||||
return []
|
||||
|
||||
def load_settings_file(filename="~/.jumpapplet_py"):
|
||||
print "loading settings"
|
||||
|
Loading…
Reference in New Issue
Block a user