def subscriberChanged(self):
        subPaths = self.subscriber.subPaths()

        if self.listWidget:
            self.listWidget.clear()
        elif self.tableWidget:
            self.tableWidget.clearContents()
            self.tableWidget.setRowCount(len(subPaths))

        for i in xrange(len(subPaths)):
            v = self.subscriber.value(subPaths[i])
            if self.listWidget:
                item = QListWidgetItem('%s (%s)\n%s' %
                                       (subPaths[i], str(type(v)), str(v)))
                item.setFlags(item.flags() & ~Qt.ItemIsEditable)
                self.listWidget.addItem(item)
            elif self.tableWidget:
                pathItem = QTableWidgetItem(subPaths[i])
                pathItem.setFlags(pathItem.flags() & ~Qt.ItemIsEditable)
                valueItem = QTableWidgetItem(str(v))
                valueItem.setFlags(pathItem.flags() & ~Qt.ItemIsEditable)
                typeItem = QTableWidgetItem(str(type(v)))
                typeItem.setFlags(pathItem.flags() & ~Qt.ItemIsEditable)

                self.tableWidget.setItem(i, 0, pathItem)
                self.tableWidget.setItem(i, 1, valueItem)
                self.tableWidget.setItem(i, 2, typeItem)
Beispiel #2
0
    def update_zones_list(self):
        # self.tzListWidget.setHidden(False)
        query = self.tzLineEdit.text().strip()
        self.tzListWidget.clear()
        if len(query) > 0:
            # Populate the tz combo box with all common pytz timezones
            def zone_filter(tzone):
                try:
                    region, country = tzone.split('/')
                    if (region.lower().startswith(query.lower())
                            or country.lower().startswith(query.lower())
                            or tzone.lower().startswith(query.lower())):
                        return True
                except:
                    if tzone.lower().startswith(query.lower()):
                        return True
                return False

            zones = filter(zone_filter, pytz.common_timezones)
        else:
            zones = pytz.common_timezones
        if len(zones) > 0:
            self.tzListWidget.setVisible(True)
            self.adjustSize()
            for tz in zones:
                item = QListWidgetItem(tz, self.tzListWidget)
                if self.time_zone.zone == tz:
                    item.setSelected(True)
Beispiel #3
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)
Beispiel #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)
Beispiel #5
0
    def _setItem(self, title, subtitle, pic_path):
        item_widget = QListWidgetItem()
        item_widget.setSizeHint(QSize(90, 60))
        self.list_widget.addItem(item_widget)

        label = MyLable(title, subtitle, pic_path)
        self.list_widget.setItemWidget(item_widget, label)
Beispiel #6
0
    def subscriberChanged(self):
        subPaths = self.subscriber.subPaths()

        if self.listWidget:
            self.listWidget.clear()
        elif self.tableWidget:
            self.tableWidget.clearContents()
            self.tableWidget.setRowCount(len(subPaths))

        for i in xrange(len(subPaths)):
            v = self.subscriber.value(subPaths[i])
            if self.listWidget:
                item = QListWidgetItem('%s (%s)\n%s' % (subPaths[i], str(type(v)), str(v)))
                item.setFlags(item.flags() & ~Qt.ItemIsEditable)
                self.listWidget.addItem(item)
            elif self.tableWidget:
                pathItem = QTableWidgetItem(subPaths[i])
                pathItem.setFlags(pathItem.flags() & ~Qt.ItemIsEditable)
                valueItem = QTableWidgetItem(str(v))
                valueItem.setFlags(pathItem.flags() & ~Qt.ItemIsEditable)
                typeItem = QTableWidgetItem(str(type(v)))
                typeItem.setFlags(pathItem.flags() & ~Qt.ItemIsEditable)

                self.tableWidget.setItem(i, 0, pathItem)
                self.tableWidget.setItem(i, 1, valueItem)
                self.tableWidget.setItem(i, 2, typeItem)
    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)
Beispiel #8
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])
    def __refresh(self):
        persons = self.__person_dao.load_all()
        self.__ui.allowed_persons.clear()

        for person in persons:
            person_item = QListWidgetItem(person.getName())
            #we are going to store the cpf on the person object ;-)
            person_item._person_cpf = person.getCPF()
            self.__ui.allowed_persons.addItem(person_item)
 def addNewItem(self, name, icon=None):
     if not name in self.itemsListName:
         item = QListWidgetItem()
         if icon: item.setIcon(icon)
         item.setText(name)
         self.addItem(item)
         self.itemsList.append(item)
         self.itemsListName.append(name)
         return item
Beispiel #11
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)
Beispiel #12
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)
Beispiel #13
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)
Beispiel #14
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)
Beispiel #15
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)
Beispiel #16
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)
Beispiel #17
0
    def addItem(self, sourcePath, destPath, pmAttributes):

        import ntpath
        dirName, fileName = ntpath.split(sourcePath)
        self.items.append([sourcePath, destPath, pmAttributes])

        if os.path.exists(destPath):
            wigetItem = QListWidgetItem(fileName)
            wigetItem.sourcePath = sourcePath
            wigetItem.destPath = destPath
            wigetItem.pmAttributes = pmAttributes
            self.w_list.addItem(wigetItem)
        self.w_msg.setText(
            '%d Items aleady exists at \n[%s] \nDo you want to replace it?' %
            (self.w_list.count(), os.path.dirname(destPath)))
Beispiel #18
0
    def showResult(self, result):

        self.tleResultCount.setText(str(len(result)))

        for prime in result:
            item = QListWidgetItem(str(prime))
            self.listResults.addItem(item)
    def initWidgets(self):
        self.showAllServicesItem = QListWidgetItem(
            self.tr("(All registered services)"))
        self.servicesListWidget = QListWidget()
        self.interfacesListWidget = QListWidget()
        self.interfacesListWidget.addItem(self.tr("(Select a service)"))
        self.attributesListWidget = QListWidget()
        self.attributesListWidget.addItem(
            self.tr("(Select an interface implementation)"))
        self.interfacesListWidget.setMinimumWidth(450)
        self.servicesListWidget.currentItemChanged.connect(
            self.reloadInterfaceImplementationsList)
        self.interfacesListWidget.currentItemChanged.connect(
            self.currentInterfaceImplChanged)
        self.defaultInterfaceButton = QPushButton(
            self.tr("Set as default implementation"))
        self.defaultInterfaceButton.setEnabled(False)
        self.defaultInterfaceButton.clicked.connect(
            self.setDefaultInterfaceImplementation)
        self.selectedImplRadioButton = QRadioButton(
            self.tr("Selected interface implementation"))
        self.defaultImplRadioButton = QRadioButton(
            self.tr("Default implementation"))
        self.selectedImplRadioButton.setChecked(True)
        self.radioButtons = QButtonGroup(self)
        self.radioButtons.addButton(self.selectedImplRadioButton)
        self.radioButtons.addButton(self.defaultImplRadioButton)
        self.radioButtons.buttonClicked.connect(self.reloadAttributesList)

        self.servicesGroup = QGroupBox(self.tr("Show services for:"))
        servicesLayout = QVBoxLayout()
        servicesLayout.addWidget(self.servicesListWidget)
        self.servicesGroup.setLayout(servicesLayout)

        self.interfacesGroup = QGroupBox(self.tr("Interface implementations"))
        interfacesLayout = QVBoxLayout()
        interfacesLayout.addWidget(self.interfacesListWidget)
        interfacesLayout.addWidget(self.defaultInterfaceButton)
        self.interfacesGroup.setLayout(interfacesLayout)

        self.attributesGroup = QGroupBox(self.tr("Invokable attributes"))
        attributesLayout = QVBoxLayout()
        self.attributesGroup.setLayout(attributesLayout)
        attributesLayout.addWidget(self.attributesListWidget)
        attributesLayout.addWidget(QLabel(self.tr("Show attributes for:")))
        attributesLayout.addWidget(self.selectedImplRadioButton)
        attributesLayout.addWidget(self.defaultImplRadioButton)

        self.attributesGroup.setLayout(attributesLayout)

        layout = QGridLayout()
        layout.addWidget(self.servicesGroup, 0, 0)
        layout.addWidget(self.attributesGroup, 0, 1, 2, 1)
        layout.addWidget(self.interfacesGroup, 1, 0)

        self.setLayout(layout)
 def on_pushButton_BrowseSimulation_clicked(self):
     """
     This is a slot activated when the "browse for simulation entry" button
     is clicked.
     An open-file dialog is shown.
     """
     filenames = QFileDialog.getOpenFileNames(
         self, caption='Select experimental data files')
     for filename in filenames:
         self.listWidget_Simulation.addItem(QListWidgetItem(filename))
Beispiel #21
0
 def set_controls(self, updated_files):
     for to_update in updated_files:
         item = QListWidgetItem('[%s] %s' % to_update)
         item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
         #if to_update[0] == "U":
         #    item.setCheckState(Qt.Unchecked)
         #else:
         item.setCheckState(Qt.Checked)
         self.ui.listFiles.addItem(item)
Beispiel #22
0
 def _add_task(self, title, checked):
     """ inserts a task at the beginning of the ui.taskList widget """
     item = QListWidgetItem()
     item.setText(title)
     if checked:
         item.setCheckState(Qt.Checked)
     else:
         item.setCheckState(Qt.Unchecked)
     self.ui.taskList.insertItem(0, item)
Beispiel #23
0
 def addItemsCompleter(self, list_, icon=None):
     for text in list_:
         if not text in self.itemsListName:
             item = QListWidgetItem()
             if icon != None: item.setIcon(icon)
             item.setText(text)
             self.addItem(item)
             self.itemsList.append(item)
             self.itemsListName.append(item.text())
Beispiel #24
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)
Beispiel #25
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)
Beispiel #26
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)        
Beispiel #27
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)
Beispiel #28
0
 def addNewItem(self, name, icon=None):
     if not name in self.itemsListName:
         item = QListWidgetItem()
         if icon: item.setIcon(icon)
         item.setText(name)
         self.addItem(item)
         self.itemsList.append(item)
         self.itemsListName.append(name)
         return item
Beispiel #29
0
 def set_controls(self, updated_files):
     for to_update in updated_files:
         item = QListWidgetItem('[%s] %s' % to_update)
         item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
         #if to_update[0] == "U":
         #    item.setCheckState(Qt.Unchecked)
         #else:
         item.setCheckState(Qt.Checked)
         self.ui.listFiles.addItem(item)
 def addItemsCompleter(self, list_, icon=None):
     for text in list_:
         if not text in self.itemsListName:
             item = QListWidgetItem()
             if icon != None: item.setIcon(icon)
             item.setText(text)
             self.addItem(item)
             self.itemsList.append(item)
             self.itemsListName.append(item.text())
Beispiel #31
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)
Beispiel #32
0
    def updateSectionView(self):
        """Updates section view."""
        sec = self.container.listSections()
        self.ui.listWidgetSection.clear()
        sec = sorted(sec)
        self.ui.labelHighlightedSection.setText(str(len(sec)))

        if "Not Classified" in sec:
            sec.remove("Not Classified")
            sec.append("Not Classified")

        for row, value in enumerate(sec):
            item = QListWidgetItem(str(value))
            self.ui.listWidgetSection.addItem(item)

        self.updateComponentView()
        self.updateStrategyView()
        self.updateSentenceView()
Beispiel #33
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()
Beispiel #34
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
Beispiel #35
0
    def updateStrategyView(self):
        """Updates a strategy view."""

        sec = self.selectedTitles(self.ui.listWidgetSection.selectedItems())
        subs = self.selectedTitles(self.ui.listWidgetComponent.selectedItems())
        func = self.container.listStrategies(qsections=sec, qsubsections=subs)
        func = sorted(func)
        func_all = self.container.listStrategies()
        self.ui.listWidgetStrategy.clear()
        func_all = sorted(func_all)

        # remove from func
        if "Not Classified" in func:
            func.remove("Not Classified")

        # remove from func_all, and add in the end
        if "Not Classified" in func_all:
            func_all.remove("Not Classified")
            func_all.append("Not Classified")

        # we need to thing better ways to make this
        # without for's

        # paint and put first in the view
        for row, value in enumerate(func):
            item = QListWidgetItem(str(value))
            item.setBackground(QBrush(QColor(0, 0, 255, 30)))
            self.ui.listWidgetStrategy.addItem(item)

        # put some they not have
        for row, value in enumerate(func_all):
            # if we can use set we dont need to use if
            if value not in func:
                item = QListWidgetItem(str(value))
                self.ui.listWidgetStrategy.addItem(item)

        self.ui.labelHighlightedStrategy.setText(str(len(func)))
        self.updateSentenceView()
Beispiel #36
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)
Beispiel #37
0
 def __init__(self, *args, **kwargs):
     """Creates a new instance of DataListWidgetItem."""
     self._itemData = ArgsUtils.extract('data', None, kwargs)
     self._itemId   = ArgsUtils.extract('ident', None, kwargs)
     QListWidgetItem.__init__(self, *args, **kwargs)
Beispiel #38
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)
Beispiel #39
0
 def add(self, myid, value):
     self.mylist.append({"id": myid, "value": value, "widget": QListWidgetItem(value, self)})
Beispiel #40
0
 def build(self):
     self.itemlist = []
     for item in self.mylist:
         itemdict = {"id": item[0], "value": item[1]}
         itemdict["widget"] = QListWidgetItem(itemdict["value"], self)
         self.itemlist.append(itemdict)
    def __createContents(self):
        self.contentsWidget = QListWidget()
        self.contentsWidget.setViewMode(QListView.ListMode)
        self.contentsWidget.setMovement(QListView.Static)

        toolBar = QListWidgetItem(self.contentsWidget)
        toolBar.setText(self.tr("Toolbar"))
        toolBar.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        worksheet = QListWidgetItem(self.contentsWidget)
        worksheet.setText(self.tr("Worksheet"))
        worksheet.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        computation = QListWidgetItem(self.contentsWidget)
        computation.setText(self.tr("Computation"))
        computation.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        currentItem = QSettings().value("preferences/currentitem",
                                        self.tr(QtReduceDefaults.CURRENTITEM))
        if currentItem == self.tr("Toolbar"):
            self.contentsWidget.setCurrentItem(toolBar)
        elif currentItem == self.tr("Worksheet"):
            self.contentsWidget.setCurrentItem(worksheet)
        elif currentItem == self.tr("Computation"):
            self.contentsWidget.setCurrentItem(computation)

        self.contentsWidget.currentItemChanged.connect(self.changePage)
Beispiel #42
0
    def __init__(self, obj=None):
        """Initialize task panel."""
        self.form = Gui.PySideUic.loadUi(TASKPAGE)
        self.tabs = self.form.RenderTabs
        self.tabs.setCurrentIndex(0)
        self.layout = self.tabs.findChild(QFormLayout, "FieldsLayout")
        self.material_type_combo = self.form.findChild(QComboBox,
                                                       "MaterialType")

        # Initialize material name combo
        self.material_combo = self.form.MaterialNameLayout.itemAt(0).widget()
        self.existing_materials = {
            obj.Label: obj
            for obj in App.ActiveDocument.Objects if is_valid_material(obj)
        }
        self.material_combo.addItems(list(self.existing_materials.keys()))
        self.material_combo.currentTextChanged.connect(
            self.on_material_name_changed)

        # Initialize material type combo
        # Note: itemAt(0) is label, itemAt(1) is combo
        self.material_type_combo = self.form.findChild(QComboBox,
                                                       "MaterialType")
        material_type_set = [MaterialSettingsTaskPanel.NONE_MATERIAL_TYPE
                             ] + list(STD_MATERIALS)
        self.material_type_combo.addItems(material_type_set)
        self.material_type_combo.currentTextChanged.connect(
            self.on_material_type_changed)
        self._set_layout_visible("FieldsLayout", False)
        self.fields = []

        # Initialize Father layout
        self._set_layout_visible("FatherLayout", False)
        self.father_field = self.form.FatherLayout.itemAt(1).widget()

        # Initialize Passthru Renderers selector
        rdrwidget = self.form.findChild(QListWidget, "Renderers")
        for rdr in VALID_RENDERERS:
            item = QListWidgetItem()
            item.setText(rdr)
            item.setIcon(QIcon(os.path.join(ICONDIR, f"{rdr}.svg")))
            rdrwidget.addItem(item)
        rdrwidget.setViewMode(QListView.IconMode)
        rdrwidget.setIconSize(QSize(48, 48))
        rdrwidget.setMaximumWidth(96)
        rdrwidget.setSpacing(6)
        rdrwidget.setMovement(QListView.Static)
        rdrwidget.currentTextChanged.connect(
            self.on_passthrough_renderer_changed)
        self.passthru_rdr = rdrwidget
        self.passthru = self.form.findChild(QPlainTextEdit, "PassthroughEdit")
        self.passthru.textChanged.connect(self.on_passthrough_text_changed)
        self.passthru_cache = {}
        self._set_layout_visible("PassthruLayout", False)

        # Get selected material and initialize material type combo with it
        selection = {obj.Label for obj in Gui.Selection.getSelection()}
        selected_materials = selection & self.existing_materials.keys()
        try:
            selected_material = selected_materials.pop()
        except KeyError:
            pass
        else:
            self.material_combo.setCurrentText(selected_material)
Beispiel #43
0
 def secondPage(self):
     
     for i in range( self.mainLayout.count() ):
         item = self.mainLayout.itemAt(0)
         item.widget().setParent( None )
     
     title = QLabel( "설치할 플러그인을 선택하십시오.".decode( 'utf-8' ) )
     title.setFixedHeight( 50 )
     
     listWidget = QListWidget()
     listWidget.setFixedHeight( 273 )
     widgetItem_for2015 = QListWidgetItem("PingoTools for Maya2015", listWidget )
     widgetItem_for2016 = QListWidgetItem("PingoTools for Maya2016", listWidget )
     widgetItem_for2017 = QListWidgetItem("PingoTools for Maya2017", listWidget )
     
     widgetItem_for2015.setCheckState( QtCore.Qt.Checked )
     widgetItem_for2016.setCheckState( QtCore.Qt.Checked )
     widgetItem_for2017.setCheckState( QtCore.Qt.Checked )
     #widgetItem_for2015.setFlags( not QtCore.Qt.ItemIsSelectable )
     
     buttonsWidget = QWidget(); buttonsWidget.setMaximumHeight( 50 )
     buttonsLayout = QHBoxLayout( buttonsWidget )
     emptyArea = QLabel()
     buttonBack = QPushButton( 'Back < ' )
     buttonNext = QPushButton( 'Install' )
     buttonCancel = QPushButton( 'Cancel' )
     buttonsLayout.addWidget( emptyArea )
     buttonsLayout.addWidget( buttonBack ); buttonBack.setFixedWidth( 100 )
     buttonsLayout.addWidget( buttonNext ); buttonNext.setFixedWidth( 100 )
     buttonsLayout.addWidget( buttonCancel ); buttonCancel.setFixedWidth( 100 )
     
     self.mainLayout.addWidget( title )
     self.mainLayout.addWidget( listWidget )
     self.mainLayout.addWidget( buttonsWidget )
     
     QtCore.QObject.connect( buttonBack, QtCore.SIGNAL( 'clicked()' ), self.firstPage )
     QtCore.QObject.connect( buttonNext, QtCore.SIGNAL( 'clicked()' ), self.lastPage )
     QtCore.QObject.connect( buttonCancel, QtCore.SIGNAL( 'clicked()' ), self.cmd_cancel )