Skip to content

Commit

Permalink
Small fixes in StateView
Browse files Browse the repository at this point in the history
- update the view if we have only one errored state
- disallow switching to the current active state
  • Loading branch information
borzacchiello committed Jun 1, 2023
1 parent 4faf210 commit 7a0d939
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 3 additions & 0 deletions ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ def disable_widgets():
assert BNWidgets.CW is not None
assert BNWidgets.SW is not None

# Refresh state table
BNWidgets.SW.set_state_table(None)

BNWidgets.RW.setEnabled(False)
BNWidgets.MW.setEnabled(False)
BNWidgets.BW.setEnabled(False)
Expand Down
4 changes: 1 addition & 3 deletions ui/hexview.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
QWidget,
QVBoxLayout,
QLabel,
QSizePolicy,
QAbstractItemView,
QMenu,
QItemDelegate,
QSizePolicy
QItemDelegate
)
from PySide6.QtGui import (
QMouseEvent,
Expand Down
1 change: 0 additions & 1 deletion ui/memory_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from PySide6.QtWidgets import (
QApplication,
QGridLayout,
QSizePolicy,
QMenu,
QPushButton
)
Expand Down
12 changes: 10 additions & 2 deletions ui/state_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def reset(self):
self.index_to_state_address = dict()
self.state_collection = []
self.symb_idx = 0
self.active_idx = None
self._table.setRowCount(0)

def init(self, state):
Expand All @@ -94,8 +95,12 @@ def set_state_table(self, state):
avoided_states = globs.executor.fringe.get_avoided_states
exited_states = globs.executor.fringe.get_exited_states

self._table.setRowCount(len(deferred_states)+len(unsat_states)+len(error_states)+len(avoided_states)+len(exited_states)+1)
self.state_collection.append((state,STATE_ACTIVE))
rowCount = len(deferred_states)+len(unsat_states)+len(error_states)+len(avoided_states)+len(exited_states)
if state:
rowCount += 1
self._table.setRowCount(rowCount)
if state:
self.state_collection.append((state,STATE_ACTIVE))

for idx, a in enumerate(deferred_states):
self.state_collection.append((a,STATE_DEFERRED))
Expand All @@ -119,6 +124,7 @@ def set_state_table(self, state):
state_colour = self.active_state_color
state_text_colour = self.item_color
state_status = "Active"
self.active_idx = idx
if s==STATE_UNSAT:
state_colour = self.unsat_state_color
state_text_colour = self.item_color
Expand Down Expand Up @@ -150,6 +156,8 @@ def set_state_table(self, state):
# double click event
def on_doubleClick(self, item):
row_idx = item.row()
if row_idx == self.active_idx:
return
state_addr = self.index_to_state_address[row_idx]
globs.actions_change_state(globs.bv, state_addr)

Expand Down

0 comments on commit 7a0d939

Please sign in to comment.