# Path: hashmal_lib/gui_utils.py
# def HBox(*widgets):
# def floated_buttons(btns, left=False):
# def add_shortcuts(items):
#     def __init__(self, parent=None):
#     def sizeHint(self):
#     def __init__(self, satoshis=0):
#     def known_formats():
#     def get_str(self):
#     def __init__(self, parent=None):
#     def satoshis(self):
#     def satoshis(self, value):
#     def get_satoshis(self):
#     def set_satoshis(self, amount):
#     def check_text(self):
#     def update_format(self):
#     def on_option_changed(self, key):
#     def __init__(self, max_value=0xffffffff, parent=None):
#     def amount(self):
#     def amount(self, value):
#     def get_amount(self):
#     def set_amount(self, amount):
#     def check_text(self):
#     def __init__( self, *args ):
#     def isReadOnly( self ):
#     def mousePressEvent( self, event ):
#     def mouseMoveEvent( self, event ):
#     def mouseReleaseEvent( self, event ):
#     def keyPressEvent( self, event ):
#     def setReadOnly( self, state ):
# class Separator(QFrame):
# class Amount(object):
# class OutputAmountEdit(QLineEdit):
# class AmountEdit(QLineEdit):
# class ReadOnlyCheckBox(QtGui.QCheckBox):


from bitcoin.core import x, b2x
from bitcoin.base58 import CBase58Data
from PyQt4.QtGui import *
from base import BaseDock, Plugin, Category, augmenter
from hashmal_lib.gui_utils import monospace_font, Separator
from item_types import Item, ItemAction
            if v.startswith('0x'):
                v = v[2:]
            if len(v.decode('hex')) != 20:
                raise Exception('Value is not a hash160')
            return v

        try:
            value = ensure_hex(data)
            if value:
                return cls(value)
        except Exception:
            return None

    def raw(self):
        return self.value

class AddressItem(Item):
    name = 'Address'
    @classmethod
    def coerce_item(cls, data):
        def coerce_address(v):
            addr_data = CBase58Data(v)
            if len(v) >= 26 and len(v) <= 35:
                return addr_data

        try:
            value = coerce_address(data)
            if value:
                return cls(value)
        except Exception:

# Path: hashmal_lib/gui_utils.py
# def HBox(*widgets):
# def floated_buttons(btns, left=False):
# def add_shortcuts(items):
#     def __init__(self, parent=None):
#     def sizeHint(self):
#     def __init__(self, satoshis=0):
#     def known_formats():
#     def get_str(self):
#     def __init__(self, parent=None):
#     def satoshis(self):
#     def satoshis(self, value):
#     def get_satoshis(self):
#     def set_satoshis(self, amount):
#     def check_text(self):
#     def update_format(self):
#     def on_option_changed(self, key):
#     def __init__(self, max_value=0xffffffff, parent=None):
#     def amount(self):
#     def amount(self, value):
#     def get_amount(self):
#     def set_amount(self, amount):
#     def check_text(self):
#     def __init__( self, *args ):
#     def isReadOnly( self ):
#     def mousePressEvent( self, event ):
#     def mouseMoveEvent( self, event ):
#     def mouseReleaseEvent( self, event ):
#     def keyPressEvent( self, event ):
#     def setReadOnly( self, state ):
# class Separator(QFrame):
# class Amount(object):
# class OutputAmountEdit(QLineEdit):
# class AmountEdit(QLineEdit):
# class ReadOnlyCheckBox(QtGui.QCheckBox):


# Path: hashmal_lib/plugins/addr_encoder.py
from bitcoin.core import x, b2x
from bitcoin.base58 import CBase58Data
from PyQt4.QtGui import *
from base import BaseDock, Plugin, Category, augmenter
from hashmal_lib.gui_utils import monospace_font, Separator
from item_types import Item, ItemAction

            if v.startswith('0x'):
                v = v[2:]
            if len(v.decode('hex')) != 20:
                raise Exception('Value is not a hash160')
            return v

        try:
            value = ensure_hex(data)
            if value:
                return cls(value)
        except Exception:
            return None

    def raw(self):
        return self.value

class AddressItem(Item):
    name = 'Address'
    @classmethod
    def coerce_item(cls, data):
        def coerce_address(v):
            addr_data = CBase58Data(v)
            if len(v) >= 26 and len(v) <= 35:
                return addr_data

        try:
            value = coerce_address(data)
            if value:
                return cls(value)
        except Exception:

            return None