Example #1
0
    def __init__(self):
        self.form = QtGui.QWidget()
        self.form.setObjectName("TaskPanel")
        self.grid = QtGui.QGridLayout(self.form)
        self.grid.setObjectName("grid")
        self.title = QtGui.QLabel(self.form)
        self.grid.addWidget(self.title, 1, 0)
        self.textobjlist = QtGui.QLabel(self.form)
        self.grid.addWidget(self.textobjlist, 1, 1)

        self.taglistwidget = QtGui.QListWidget(self.form)
        self.taglistwidget.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        #QtGui.QAbstractItemView([parent=self.taglistwidget])
        self.grid.addWidget(self.taglistwidget, 2, 0)
        self.taglistwidget.addItem("Selection")
        for tag in getTagList():
            self.taglistwidget.addItem(tag)
        self.filteredlistwidget = QtGui.QListWidget(self.form)
        self.grid.addWidget(self.filteredlistwidget, 2, 1)
        self.infoText = QtGui.QLabel(self.form)
        self.grid.addWidget(self.infoText, 3, 0)
        self.checkSpreadsheet = QtGui.QCheckBox(self.form)
        self.checkShape = QtGui.QCheckBox(self.form)
        self.grid.addWidget(self.checkSpreadsheet, 4, 0)
        self.grid.addWidget(self.checkShape, 4, 1)

        QtCore.QObject.connect(self.taglistwidget,
                               QtCore.SIGNAL("itemSelectionChanged()"),
                               self.makeFiltered)

        self.retranslateUi(self.form)
Example #2
0
 def makeTimberList(self):
     #for tag in getTagList():
     timberlistbytag = []
     #for each object in objlist
     for obj in self.objlist:
         # if tag object match a tag in taglist
         if hasattr(obj, "Tag"):
             if obj.Tag in getTagList():
                 tag = obj.Tag
             else:
                 tag = "NoTag"
         else:
             tag = "NoTag"
             #for solids in object
         for solid in obj.Shape.Solids:
             # set a name for shape analyse
             name = str("Aligned_" + str(obj.Name))
             # make shape analyse boundbox aligned
             timber_part = self.shapeAnalyse(
                 name,
                 solid,
             )
             # add analyse to list
             timberlistbytag = self.addListe(tag, timber_part[0],
                                             timber_part[1], timber_part[2])
     #self.timberlist.append([tag,timberlistbytag])
     return self.timberlist
Example #3
0
def listingfilter(items, isOnlyVisible=True):
    doc = FreeCAD.ActiveDocument
    objs = doc.Objects
    objlist = []
    for item in items:
        if item == "Selection":
            for obj in FreeCADGui.Selection.getSelection():
                objlist.append(obj)
        taglist = getTagList()
        for tag in taglist:
            if item == tag:
                for obj in objs:
                    #a = obj.Name
                    #print("Objet : " + str(a))
                    #b = obj.Label
                    if hasattr(obj, "Proxy"):
                        #print(" - hasattr Proxy : ok")
                        if hasattr(obj.Proxy, "Type"):
                            #print(" - hasattr Type : ok")
                            if ((not isOnlyVisible)
                                    or FreeCADGui.ActiveDocument.getObject(
                                        obj.Name).Visibility):
                                #print(" - Visibility : True")
                                try:
                                    if obj.Tag == item:
                                        objlist.append(obj)
                                except AttributeError:
                                    pass
                                #Listing()
                                #objectAnalyse(obj)
                            else:
                                #print(" - Visibility : False")
                                pass
                        else:
                            #print(" - hasattr Type : no")
                            pass
                    else:
                        #print(" - hasattr Proxy : no")
                        pass
    s = []
    for i in objlist:
        if i not in s:
            s.append(i)
    return s
Example #4
0
 def __init__(self):
     self.form = QtGui.QWidget()
     self.form.setObjectName("TaskPanel")
     self.grid = QtGui.QGridLayout(self.form)
     self.grid.setObjectName("grid")
     self.title = QtGui.QLabel(self.form)
     self.grid.addWidget(self.title, 1, 0)
     self.taglistwidget = QtGui.QListWidget(self.form)
     self.grid.addWidget(self.taglistwidget, 2, 0)
     for tag in getTagList():
         self.taglistwidget.addItem(tag)
     self.infoText =  QtGui.QLabel(self.form)
     self.grid.addWidget(self.infoText, 3, 0)
     self.linedit = QtGui.QLineEdit()
     #self.combobox.setCurrentIndex(0)
     self.grid.addWidget(self.linedit, 3, 1)
     self.taglistwidget.itemClicked.connect(self.setTag)
     #QtCore.QObject.connect(self.taglistwidget,QtCore.SIGNAL("itemClicked(item)"),self.setTag)
     #self.previewObj = FreeCAD.ActiveDocument.addObject("Part::Feature", str(translate("Arch", "PreviewCutVolume")))
     self.retranslateUi(self.form)