# Path: ui/PluginViewer.py
# class PluginViewer(PluginForm):
#     def __init__(self, title):
#         super(PluginViewer, self).__init__()
#         self.title = title
# 
#     def Show(self, **kwargs):
#         return PluginForm.Show(self, self.title, options=PluginForm.FORM_PERSIST)
# 
#     def OnCreate(self, form):
#         # Get parent widget
#         self.parent = form_to_widget(form)
#         self.PopulateForm()
# 
#     def PopulateForm(self):
#         ### do stuff
#         pass
# 
#     def OnClose(self, form):
#         msg("Closed %s.\n" % self.title)
# 
# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):


from ui.PluginViewer import PluginViewer
from ui.UIManager import QtGui, QtCore, QtWidgets
        self.stack_changes = stack_changes


    def PopulateModel(self):
        for key in self.sorted:
            sa = QtGui.QStandardItem('%s' % key)
            chg = QtGui.QStandardItem('%s' % self.stack_changes[key])

            if key in self.vr.values():
                reg = QtGui.QStandardItem('%s' % [k for k in self.vr.keys() if self.vr[k] == key][0])
            else:
                reg = QtGui.QStandardItem(' ')
            self.sim.appendRow([sa, reg, chg])


        self.treeView.resizeColumnToContents(0)
        self.treeView.resizeColumnToContents(1)
        self.treeView.resizeColumnToContents(2)


    def PopulateForm(self):
        ### init widgets
        # model
        self.sim = QtGui.QStandardItemModel()
        self.sim.setHorizontalHeaderLabels(['Stack Address', 'Address Mapped to CPU Reg', 'Value Changes during Execution'])

        # tree view
        self.treeView = QtWidgets.QTreeView()
        self.treeView.setExpandsOnDoubleClick(True)
        self.treeView.setSortingEnabled(False)

# Path: ui/PluginViewer.py
# class PluginViewer(PluginForm):
#     def __init__(self, title):
#         super(PluginViewer, self).__init__()
#         self.title = title
# 
#     def Show(self, **kwargs):
#         return PluginForm.Show(self, self.title, options=PluginForm.FORM_PERSIST)
# 
#     def OnCreate(self, form):
#         # Get parent widget
#         self.parent = form_to_widget(form)
#         self.PopulateForm()
# 
#     def PopulateForm(self):
#         ### do stuff
#         pass
# 
#     def OnClose(self, form):
#         msg("Closed %s.\n" % self.title)
# 
# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):


# Path: ui/StackChangeViewer.py
from ui.PluginViewer import PluginViewer
from ui.UIManager import QtGui, QtCore, QtWidgets

        self.stack_changes = stack_changes


    def PopulateModel(self):
        for key in self.sorted:
            sa = QtGui.QStandardItem('%s' % key)
            chg = QtGui.QStandardItem('%s' % self.stack_changes[key])

            if key in self.vr.values():
                reg = QtGui.QStandardItem('%s' % [k for k in self.vr.keys() if self.vr[k] == key][0])
            else:
                reg = QtGui.QStandardItem(' ')
            self.sim.appendRow([sa, reg, chg])


        self.treeView.resizeColumnToContents(0)
        self.treeView.resizeColumnToContents(1)
        self.treeView.resizeColumnToContents(2)


    def PopulateForm(self):
        ### init widgets
        # model
        self.sim = QtGui.QStandardItemModel()
        self.sim.setHorizontalHeaderLabels(['Stack Address', 'Address Mapped to CPU Reg', 'Value Changes during Execution'])

        # tree view
        self.treeView = QtWidgets.QTreeView()
        self.treeView.setExpandsOnDoubleClick(True)
        self.treeView.setSortingEnabled(False)

        self.treeView.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)