# Path: hashmal_lib/gui_utils.py
# def floated_buttons(btns, left=False):
#     """Returns a HBoxLayout with buttons floated to the right or left."""
#     hbox = QHBoxLayout()
#     for b in btns:
#         hbox.addWidget(b)
#     if left:
#         hbox.addStretch(1)
#     else:
#         hbox.insertStretch(0, 1)
#     return hbox
# 
# def HBox(*widgets):
#     """Create an HBoxLayout with the widgets passed."""
#     hbox = QHBoxLayout()
#     for w in widgets:
#         hbox.addWidget(w)
#     return hbox
# 
# Path: hashmal_lib/core/utils.py
# def is_hex(x):
#     try:
#         i = int(x, 16)
#         return True
#     except ValueError:
#         pass
#     return False


from collections import OrderedDict, namedtuple
from PyQt4.QtGui import *
from PyQt4 import QtCore
from base import BaseDock, Plugin, augmenter
from item_types import ItemAction, item_types
from hashmal_lib.gui_utils import floated_buttons, HBox
from hashmal_lib.core.utils import is_hex
        self.view = QTableView()
        self.view.setWhatsThis('This table displays the variables you have defined.')
        self.view.setModel(self.proxy_model)
        self.view.setSortingEnabled(True)
        self.view.sortByColumn(0, QtCore.Qt.AscendingOrder)
        self.view.horizontalHeader().setResizeMode(1, QHeaderView.Stretch)
        self.view.horizontalHeader().setHighlightSections(False)
        self.view.verticalHeader().setDefaultSectionSize(22)
        self.view.verticalHeader().setVisible(False)
        self.view.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.view.customContextMenuRequested.connect(self.context_menu)
        self.view.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding))
        self.view.setSelectionMode(QAbstractItemView.SingleSelection)
        self.view.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.view.setAlternatingRowColors(True)

        form.addRow(self.create_filters_box())
        form.addRow(self.view)

        # Controls for adding/removing variables

        self.new_var_key = QLineEdit()
        self.new_var_key.setPlaceholderText('Key')
        self.new_var_key.setWhatsThis('Enter the name to give the new variable here.')
        self.setFocusProxy(self.new_var_key)
        self.new_var_value = QLineEdit()
        self.new_var_value.setPlaceholderText('Value')
        self.new_var_value.setWhatsThis('Enter the value to give the new variable here.')
        add_var_btn = QPushButton('&Add')
        add_var_btn.clicked.connect(self.add_new_var)

# Path: hashmal_lib/gui_utils.py
# def floated_buttons(btns, left=False):
#     """Returns a HBoxLayout with buttons floated to the right or left."""
#     hbox = QHBoxLayout()
#     for b in btns:
#         hbox.addWidget(b)
#     if left:
#         hbox.addStretch(1)
#     else:
#         hbox.insertStretch(0, 1)
#     return hbox
# 
# def HBox(*widgets):
#     """Create an HBoxLayout with the widgets passed."""
#     hbox = QHBoxLayout()
#     for w in widgets:
#         hbox.addWidget(w)
#     return hbox
# 
# Path: hashmal_lib/core/utils.py
# def is_hex(x):
#     try:
#         i = int(x, 16)
#         return True
#     except ValueError:
#         pass
#     return False


# Path: hashmal_lib/plugins/variables.py
from collections import OrderedDict, namedtuple
from PyQt4.QtGui import *
from PyQt4 import QtCore
from base import BaseDock, Plugin, augmenter
from item_types import ItemAction, item_types
from hashmal_lib.gui_utils import floated_buttons, HBox
from hashmal_lib.core.utils import is_hex

        self.view = QTableView()
        self.view.setWhatsThis('This table displays the variables you have defined.')
        self.view.setModel(self.proxy_model)
        self.view.setSortingEnabled(True)
        self.view.sortByColumn(0, QtCore.Qt.AscendingOrder)
        self.view.horizontalHeader().setResizeMode(1, QHeaderView.Stretch)
        self.view.horizontalHeader().setHighlightSections(False)
        self.view.verticalHeader().setDefaultSectionSize(22)
        self.view.verticalHeader().setVisible(False)
        self.view.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.view.customContextMenuRequested.connect(self.context_menu)
        self.view.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding))
        self.view.setSelectionMode(QAbstractItemView.SingleSelection)
        self.view.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.view.setAlternatingRowColors(True)

        form.addRow(self.create_filters_box())
        form.addRow(self.view)

        # Controls for adding/removing variables

        self.new_var_key = QLineEdit()
        self.new_var_key.setPlaceholderText('Key')
        self.new_var_key.setWhatsThis('Enter the name to give the new variable here.')
        self.setFocusProxy(self.new_var_key)
        self.new_var_value = QLineEdit()
        self.new_var_value.setPlaceholderText('Value')
        self.new_var_value.setWhatsThis('Enter the value to give the new variable here.')
        add_var_btn = QPushButton('&Add')
        add_var_btn.clicked.connect(self.add_new_var)

        add_var_hbox = HBox(self.new_var_key, QLabel(':'), self.new_var_value, add_var_btn)