<s> from PySide import QtCore , QtGui <EOL> from androguard . gui . xrefwindow import XrefDialogString <EOL> class StringsWindow ( QtGui . QWidget ) : <EOL> def __init__ ( self , parent = None , win = None , session = None ) : <EOL> super ( StringsWindow , self ) . __init__ ( parent ) <EOL> self . mainwin = win <EOL> self . session = session <EOL> self . title = "<STR_LIT>" <EOL> self . filterPatternLineEdit = QtGui . QLineEdit ( ) <EOL> self . filterPatternLabel = QtGui . QLabel ( "<STR_LIT>" ) <EOL> self . filterPatternLabel . setBuddy ( self . filterPatternLineEdit ) <EOL> self . filterPatternLineEdit . textChanged . connect ( self . filterRegExpChanged ) <EOL> self . stringswindow = StringsValueWindow ( self , win , session ) <EOL> sourceLayout = QtGui . QVBoxLayout ( ) <EOL> sourceLayout . addWidget ( self . stringswindow ) <EOL> sourceLayout . addWidget ( self . filterPatternLabel ) <EOL> sourceLayout . addWidget ( self . filterPatternLineEdit ) <EOL> self . setLayout ( sourceLayout ) <EOL> def filterRegExpChanged ( self , value ) : <EOL> regExp = QtCore . QRegExp ( value ) <EOL> self . stringswindow . proxyModel . setFilterRegExp ( regExp ) <EOL> class StringsValueWindow ( QtGui . QTreeView ) : <EOL> def __init__ ( self , parent = None , win = None , session = None ) : <EOL> super ( StringsValueWindow , self ) . __init__ ( parent ) <EOL> self . mainwin = win <EOL> self . session = session <EOL> self . title = "<STR_LIT>" <EOL> self . reverse_strings = { } <EOL> self . proxyModel = QtGui . QSortFilterProxyModel ( ) <EOL> self . proxyModel . setDynamicSortFilter ( True ) <EOL> self . model = QtGui . QStandardItemModel ( self . session . get_nb_strings ( ) , <NUM_LIT:4> , <EOL> self ) <EOL> self . model . setHeaderData ( <NUM_LIT:0> , QtCore . Qt . Horizontal , "<STR_LIT>" ) <EOL> self . model . setHeaderData ( <NUM_LIT:1> , QtCore . Qt . Horizontal , "<STR_LIT>" ) <EOL> self . model . setHeaderData ( <NUM_LIT:2> , QtCore . Qt . Horizontal , "<STR_LIT>" ) <EOL> self . model . setHeaderData ( <NUM_LIT:3> , QtCore . Qt . Horizontal , "<STR_LIT>" ) <EOL> row = <NUM_LIT:0> <EOL> for digest , filename , strings_analysis in self . session . get_strings ( ) : <EOL> for string_value in strings_analysis : <EOL> self . model . setData ( self . model . index ( <EOL> row , <NUM_LIT:0> , QtCore . QModelIndex ( ) ) , repr ( strings_analysis [ string_value ] . get_value ( ) ) ) <EOL> self . model . setData ( <EOL> self . model . index ( row , <NUM_LIT:1> , QtCore . QModelIndex ( ) ) , <EOL> len ( strings_analysis [ string_value ] . get_xref_from ( ) ) ) <EOL> self . model . setData ( self . model . index ( <EOL> row , <NUM_LIT:2> , QtCore . QModelIndex ( ) ) , filename ) <EOL> self . model . setData ( self . model . index ( <EOL> row , <NUM_LIT:3> , QtCore . QModelIndex ( ) ) , digest ) <EOL> self . reverse_strings [ repr ( strings_analysis [ string_value ] . get_value ( ) ) + digest <EOL> ] = strings_analysis [ string_value ] <EOL> row += <NUM_LIT:1> <EOL> self . proxyModel . setSourceModel ( self . model ) <EOL> self . setRootIsDecorated ( False ) <EOL> self . setAlternatingRowColors ( True ) <EOL> self . setModel ( self . proxyModel ) <EOL> self . setSortingEnabled ( True ) <EOL> self . setEditTriggers ( QtGui . QAbstractItemView . NoEditTriggers ) <EOL> self . doubleClicked . connect ( self . slotDoubleClicked ) <EOL> def slotDoubleClicked ( self , mi ) : <EOL> mi = self . proxyModel . mapToSource ( mi ) <EOL> row = mi . row ( ) <EOL> column = mi . column ( ) <EOL> if column == <NUM_LIT:0> : <EOL> xwin = XrefDialogString ( <EOL> parent = self . mainwin , <EOL> win = self . mainwin , <EOL> string_analysis = self . reverse_strings [ self . model . item ( row ) . text ( <EOL> ) + self . model . item ( row , <NUM_LIT:3> ) . text ( ) ] ) <EOL> xwin . show ( ) </s>
