Skip to content

Commit

Permalink
Update browsepy.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor committed Sep 4, 2014
1 parent 5830ded commit bc71148
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions browsepy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@

import ui
import os
import imp
import sys
import json
import apps

def reload_all(mod, name):
reload(mod)
for mod in sys.modules:
if mod.startswith("{}.".format(name)):
rmod = sys.modules[mod]
if rmod:
reload(rmod)

reload_all(apps, "apps")

appsfn = "apps.json"
appsdir = "apps"
Expand All @@ -17,12 +28,13 @@

if not os.path.exists(appsdir):
os.mkdir(appsdir)
with open(os.path.join(appsdir, "__init__.py"), "w"):
pass

apps = {}
_apps = __import__("apps", fromlist=[str(i) for i in appnames.keys()])
for name, exts in appnames.items():
path = os.path.join(os.getcwd(), appsdir, "{}".format(name))
App = imp.load_source("{}".format(name, path), path).App
apps[App] = exts
apps[getattr(_apps, name).App] = exts

class Delegate(object):
def __init__(self):
Expand Down

0 comments on commit bc71148

Please sign in to comment.