From 88ac4239f3f1708b6e6d476a253e55011852cd57 Mon Sep 17 00:00:00 2001 From: Yang Date: Sun, 16 Sep 2018 14:21:04 +0200 Subject: [PATCH] Try to solve the imcompatable problem from https://github.com/mazaclub/hashmal/pull/5 --- .gitignore | 3 +++ README.md | 22 ++++++++++++++++++++++ hashmal_lib/__init__.py | 6 ++---- hashmal_lib/entry_points.py | 16 ++++++++++++++++ hashmal_lib/gui_utils.py | 17 +---------------- requirements.txt | 1 + setup.py | 2 +- 7 files changed, 46 insertions(+), 21 deletions(-) create mode 100644 hashmal_lib/entry_points.py diff --git a/.gitignore b/.gitignore index 60cb2be..920238d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ *.coinscript *.conf Hashmal*.egg-info +# Built package +build/ +dist/ diff --git a/README.md b/README.md index 11fe3c8..611099a 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,28 @@ Hashmal is intended for cryptocurrency developers and power users. - When editing scripts, put something in double quotation marks to ensure it's interpreted as text rather than hex data. - You can quickly evaluate the script you're working on via *Script > Evaluate* in the menubar. +## Libraries +To run the application you must use / have installed: + - Python 2.7 + - PyQt4 + ### PyQt4 +You can install PyQt4 if you use Anaconda with the following command +``` +conda install pyqt=4 +``` +If you use Debian / Ubuntu, you can use the following command +``` +sudo apt install pyqt4-dev-tools +``` +Installation instructions for other platforms: +[https://www.riverbankcomputing.com/software/pyqt/download](https://www.riverbankcomputing.com/software/pyqt/download) + ### Installation +After that, use `setup.py` to build / install the application +``` +python setup.py install +``` +This will install the external module requirements listed in `requirements.txt` too + ## Documentation See the file `doc/usage.adoc` for basic instructions. See the [Hashmal wiki on Github](https://github.com/mazaclub/hashmal/wiki) for details. diff --git a/hashmal_lib/__init__.py b/hashmal_lib/__init__.py index 9c9758a..6100725 100644 --- a/hashmal_lib/__init__.py +++ b/hashmal_lib/__init__.py @@ -1,16 +1,14 @@ import sys -from PyQt4.QtGui import QApplication - -from main_window import HashmalMain - class HashmalGui(object): def __init__(self): + from PyQt4.QtGui import QApplication super(HashmalGui, self).__init__() self.app = QApplication(sys.argv) def main(self): + from main_window import HashmalMain self.main_window = HashmalMain(self.app) self.main_window.show() sys.exit(self.app.exec_()) diff --git a/hashmal_lib/entry_points.py b/hashmal_lib/entry_points.py new file mode 100644 index 0000000..afcb46b --- /dev/null +++ b/hashmal_lib/entry_points.py @@ -0,0 +1,16 @@ +hashmal_entry_points = { + 'hashmal.plugin': [ + 'Address Encoder = hashmal_lib.plugins.addr_encoder:make_plugin', + 'Block Analyzer = hashmal_lib.plugins.block_analyzer:make_plugin', + 'Blockchain = hashmal_lib.plugins.blockchain:make_plugin', + 'Chainparams = hashmal_lib.plugins.chainparams:make_plugin', + 'Item Types = hashmal_lib.plugins.item_types:make_plugin', + 'Log = hashmal_lib.plugins.log:make_plugin', + 'Script Generator = hashmal_lib.plugins.script_gen:make_plugin', + 'Stack Evaluator = hashmal_lib.plugins.stack:make_plugin', + 'Transaction Analyzer = hashmal_lib.plugins.tx_analyzer:make_plugin', + 'Transaction Builder = hashmal_lib.plugins.tx_builder:make_plugin', + 'Variables = hashmal_lib.plugins.variables:make_plugin', + 'Wallet RPC = hashmal_lib.plugins.wallet_rpc:make_plugin' + ] +} diff --git a/hashmal_lib/gui_utils.py b/hashmal_lib/gui_utils.py index b9d33c4..5518a1d 100644 --- a/hashmal_lib/gui_utils.py +++ b/hashmal_lib/gui_utils.py @@ -243,22 +243,7 @@ def setReadOnly( self, state ): readOnly = QtCore.pyqtProperty(bool, isReadOnly, setReadOnly) -hashmal_entry_points = { - 'hashmal.plugin': [ - 'Address Encoder = hashmal_lib.plugins.addr_encoder:make_plugin', - 'Block Analyzer = hashmal_lib.plugins.block_analyzer:make_plugin', - 'Blockchain = hashmal_lib.plugins.blockchain:make_plugin', - 'Chainparams = hashmal_lib.plugins.chainparams:make_plugin', - 'Item Types = hashmal_lib.plugins.item_types:make_plugin', - 'Log = hashmal_lib.plugins.log:make_plugin', - 'Script Generator = hashmal_lib.plugins.script_gen:make_plugin', - 'Stack Evaluator = hashmal_lib.plugins.stack:make_plugin', - 'Transaction Analyzer = hashmal_lib.plugins.tx_analyzer:make_plugin', - 'Transaction Builder = hashmal_lib.plugins.tx_builder:make_plugin', - 'Variables = hashmal_lib.plugins.variables:make_plugin', - 'Wallet RPC = hashmal_lib.plugins.wallet_rpc:make_plugin' - ] -} +from entry_points import hashmal_entry_points required_plugins = ['Chainparams', 'Item Types', 'Log', 'Stack Evaluator', 'Variables'] diff --git a/requirements.txt b/requirements.txt index 282ac3a..c6e8c2a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ python-bitcoinlib pyparsing +requests diff --git a/setup.py b/setup.py index 319875d..a59b774 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ from setuptools import setup -from hashmal_lib.gui_utils import hashmal_entry_points +from hashmal_lib.entry_points import hashmal_entry_points with open('requirements.txt') as f: requirements = f.readlines()