Exemple #1
0
    def reloadInterfaceImplementationsList(self):
        serviceName = None
        allServices = self.servicesListWidget.currentItem().text() == self.showAllServicesItem.text()
        if self.servicesListWidget.currentItem() and not allServices:
            serviceName = self.servicesListWidget.currentItem().text()
            self.interfacesGroup.setTitle(self.tr("Interfaces implemented by %s" % str(serviceName)))
        else:
            self.interfacesGroup.setTitle(self.tr("All interface implementations"))

        descriptors = self.serviceManager.findInterfaces(serviceName)
        self.attributesListWidget.clear()
        self.interfacesListWidget.clear()
        self._i = []
        for desc in descriptors:
            text = "%s %d.%d" % (desc.interfaceName(), desc.majorVersion(), desc.minorVersion())

            if not serviceName:
                text += " (" + desc.serviceName() + ")"

            defaultInterfaceImpl = self.serviceManager.interfaceDefault(desc.interfaceName())
            if desc == defaultInterfaceImpl:
                text += self.tr(" (default)")

            item = QListWidgetItem(text)
            item.setData(Qt.UserRole, desc)
            item._data = desc
            self.interfacesListWidget.addItem(item)

        self.defaultInterfaceButton.setEnabled(False)
    def reloadInterfaceImplementationsList(self):
        serviceName = None
        allServices = self.servicesListWidget.currentItem().text(
        ) == self.showAllServicesItem.text()
        if self.servicesListWidget.currentItem() and not allServices:
            serviceName = self.servicesListWidget.currentItem().text()
            self.interfacesGroup.setTitle(
                self.tr("Interfaces implemented by %s" % str(serviceName)))
        else:
            self.interfacesGroup.setTitle(
                self.tr("All interface implementations"))

        descriptors = self.serviceManager.findInterfaces(serviceName)
        self.attributesListWidget.clear()
        self.interfacesListWidget.clear()
        self._i = []
        for desc in descriptors:
            text = "%s %d.%d" % (desc.interfaceName(), desc.majorVersion(),
                                 desc.minorVersion())

            if not serviceName:
                text += " (" + desc.serviceName() + ")"

            defaultInterfaceImpl = self.serviceManager.interfaceDefault(
                desc.interfaceName())
            if desc == defaultInterfaceImpl:
                text += self.tr(" (default)")

            item = QListWidgetItem(text)
            item.setData(Qt.UserRole, desc)
            item._data = desc
            self.interfacesListWidget.addItem(item)

        self.defaultInterfaceButton.setEnabled(False)
Exemple #3
0
 def setEntry(self, entry):
     positions = self.clearForm()
     self.entry = entry
     if entry is not None:
         self.termEdit.setHtml(entry.term, positions.term)
         self.saf = entry.saf or Saf.AUTO
         self.calcSortAsCheckBox.setChecked(self.saf != Saf.CUSTOM)
         self.sortAsEdit.setPlainText(entry.sortas, positions.sortas)
         self.pagesEdit.setHtml(entry.pages, positions.pages)
         self.notesEdit.setHtml(entry.notes, positions.notes)
         for xref in list(self.state.model.xrefs(entry.eid)):
             kind = "See" if xref.kind is XrefKind.SEE else "See also"
             term = Lib.elidePatchHtml(self.state.model.termPath(
                 xref.to_eid),
                                       self.state,
                                       maxlen=None)
             item = QListWidgetItem("{} <i>{}</i> {}".format(
                 XREF_INDICATOR, kind, term))
             item.setData(Qt.UserRole, xref)
             self.xrefList.addItem(item)
         for xref in list(self.state.model.generic_xrefs(entry.eid)):
             kind = ("See (generic)" if xref.kind is XrefKind.SEE_GENERIC
                     else "See also (generic)")
             item = QListWidgetItem("{} <i>{}</i> {}".format(
                 XREF_INDICATOR, kind, xref.term))
             item.setData(Qt.UserRole, xref)
             self.xrefList.addItem(item)
         if self.xrefList.count():
             self.xrefList.setCurrentRow(0)
         self.state.updateGotoEids(entry.eid)
     self.state.groupsPanel.updateGroups()
     self.state.updateNavigationStatus()
     self.state.setMode(ModeKind.VIEW)
Exemple #4
0
    def _try_loading(self):

        try:
            proj = angr.Project(self.file_path)

            deps = []
            processed_objects = set()
            for ident, obj in proj.loader._satisfied_deps.items():
                if ident in { 'angr syscalls', 'angr externs', '##cle_tls##' } or \
                        obj is proj.loader.main_object:
                    continue
                if obj in processed_objects:
                    continue
                deps.append(ident)
                processed_objects.add(obj)

            dep_list = self.option_widgets['dep_list']  # type: QListWidget
            for dep in deps:
                dep_item = QListWidgetItem(dep)
                dep_item.setData(Qt.CheckStateRole, Qt.Unchecked)
                dep_list.addItem(dep_item)

        except Exception:
            # I guess we will have to load it as a blob?
            l.warning("Preloading of the binary fails due to an exception.",
                      exc_info=True)
Exemple #5
0
 def _populatetagswidget(self):
     """Populates the QListWidget, that contains all available tags for tag
     filtering.
     """
     for tag in self._backend.tags():
         item = QListWidgetItem(tag[1], self.listTags)
         item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
         item.setData(Qt.UserRole, tag[0])
Exemple #6
0
 def populate_qlistwidget(self, game, qlistwidget, iconurls=False):
     if iconurls:
         itemicon = self.qpixmap_from_url(game.icon)
         QApplication.processEvents()
     else:
         itemicon = QPixmap(game.icon)
         QApplication.processEvents()
     item = QListWidgetItem(itemicon, game.name, qlistwidget)
     item.setData(Qt.UserRole, game)
     qlistwidget.addItem(item)
Exemple #7
0
 def populate_qlistwidget(self, game, qlistwidget, iconurls=False):
     if iconurls:
         itemicon = self.qpixmap_from_url(game.icon)
         QApplication.processEvents()
     else:
         itemicon = QPixmap(game.icon)
         QApplication.processEvents()
     item = QListWidgetItem(itemicon, game.name, qlistwidget)
     item.setData(Qt.UserRole, game)
     qlistwidget.addItem(item)
Exemple #8
0
    def add_avoid_address(self, addr):

        for i in xrange(self._avoids_list.count()):
            item = self._avoids_list.item(i)  # type: QListWidgetItem
            if int(item.text(), 16) == addr:
                # deduplicate
                return

        item = QListWidgetItem("%#x" % addr)
        item.setData(Qt.CheckStateRole, Qt.Checked)

        self._avoids_list.addItem(item)
Exemple #9
0
 def load_layout_list(self, settings):
     self.layout_list.clear()
     for menu_item in settings:
         font = QFont()
         if menu_item == 'pin_notes' or menu_item == 'notes':
             font.setStyle(QFont.StyleItalic)
         else:
             font.setWeight(QFont.DemiBold)
         item = QListWidgetItem(self.layout_labels[menu_item])
         item.setData(Qt.UserRole, menu_item)
         item.setTextAlignment(Qt.AlignCenter)
         item.setFont(font)
         self.layout_list.addItem(item)
Exemple #10
0
 def updateList(self, athletes):
     self.list.clear()
     self.athletesList = athletes
     
     for athlete in self.athletesList:
         iconW = QIcon.fromTheme("user-available")
         # doens't work on Mac and Windows
         # http://qt-project.org/doc/qt-4.8/qicon.html#fromTheme
        
         listW = QListWidgetItem(iconW, athlete._name)
         listW.setData(Qt.UserRole, athlete)
        
         self.list.addItem(listW)
Exemple #11
0
 def load_layout_list(self, settings):
     self.layout_list.clear()
     for menu_item in settings:
         font = QFont()
         if menu_item == 'pin_notes' or menu_item == 'notes':
             font.setStyle(QFont.StyleItalic)
         else:
             font.setWeight(QFont.DemiBold)
         item = QListWidgetItem(self.layout_labels[menu_item])
         item.setData(Qt.UserRole, menu_item)
         item.setTextAlignment(Qt.AlignCenter)
         item.setFont(font)
         self.layout_list.addItem(item)
Exemple #12
0
 def populate(self):
     self.listWidget.clear()
     for entry in self.state.model.deletedEntries():
         pages = ""
         if entry.pages:
             pages = ", {}".format(entry.pages)
         top = MAIN_INDICATOR if entry.peid == ROOT else SUB_INDICATOR
         item = QListWidgetItem("{} {}{}".format(
             top, Lib.elidePatchHtml(entry.term, self.state),
             Lib.elidePatchHtml(pages, self.state)))
         item.setData(Qt.UserRole, entry.eid)
         self.listWidget.addItem(item)
     if self.listWidget.count():
         self.listWidget.setCurrentRow(0)
Exemple #13
0
 def createWidgets(self):
     self.listWidget = QListWidget()
     for row, (gid, name) in enumerate(self.state.model.normalGroups()):
         item = QListWidgetItem(name)
         item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsUserCheckable |
                       Qt.ItemIsEnabled)
         item.setBackground(self.palette().base() if row % 2 else
                            self.palette().alternateBase())
         item.setCheckState(Qt.Unchecked)
         item.setData(Qt.UserRole, gid)
         item.setIcon(QIcon(":/groups.svg"))
         self.listWidget.addItem(item)
     self.tooltips.append((self.listWidget, "List of Normal Groups"))
     self.buttons = QDialogButtonBox(QDialogButtonBox.Ok |
                                     QDialogButtonBox.Cancel)
Exemple #14
0
 def updateGroups(self):
     self.groupsList.clear()
     eid = self.state.viewAllPanel.view.selectedEid
     if eid is not None:
         for gid, name, linked in self.state.model.groupsForEid(
                 eid, withLinks=True):
             item = QListWidgetItem(name)
             item.setData(Qt.UserRole, gid)
             item.setIcon(
                 QIcon(":/grouplink.svg" if linked else ":/groups.svg"))
             self.groupsList.addItem(item)
     if self.groupsList.count():
         self.groupsList.setCurrentRow(0)
     self.updateUi()
     self.state.viewFilteredPanel.groupChanged()
Exemple #15
0
def update_save_list():
    save_list.clear()
    try:
        file_list = os.listdir(config['backup_folder_path'])
        file_list.reverse()
        for filename in file_list:
            text = filename
            try:
                created = arrow.get(filename, FILENAME_FORMAT)
                created.shift(hour=-1)
                text = created.humanize(locale='en_gb')
            except Exception as e:
                print e

            list_item = QListWidgetItem()
            list_item.setData(1, filename)
            list_item.setText(text)
            save_list.addItem(list_item)

    except Exception as e:
        print "Error opening directory", e
Exemple #16
0
 def _populateListWidget(self):
     ''' 
     unused old method
     '''
     
     self.pushupsListWidget.clear()
     
     pushupDict = self._getPushupDictionary()
     
     for dayOfExercise in pushupDict:                  
         listItemString = "Date : " + dayOfExercise + "\n"
         listItem_Data = []
         
         for pushup in pushupDict[dayOfExercise]:
             listItemString += "Series : " + str(pushup._series) + \
                               " Repetition : " + str(pushup._repetitions) + "\n"
             listItem_Data.append(pushup)
                          
         listItem = QListWidgetItem(listItemString)
         listItem.setData(Qt.UserRole, listItem_Data)
         
         self.pushupsListWidget.addItem(listItem)        
Exemple #17
0
    def _populateListWidget(self):
        ''' 
        unused old method
        '''

        self.pushupsListWidget.clear()

        pushupDict = self._getPushupDictionary()

        for dayOfExercise in pushupDict:
            listItemString = "Date : " + dayOfExercise + "\n"
            listItem_Data = []

            for pushup in pushupDict[dayOfExercise]:
                listItemString += "Series : " + str(pushup._series) + \
                                  " Repetition : " + str(pushup._repetitions) + "\n"
                listItem_Data.append(pushup)

            listItem = QListWidgetItem(listItemString)
            listItem.setData(Qt.UserRole, listItem_Data)

            self.pushupsListWidget.addItem(listItem)
Exemple #18
0
    def _try_loading(self):

        try:
            proj = angr.Project(self.file_path)

            deps = [
                i for i in proj.loader._unsatisfied_deps +
                list(proj.loader._satisfied_deps) if i not in {
                    'angr syscalls', 'angr externs', '##cle_tls##',
                    self.filename
                }
            ]

            dep_list = self.option_widgets['dep_list']  # type: QListWidget
            for dep in deps:
                dep_item = QListWidgetItem(dep)
                dep_item.setData(Qt.CheckStateRole, Qt.Unchecked)
                dep_list.addItem(dep_item)

        except Exception:
            # I guess we will have to load it as a blob?
            l.warning("Preloading of the binary fails due to an exception.",
                      exc_info=True)
Exemple #19
0
    def _initGUI(self):
        topHLayout = QHBoxLayout()
        hLayout = QHBoxLayout()
        vLayout = QVBoxLayout()
        
        # Label
        greeterText = QLabel("Welcome to <b>Pushup app</b>." + \
                             "<br><br> Select a profile:")
        vLayout.addWidget(greeterText)        
            
        # List 
        self.list = QListWidget()
        self.list.setMinimumWidth(150)
        self.list.setSelectionMode(QAbstractItemView.SingleSelection)
        # SingleSelection is the default value, but I prefer to be sure
        self.list.itemSelectionChanged.connect(self._activateButtons) 
        
        for athlete in self.athletesList:
            iconW = QIcon.fromTheme("user-available")
            # doens't work on Mac and Windows
            # http://qt-project.org/doc/qt-4.8/qicon.html#fromTheme
            
            listW = QListWidgetItem(iconW, athlete._name)
            listW.setData(Qt.UserRole, athlete)
            
            self.list.addItem(listW)
        
        topHLayout.addWidget(self.list)
        self.profileWidget = ProfileFormWidget()
        self.profileWidget.hide()
        
        topHLayout.addWidget(self.profileWidget)    
       
        vLayout.addLayout(topHLayout)        
        vLayout.addLayout(hLayout)
        
        # Buttons
        self.okBtn = QPushButton("Ok")
        self.okBtn.setDisabled(True)
        self.okBtn.setDefault(True)
        self.okBtn.clicked.connect(self._okButtonSlot)
        self.list.itemDoubleClicked.connect(self._okButtonSlot)
                
        cancelBtn = QPushButton("Cancel")      
        cancelBtn.clicked.connect(self._cancelButtonSlot)
        
        self.editBtn = QPushButton("Edit")
        self.editBtn.setDisabled(True)
        self.editBtn.setCheckable(True)
        self.editBtn.clicked.connect(self._toggleProfileEdit)
        
        self.saveBtn = QPushButton("Save changes") # Saves the changes made on the profile 
        self.saveBtn.hide()
        self.saveBtn.clicked.connect(self._saveButtonSlot)
    
        self.removeProfileBtn = QPushButton("Remove Profile")
        self.removeProfileBtn.setDisabled(True)
        self.removeProfileBtn.clicked.connect(self._removeProfile_Dialog)
        
        hLayout.addWidget(self.editBtn)
        hLayout.addWidget(self.removeProfileBtn)
        hLayout.addWidget(cancelBtn)
        hLayout.addWidget(self.okBtn)
        hLayout.addWidget(self.saveBtn)

        self.setLayout(vLayout)