예제 #1
0
def main():
    import sys
    import getopt
    try:
        opts, args = getopt.getopt(sys.argv[1:], "", [])
    except getopt.GetoptError:
        print "arg error"
        sys.exit(2)

    if len(args) == 0:
        args = ['help']
    # special command
    if args[0] == 'import_config':
        with open(args[1], "r") as fp:
            config = json.load(fp)
        pw = PersistentWallet(config)
        sys.exit(0)

    pw = PersistentWallet()
    try:
        pw.init_model()
    except Exception as e:
        print "failed to initialize wallet model: %s" % e

    wallet_model = pw.get_model()
    controller = WalletController(wallet_model) \
        if wallet_model else None
    interpreter = CommandInterpreter(pw, controller)

    interpreter.run_command(*args)
예제 #2
0
    def __init__(self):
        signal.signal(signal.SIGINT, signal.SIG_DFL)
        self.app = QtGui.QApplication([])

        QtGui.QMainWindow.__init__(self)
        uic.loadUi(uic.getUiPath('ngcccbase.ui'), self)

        self.overviewpage = OverviewPage()
        self.stackedWidget.addWidget(self.overviewpage)
        self.bindOverviewPage()
        self.sendcoinspage = SendcoinsPage()
        self.stackedWidget.addWidget(self.sendcoinspage)
        self.bindSendcoinsPage()

        self.bindActions()
        self.move(QtGui.QApplication.desktop().screen().rect().center() -
                  self.rect().center())
        self.show()

        self.wallet = PersistentWallet()
        self.walletController = WalletController(self.wallet.get_model())
        self.gotoOverviewPage()

        sys.exit(self.app.exec_())
예제 #3
0
 def setUp(self):
     from pwallet import PersistentWallet
     from wallet_controller import WalletController
     self.pwallet = PersistentWallet()
     self.pwallet.init_model()
예제 #4
0
This file connects ngccc-server.py to wallet_controller.py
The main functions that this file has are to take the
JSON-RPC commands from the server and pass them through to
the wallet controller.
Note console_interface.py does a similar thing for ngccc.py
to wallet_controller.py
"""

from wallet_controller import WalletController
from pwallet import PersistentWallet
import pyjsonrpc
import json

# create a global wallet for this use.
wallet = PersistentWallet()
wallet.init_model()
model = wallet.get_model()
controller = WalletController(model)


def get_asset_definition(moniker):
    """Get the asset/color associated with the moniker.
    """
    adm = model.get_asset_definition_manager()
    asset = adm.get_asset_by_moniker(moniker)
    if asset:
        return asset
    else:
        raise Exception("asset %s not found" % moniker)
예제 #5
0
This file connects ngccc-server.py to wallet_controller.py
The main functions that this file has are to take the
JSON-RPC commands from the server and pass them through to
the wallet controller.
Note console_interface.py does a similar thing for ngccc.py
to wallet_controller.py
"""

from wallet_controller import WalletController
from pwallet import PersistentWallet
import pyjsonrpc
import json

# create a global wallet for this use.
wallet = PersistentWallet(None, True)
wallet.init_model()
model = wallet.get_model()
controller = WalletController(model)


def get_asset_definition(moniker):
    """Get the asset/color associated with the moniker.
    """
    adm = model.get_asset_definition_manager()
    asset = adm.get_asset_by_moniker(moniker)
    if asset:
        return asset
    else:
        raise Exception("asset %s not found" % moniker)