Ejemplo n.º 1
0
 def display_analysis_config(self):
     dialog = AnalysisConfigDialog(self.framework, self)
     
     #Instantiate all found analyzers
     self.analyzerlist.instantiate_analyzers(useallanalyzers=True)
     analyzerdict=TreeWidgetTools.obj_list_to_dict(self.analyzerlist, valueattr='isenabled')
     
     TreeWidgetTools.populate_tree_widget(dialog.analyzerList,analyzerdict)
     dialog.analyzerList.setSortingEnabled(True)
     dialog.analyzerList.sortItems(0,0)
     #generated.setParent(dialog.LeftWidget)
     #dialog.verticalLayoutTopLeft.addWidget(generated)
     
     #dialog.analyzerList=generated
     
     dialog.analyzerList.clicked.connect(dialog.viewItemSelected)
     dialog.defaultsButton.clicked.connect(dialog.defaultsButtonClicked)
     dialog.saveAllButton.clicked.connect(dialog.saveAllButtonClicked)
     dialog.closeButton.clicked.connect(dialog.closeButtonClicked)
     dialog.saveButton.clicked.connect(dialog.saveButtonClicked)
     dialog.addnodeButton.clicked.connect(dialog.addnodeButtonClicked)
     dialog.delnodeButton.clicked.connect(dialog.delnodeButtonClicked)
     
     #Setup complete, display dialog
     dialog.show()
     dialog.exec_()
Ejemplo n.º 2
0
    def addnodeButtonClicked(self):
        """
        If the addnode button is clicked, copy the currently selected node and insert it back into the tree.
        """

        #Don't do anything if there's nothing to do
        if self.analyzerConfig is None or len(
                self.analyzerConfig.selectedItems()) == 0:
            return

        selecteditems = self.analyzerConfig.selectedItems()
        copiedvalues = {}
        #print selecteditems[0].parent()
        TreeWidgetTools.recursive_tree_widget_to_dict_helper(
            selecteditems[0], copiedvalues)
        #Pull original keys out of copiedvalues so the changes don't interfere with the loop
        tempkeylist = tuple(copiedvalues.keys())
        for key in tempkeylist:
            copiedvalues['COPY OF ' + key] = copiedvalues[key]
            del copiedvalues[key]

        #if the parent is None, that means we're copying a rootish-level item.  Use the invisible root to add to
        virtualparent = selecteditems[0].parent() if selecteditems[0].parent(
        ) is not None else self.analyzerConfig.invisibleRootItem()

        #add the copied dictionary to the tree
        TreeWidgetTools.recursive_generate_tree_widget_helper(
            copiedvalues, virtualparent)
Ejemplo n.º 3
0
 def addnodeButtonClicked(self):
     """
     If the addnode button is clicked, copy the currently selected node and insert it back into the tree.
     """
     
     #Don't do anything if there's nothing to do
     if self.analyzerConfig is None or len(self.analyzerConfig.selectedItems())==0:
         return
     
     selecteditems=self.analyzerConfig.selectedItems()
     copiedvalues={}
     #print selecteditems[0].parent()
     TreeWidgetTools.recursive_tree_widget_to_dict_helper(selecteditems[0],copiedvalues)
     #Pull original keys out of copiedvalues so the changes don't interfere with the loop
     tempkeylist=tuple(copiedvalues.keys())
     for key in tempkeylist:
         copiedvalues['COPY OF '+key]=copiedvalues[key]
         del copiedvalues[key]
     
     #if the parent is None, that means we're copying a rootish-level item.  Use the invisible root to add to
     virtualparent=selecteditems[0].parent() if selecteditems[0].parent() is not None else self.analyzerConfig.invisibleRootItem()
     
     #add the copied dictionary to the tree
     TreeWidgetTools.recursive_generate_tree_widget_helper(copiedvalues,virtualparent)
Ejemplo n.º 4
0
 def saveButtonClicked(self):
     #print "SAVE"
     if self.analyzerobj is not None:
         newsettings=TreeWidgetTools.tree_widget_to_dict(self.analyzerConfig)
         #print self.analyzerobj
         
         
         self.framework.set_config_value('ANALYSIS',str(self.analyzerobj.__class__),
                                                  self.analyzerobj.encodeConfiguration(newsettings))
         #print newsettings, newsettings.__class__ 
         self.analyzerobj.setConfiguration(newsettings)
         
         checked = False
         if self.selecteditem.checkState(1) == Qt.Checked:
             checked = True
         self.framework.set_config_value('ANALYSISENABLED',str(self.analyzerobj.__class__),checked)
Ejemplo n.º 5
0
    def saveButtonClicked(self):
        #print "SAVE"
        if self.analyzerobj is not None:
            newsettings = TreeWidgetTools.tree_widget_to_dict(
                self.analyzerConfig)
            #print self.analyzerobj

            self.framework.set_config_value(
                'ANALYSIS', str(self.analyzerobj.__class__),
                self.analyzerobj.encodeConfiguration(newsettings))
            #print newsettings, newsettings.__class__
            self.analyzerobj.setConfiguration(newsettings)

            checked = False
            if self.selecteditem.checkState(1) == Qt.Checked:
                checked = True
            self.framework.set_config_value('ANALYSISENABLED',
                                            str(self.analyzerobj.__class__),
                                            checked)
Ejemplo n.º 6
0
 def generateConfigurationGui(self,analyzerConfig):
     currentconfig=self.getCurrentConfiguration()
     
     TreeWidgetTools.populate_tree_widget(analyzerConfig,currentconfig)
Ejemplo n.º 7
0
    def generateConfigurationGui(self, analyzerConfig):
        currentconfig = self.getCurrentConfiguration()

        TreeWidgetTools.populate_tree_widget(analyzerConfig, currentconfig)