commit cec21870109dbe081a8efd3e8d1a61317f88a99c
parent 190f733de23c44a8f216ad1d796df7a58c01499b
Author: thomasv <thomasv@gitorious>
Date: Sun, 3 Mar 2013 16:33:09 +0100
add plugins to package
Diffstat:
2 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/gui/gui_classic.py b/gui/gui_classic.py
@@ -326,14 +326,16 @@ class ElectrumWindow(QMainWindow):
# plugins
def init_plugins(self):
+ import imp, pkgutil
if os.path.exists("plugins"):
- import imp, pkgutil
fp, pathname, description = imp.find_module('plugins')
imp.load_module('electrum_plugins', fp, pathname, description)
plugin_names = [name for a, name, b in pkgutil.iter_modules(['plugins'])]
self.plugins = map(lambda name: imp.load_source('electrum_plugins.'+name, os.path.join(pathname,name+'.py')), plugin_names)
else:
- self.plugins = []
+ import electrum_plugins
+ plugin_names = [name for a, name, b in pkgutil.iter_modules(electrum_plugins.__path__)]
+ self.plugins = [ __import__('electrum_plugins.'+name, fromlist=['electrum_plugins']) for name in plugin_names]
self.plugin_hooks = {}
for p in self.plugins:
@@ -2041,25 +2043,25 @@ class ElectrumWindow(QMainWindow):
grid_raw.setRowStretch(3,1)
# plugins
- tab5 = QWidget()
- grid_plugins = QGridLayout(tab5)
- grid_plugins.setColumnStretch(0,1)
- tabs.addTab(tab5, _('Plugins') )
- def mk_toggle(cb, p):
- return lambda: cb.setChecked(p.toggle(self))
- for i, p in enumerate(self.plugins):
- try:
- name, description = p.get_info()
- cb = QCheckBox(name)
- cb.setChecked(p.is_enabled())
- cb.stateChanged.connect(mk_toggle(cb,p))
- grid_plugins.addWidget(cb, i, 0)
- grid_plugins.addWidget(HelpButton(description), i, 2)
- except:
- print_msg("Error: cannot display plugin", p)
- traceback.print_exc(file=sys.stdout)
-
- grid_plugins.setRowStretch(i+1,1)
+ if self.plugins:
+ tab5 = QWidget()
+ grid_plugins = QGridLayout(tab5)
+ grid_plugins.setColumnStretch(0,1)
+ tabs.addTab(tab5, _('Plugins') )
+ def mk_toggle(cb, p):
+ return lambda: cb.setChecked(p.toggle(self))
+ for i, p in enumerate(self.plugins):
+ try:
+ name, description = p.get_info()
+ cb = QCheckBox(name)
+ cb.setChecked(p.is_enabled())
+ cb.stateChanged.connect(mk_toggle(cb,p))
+ grid_plugins.addWidget(cb, i, 0)
+ grid_plugins.addWidget(HelpButton(description), i, 2)
+ except:
+ print_msg("Error: cannot display plugin", p)
+ traceback.print_exc(file=sys.stdout)
+ grid_plugins.setRowStretch(i+1,1)
vbox.addLayout(ok_cancel_buttons(d))
d.setLayout(vbox)
diff --git a/setup.py b/setup.py
@@ -45,7 +45,7 @@ data_files += [
setup(name = "Electrum",
version = version.ELECTRUM_VERSION,
install_requires = ['slowaes','ecdsa'],
- package_dir = {'electrum': 'lib', 'electrum_gui': 'gui'},
+ package_dir = {'electrum': 'lib', 'electrum_gui': 'gui', 'electrum_plugins':'plugins'},
scripts= ['electrum'],
data_files = data_files,
py_modules = ['electrum.version',
@@ -70,11 +70,14 @@ setup(name = "Electrum",
'electrum_gui.exchange_rate',
'electrum_gui.icons_rc',
'electrum_gui.pyqrnative',
- 'electrum_gui.qrscanner',
+ 'electrum_gui.qrcodewidget',
'electrum_gui.history_widget',
'electrum_gui.receiving_widget',
'electrum_gui.bmp',
- 'electrum_gui.i18n'],
+ 'electrum_gui.i18n',
+ 'electrum_plugins.pointofsale',
+ 'electrum_plugins.qrscanner',
+ ],
description = "Lightweight Bitcoin Wallet",
author = "ecdsa",
author_email = "ecdsa@github",