From eb5de20e36618680bdd82a66d0fb3d470b3bf5ac Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 17 Jan 2012 12:28:44 -0200 Subject: [PATCH 1/6] new Editmode task dialog for Arch Windows --- src/Mod/Arch/ArchWindow.py | 280 ++++++++++++++++++++++++++++++++++++- 1 file changed, 273 insertions(+), 7 deletions(-) diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index ebf65db1a..c033b4dc2 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -24,7 +24,7 @@ import FreeCAD,FreeCADGui,Draft,ArchComponent from draftlibs import fcvec from FreeCAD import Vector -from PyQt4 import QtCore +from PyQt4 import QtCore,QtGui __title__="FreeCAD Wall" __author__ = "Yorik van Havre" @@ -71,12 +71,8 @@ class _Window(ArchComponent.Component): ArchComponent.Component.__init__(self,obj) obj.addProperty("App::PropertyFloat","Thickness","Base", "the thickness to be associated with the wire of the Base object") - #obj.addProperty("App::PropertyLink","Support","Base", - # "The support object (wall usually) of this window") - #obj.addProperty("App::PropertyLength","Jamb","Base", - # "The distance between the window and the exterior face of its supporting object") - #obj.addProperty("Part::PropertyPartShape","Subvolume","Base", - # "the volume to be subtracted when inserting this window into its support") + obj.addProperty("App::PropertyStringList","WindowParts","Base", + "the components of this window") self.Type = "Window" obj.Thickness = .1 @@ -118,4 +114,274 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent): def getIcon(self): return ":/icons/Arch_Window_Tree.svg" + def setEdit(self,vobj,mode): + taskd = _ArchWindowTaskPanel() + taskd.obj = self.Object + taskd.update() + FreeCADGui.Control.showDialog(taskd) + return True + + def unsetEdit(self,vobj,mode): + FreeCADGui.Control.closeDialog() + return + +class _ArchWindowTaskPanel: + '''The TaskPanel for Arch Windows''' + def __init__(self): + + self.obj = None + 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, 0, 0, 1, 7) + + # trees + self.tree = QtGui.QTreeWidget(self.form) + self.grid.addWidget(self.tree, 1, 0, 1, 7) + self.tree.setColumnCount(1) + self.tree.setMaximumSize(QtCore.QSize(500,24)) + self.tree.header().hide() + + self.wiretree = QtGui.QTreeWidget(self.form) + self.grid.addWidget(self.wiretree, 2, 0, 1, 3) + self.wiretree.setColumnCount(1) + + self.comptree = QtGui.QTreeWidget(self.form) + self.grid.addWidget(self.comptree, 2, 4, 1, 3) + self.comptree.setColumnCount(1) + + # buttons + self.addButton = QtGui.QPushButton(self.form) + self.addButton.setObjectName("addButton") + self.addButton.setIcon(QtGui.QIcon(":/icons/Arch_Add.svg")) + self.grid.addWidget(self.addButton, 3, 0, 1, 1) + self.addButton.setMaximumSize(QtCore.QSize(70,40)) + + self.editButton = QtGui.QPushButton(self.form) + self.editButton.setObjectName("editButton") + self.editButton.setIcon(QtGui.QIcon(":/icons/Draft_Edit.svg")) + self.grid.addWidget(self.editButton, 3, 2, 1, 3) + self.editButton.setMaximumSize(QtCore.QSize(60,40)) + self.editButton.setEnabled(False) + + self.delButton = QtGui.QPushButton(self.form) + self.delButton.setObjectName("delButton") + self.delButton.setIcon(QtGui.QIcon(":/icons/Arch_Remove.svg")) + self.grid.addWidget(self.delButton, 3, 6, 1, 1) + self.delButton.setMaximumSize(QtCore.QSize(70,40)) + self.delButton.setEnabled(False) + + self.okButton = QtGui.QPushButton(self.form) + self.okButton.setObjectName("okButton") + self.okButton.setIcon(QtGui.QIcon(":/icons/edit_OK.svg")) + self.grid.addWidget(self.okButton, 4, 0, 1, 7) + + # add new + + self.newtitle = QtGui.QLabel(self.form) + self.new1 = QtGui.QLabel(self.form) + self.new2 = QtGui.QLabel(self.form) + self.new3 = QtGui.QLabel(self.form) + self.new4 = QtGui.QLabel(self.form) + self.new5 = QtGui.QLabel(self.form) + self.field1 = QtGui.QLineEdit(self.form) + self.field2 = QtGui.QLineEdit(self.form) + self.field3 = QtGui.QLineEdit(self.form) + self.field4 = QtGui.QLineEdit(self.form) + self.field5 = QtGui.QLineEdit(self.form) + self.createButton = QtGui.QPushButton(self.form) + self.createButton.setObjectName("createButton") + self.createButton.setIcon(QtGui.QIcon(":/icons/Arch_Add.svg")) + self.grid.addWidget(self.newtitle, 6, 0, 1, 7) + self.grid.addWidget(self.new1, 7, 0, 1, 1) + self.grid.addWidget(self.field1, 7, 2, 1, 5) + self.grid.addWidget(self.new2, 8, 0, 1, 1) + self.grid.addWidget(self.field2, 8, 2, 1, 5) + self.grid.addWidget(self.new3, 9, 0, 1, 1) + self.grid.addWidget(self.field3, 9, 2, 1, 5) + self.grid.addWidget(self.new4, 10, 0, 1, 1) + self.grid.addWidget(self.field4, 10, 2, 1, 5) + self.grid.addWidget(self.new5, 11, 0, 1, 1) + self.grid.addWidget(self.field5, 11, 2, 1, 5) + self.grid.addWidget(self.createButton, 12, 0, 1, 7) + self.newtitle.setVisible(False) + self.new1.setVisible(False) + self.new2.setVisible(False) + self.new3.setVisible(False) + self.new4.setVisible(False) + self.new5.setVisible(False) + self.field1.setVisible(False) + self.field2.setVisible(False) + self.field3.setVisible(False) + self.field4.setVisible(False) + self.field5.setVisible(False) + self.createButton.setVisible(False) + + QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addElement) + QtCore.QObject.connect(self.delButton, QtCore.SIGNAL("clicked()"), self.removeElement) + QtCore.QObject.connect(self.editButton, QtCore.SIGNAL("clicked()"), self.editElement) + QtCore.QObject.connect(self.okButton, QtCore.SIGNAL("clicked()"), self.finish) + QtCore.QObject.connect(self.createButton, QtCore.SIGNAL("clicked()"), self.create) + QtCore.QObject.connect(self.comptree, QtCore.SIGNAL("itemClicked(QTreeWidgetItem*,int)"), self.check) + self.update() + + def isAllowedAlterSelection(self): + return True + + def isAllowedAlterView(self): + return True + + def getStandardButtons(self): + return 0 + + def check(self,wid,col): + self.editButton.setEnabled(True) + self.delButton.setEnabled(True) + + def getIcon(self,obj): + if hasattr(obj.ViewObject,"Proxy"): + return QtGui.QIcon(obj.ViewObject.Proxy.getIcon()) + elif obj.isDerivedFrom("Sketcher::SketchObject"): + return QtGui.QIcon(":/icons/Sketcher_Sketch.svg") + else: + return QtGui.QIcon(":/icons/Tree_Part.svg") + + def update(self): + 'fills the tree widgets' + self.tree.clear() + self.wiretree.clear() + self.comptree.clear() + if self.obj: + if self.obj.Base: + item = QtGui.QTreeWidgetItem(self.tree) + item.setText(0,self.obj.Base.Name) + item.setIcon(0,self.getIcon(self.obj.Base)) + if self.obj.Base.isDerivedFrom("Part::Feature"): + i = 0 + for w in self.obj.Base.Shape.Wires: + if w.isClosed(): + item = QtGui.QTreeWidgetItem(self.wiretree) + item.setText(0,"Wire" + str(i)) + item.setIcon(0,QtGui.QIcon(":/icons/Draft_Draft.svg")) + i += 1 + if self.obj.WindowParts: + for p in range(0,len(self.obj.WindowParts),5): + item = QtGui.QTreeWidgetItem(self.comptree) + item.setText(0,self.obj.WindowParts[p]) + item.setIcon(0,QtGui.QIcon(":/icons/Tree_Part.svg")) + self.retranslateUi(self.form) + + def addElement(self): + 'opens the component creation dialog' + self.field1.setText('') + self.field2.setText('') + self.field3.setText('') + self.field4.setText('') + self.field5.setText('') + self.newtitle.setVisible(True) + self.new1.setVisible(True) + self.new2.setVisible(True) + self.new3.setVisible(True) + self.new4.setVisible(True) + self.new5.setVisible(True) + self.field1.setVisible(True) + self.field2.setVisible(True) + self.field3.setVisible(True) + self.field4.setVisible(True) + self.field5.setVisible(True) + self.createButton.setVisible(True) + self.addButton.setEnabled(False) + self.editButton.setEnabled(False) + self.delButton.setEnabled(False) + + def removeElement(self): + it = self.comptree.currentItem() + if it: + comp = str(it.text(0)) + if self.obj: + p = self.obj.WindowParts + if comp in self.obj.WindowParts: + ind = self.obj.WindowParts.index(comp) + for i in range(5): + p.pop(ind) + self.obj.WindowParts = p + self.update() + self.editButton.setEnabled(False) + self.delButton.setEnabled(False) + + def editElement(self): + it = self.comptree.currentItem() + if it: + self.addElement() + comp = str(it.text(0)) + if self.obj: + if comp in self.obj.WindowParts: + ind = self.obj.WindowParts.index(comp) + for i in range(5): + f = getattr(self,"field"+str(i+1)) + t = self.obj.WindowParts[ind+i] + f.setText(t) + + def create(self): + 'adds a new component' + # testing if fields are ok + ok = True + ar = [] + for i in range(5): + t = str(getattr(self,"field"+str(i+1)).text()) + if t == "": + ok = False + else: + if i > 2: + try: + n=float(t) + except: + ok = False + ar.append(t) + + if ok: + if self.obj: + parts = self.obj.WindowParts + parts.extend(ar) + self.obj.WindowParts = parts + self.update() + + self.newtitle.setVisible(False) + self.new1.setVisible(False) + self.new2.setVisible(False) + self.new3.setVisible(False) + self.new4.setVisible(False) + self.new5.setVisible(False) + self.field1.setVisible(False) + self.field2.setVisible(False) + self.field3.setVisible(False) + self.field4.setVisible(False) + self.field5.setVisible(False) + self.createButton.setVisible(False) + self.addButton.setEnabled(True) + + def finish(self): + FreeCAD.ActiveDocument.recompute() + if self.obj: + self.obj.ViewObject.finishEditing() + + def retranslateUi(self, TaskPanel): + TaskPanel.setWindowTitle(QtGui.QApplication.translate("Arch", "Components", None, QtGui.QApplication.UnicodeUTF8)) + self.delButton.setText(QtGui.QApplication.translate("Arch", "Remove", None, QtGui.QApplication.UnicodeUTF8)) + self.addButton.setText(QtGui.QApplication.translate("Arch", "Add", None, QtGui.QApplication.UnicodeUTF8)) + self.editButton.setText(QtGui.QApplication.translate("Arch", "Edit", None, QtGui.QApplication.UnicodeUTF8)) + self.okButton.setText(QtGui.QApplication.translate("Arch", "Done", None, QtGui.QApplication.UnicodeUTF8)) + self.createButton.setText(QtGui.QApplication.translate("Arch", "Create/update component", None, QtGui.QApplication.UnicodeUTF8)) + self.title.setText(QtGui.QApplication.translate("Arch", "Base 2D object", None, QtGui.QApplication.UnicodeUTF8)) + self.wiretree.setHeaderLabels([QtGui.QApplication.translate("Arch", "Wires", None, QtGui.QApplication.UnicodeUTF8)]) + self.comptree.setHeaderLabels([QtGui.QApplication.translate("Arch", "Components", None, QtGui.QApplication.UnicodeUTF8)]) + self.newtitle.setText(QtGui.QApplication.translate("Arch", "Create new component", None, QtGui.QApplication.UnicodeUTF8)) + self.new1.setText(QtGui.QApplication.translate("Arch", "Name", None, QtGui.QApplication.UnicodeUTF8)) + self.new2.setText(QtGui.QApplication.translate("Arch", "Type", None, QtGui.QApplication.UnicodeUTF8)) + self.new3.setText(QtGui.QApplication.translate("Arch", "Wires", None, QtGui.QApplication.UnicodeUTF8)) + self.new4.setText(QtGui.QApplication.translate("Arch", "Thickness", None, QtGui.QApplication.UnicodeUTF8)) + self.new5.setText(QtGui.QApplication.translate("Arch", "Z offset", None, QtGui.QApplication.UnicodeUTF8)) + FreeCADGui.addCommand('Arch_Window',_CommandWindow()) From edb1da8a3f36db1e004a4732a750a0353ce59418 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 17 Jan 2012 18:02:10 -0200 Subject: [PATCH 2/6] Further work on Arch windows --- src/Mod/Arch/ArchAxis.py | 9 +- src/Mod/Arch/ArchComponent.py | 14 +- src/Mod/Arch/ArchWindow.py | 152 ++++++++--- src/Mod/Arch/Arch_rc.py | 280 ++++++++++---------- src/Mod/Arch/Resources/ui/archprefs-base.ui | 54 +++- src/Mod/Arch/importIFC.py | 2 +- src/Mod/Draft/Draft.py | 4 + 7 files changed, 301 insertions(+), 214 deletions(-) diff --git a/src/Mod/Arch/ArchAxis.py b/src/Mod/Arch/ArchAxis.py index 7dc9f9f8d..4ea4fa317 100644 --- a/src/Mod/Arch/ArchAxis.py +++ b/src/Mod/Arch/ArchAxis.py @@ -286,14 +286,8 @@ class _AxisTaskPanel: self.grid.addWidget(self.delButton, 3, 1, 1, 1) self.delButton.setEnabled(True) - self.okButton = QtGui.QPushButton(self.form) - self.okButton.setObjectName("okButton") - self.okButton.setIcon(QtGui.QIcon(":/icons/edit_OK.svg")) - self.grid.addWidget(self.okButton, 4, 0, 1, 2) - QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addElement) QtCore.QObject.connect(self.delButton, QtCore.SIGNAL("clicked()"), self.removeElement) - QtCore.QObject.connect(self.okButton, QtCore.SIGNAL("clicked()"), self.finish) self.update() def isAllowedAlterSelection(self): @@ -303,7 +297,7 @@ class _AxisTaskPanel: return True def getStandardButtons(self): - return 0 + return int(QtGui.QDialogButtonBox.Ok) def update(self): 'fills the treewidget' @@ -354,7 +348,6 @@ class _AxisTaskPanel: TaskPanel.setWindowTitle(QtGui.QApplication.translate("Arch", "Axes", None, QtGui.QApplication.UnicodeUTF8)) self.delButton.setText(QtGui.QApplication.translate("Arch", "Remove", None, QtGui.QApplication.UnicodeUTF8)) self.addButton.setText(QtGui.QApplication.translate("Arch", "Add", None, QtGui.QApplication.UnicodeUTF8)) - self.okButton.setText(QtGui.QApplication.translate("Arch", "Done", None, QtGui.QApplication.UnicodeUTF8)) self.title.setText(QtGui.QApplication.translate("Arch", "Distances and angles between axes", None, QtGui.QApplication.UnicodeUTF8)) self.tree.setHeaderLabels([QtGui.QApplication.translate("Arch", "Axis", None, QtGui.QApplication.UnicodeUTF8), QtGui.QApplication.translate("Arch", "Distance", None, QtGui.QApplication.UnicodeUTF8), diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index b1607b971..fde19dcce 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -137,14 +137,8 @@ class ComponentTaskPanel: self.grid.addWidget(self.delButton, 3, 1, 1, 1) self.delButton.setEnabled(False) - self.okButton = QtGui.QPushButton(self.form) - self.okButton.setObjectName("okButton") - self.okButton.setIcon(QtGui.QIcon(":/icons/edit_OK.svg")) - self.grid.addWidget(self.okButton, 4, 0, 1, 2) - QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addElement) QtCore.QObject.connect(self.delButton, QtCore.SIGNAL("clicked()"), self.removeElement) - QtCore.QObject.connect(self.okButton, QtCore.SIGNAL("clicked()"), self.finish) QtCore.QObject.connect(self.tree, QtCore.SIGNAL("itemClicked(QTreeWidgetItem*,int)"), self.check) self.update() @@ -155,8 +149,8 @@ class ComponentTaskPanel: return True def getStandardButtons(self): - return 0 - + return int(QtGui.QDialogButtonBox.Ok) + def check(self,wid,col): if not wid.parent(): self.delButton.setEnabled(False) @@ -225,16 +219,16 @@ class ComponentTaskPanel: removeFromComponent(self.obj,comp) self.update() - def finish(self): + def accept(self): FreeCAD.ActiveDocument.recompute() if self.obj: self.obj.ViewObject.finishEditing() + return True def retranslateUi(self, TaskPanel): TaskPanel.setWindowTitle(QtGui.QApplication.translate("Arch", "Components", None, QtGui.QApplication.UnicodeUTF8)) self.delButton.setText(QtGui.QApplication.translate("Arch", "Remove", None, QtGui.QApplication.UnicodeUTF8)) self.addButton.setText(QtGui.QApplication.translate("Arch", "Add", None, QtGui.QApplication.UnicodeUTF8)) - self.okButton.setText(QtGui.QApplication.translate("Arch", "Done", None, QtGui.QApplication.UnicodeUTF8)) self.title.setText(QtGui.QApplication.translate("Arch", "Components of this object", None, QtGui.QApplication.UnicodeUTF8)) self.treeBase.setText(0,QtGui.QApplication.translate("Arch", "Base component", None, QtGui.QApplication.UnicodeUTF8)) self.treeAdditions.setText(0,QtGui.QApplication.translate("Arch", "Additions", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index c033b4dc2..f6f1303cb 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -36,16 +36,35 @@ def makeWindow(baseobj=None,name="Window"): obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) _Window(obj) _ViewProviderWindow(obj.ViewObject) - if baseobj: obj.Base = baseobj - if obj.Base: obj.Base.ViewObject.hide() - #p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") - #c = p.GetUnsigned("WindowColor") - #r = float((c>>24)&0xFF)/255.0 - #g = float((c>>16)&0xFF)/255.0 - #b = float((c>>8)&0xFF)/255.0 - #obj.ViewObject.ShapeColor = (r,g,b,1.0) + if baseobj: + obj.Base = baseobj + obj.WindowParts = makeDefaultWindowPart(baseobj) + if obj.Base: + obj.Base.ViewObject.DisplayMode = "Wireframe" + obj.Base.ViewObject.hide() + p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") + c = p.GetUnsigned("WindowColor") + r = float((c>>24)&0xFF)/255.0 + g = float((c>>16)&0xFF)/255.0 + b = float((c>>8)&0xFF)/255.0 + obj.ViewObject.ShapeColor = (r,g,b,1.0) return obj +def makeDefaultWindowPart(obj): + "returns a list of 5 strings defining a default window part from a 2D object" + part = [] + if obj.isDerivedFrom("Part::Feature"): + if obj.Shape.Wires: + i = 0 + ws = '' + for w in obj.Shape.Wires: + if w.isClosed(): + if ws: ws += "," + ws += "Wire" + str(i) + i += 1 + part = ["Default","Panel",ws,"1","0"] + return part + class _CommandWindow: "the Arch Window command definition" def GetResources(self): @@ -69,18 +88,15 @@ class _Window(ArchComponent.Component): "The Window object" def __init__(self,obj): ArchComponent.Component.__init__(self,obj) - obj.addProperty("App::PropertyFloat","Thickness","Base", - "the thickness to be associated with the wire of the Base object") obj.addProperty("App::PropertyStringList","WindowParts","Base", "the components of this window") self.Type = "Window" - obj.Thickness = .1 def execute(self,obj): self.createGeometry(obj) def onChanged(self,obj,prop): - if prop in ["Base","Thickness"]: + if prop in ["Base","WindowParts"]: self.createGeometry(obj) def createGeometry(self,obj): @@ -89,21 +105,40 @@ class _Window(ArchComponent.Component): pl = obj.Placement if obj.Base: if obj.Base.isDerivedFrom("Part::Feature"): - if obj.Base.Shape.Wires: - basewire = obj.Base.Shape.Wires[0] - if obj.Thickness: - offwire = basewire.makeOffset(-obj.Thickness) - f1 = Part.Face(basewire) - f2 = Part.Face(offwire) - bf = f1.cut(f2) - sh = bf.extrude(Vector(0,0,obj.Thickness)) - obj.Shape = sh - f1.translate(Vector(0,0,-.5)) - svol = f1.extrude(Vector(0,0,1)) - self.Subvolume = svol + if obj.WindowParts and (len(obj.WindowParts)%5 == 0): + shapes = [] + for i in range(len(obj.WindowParts)/5): + wires = [] + wstr = obj.WindowParts[(i*5)+2].split(',') + for s in wstr: + j = int(s[4:]) + if len(obj.Base.Shape.Wires) >= j: + wires.append(obj.Base.Shape.Wires[j]) + if wires: + max_length = 0 + for w in wires: + if w.BoundBox.DiagonalLength > max_length: + max_length = w.BoundBox.DiagonalLength + ext = w + wires.remove(ext) + for w in wires: + w.reverse() + wires.insert(0, ext) + shape = Part.Face(wires) + norm = shape.normalAt(0,0) + thk = float(obj.WindowParts[(i*5)+3]) + if thk: + exv = fcvec.scaleTo(norm,thk) + shape = shape.extrude(exv) + if obj.WindowParts[(i*5)+4]: + zof = float(obj.WindowParts[(i*5)+4]) + if zof: + zov = fcvec.scaleTo(norm,zof) + shape.translate(zov) + shapes.append(shape) + obj.Shape = Part.makeCompound(shapes) if not fcgeo.isNull(pl): obj.Placement = pl - self.Subvolume.Placement = pl class _ViewProviderWindow(ArchComponent.ViewProviderComponent): "A View Provider for the Window object" @@ -117,11 +152,20 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent): def setEdit(self,vobj,mode): taskd = _ArchWindowTaskPanel() taskd.obj = self.Object + self.sets = [vobj.DisplayMode,vobj.Transparency] + vobj.DisplayMode = "Shaded" + vobj.Transparency = 80 + if self.Object.Base: + self.Object.Base.ViewObject.show() taskd.update() FreeCADGui.Control.showDialog(taskd) return True def unsetEdit(self,vobj,mode): + vobj.DisplayMode = self.sets[0] + vobj.Transparency = self.sets[1] + if self.Object.Base: + self.Object.Base.ViewObject.hide() FreeCADGui.Control.closeDialog() return @@ -147,6 +191,7 @@ class _ArchWindowTaskPanel: self.wiretree = QtGui.QTreeWidget(self.form) self.grid.addWidget(self.wiretree, 2, 0, 1, 3) self.wiretree.setColumnCount(1) + self.wiretree.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) self.comptree = QtGui.QTreeWidget(self.form) self.grid.addWidget(self.comptree, 2, 4, 1, 3) @@ -173,11 +218,6 @@ class _ArchWindowTaskPanel: self.delButton.setMaximumSize(QtCore.QSize(70,40)) self.delButton.setEnabled(False) - self.okButton = QtGui.QPushButton(self.form) - self.okButton.setObjectName("okButton") - self.okButton.setIcon(QtGui.QIcon(":/icons/edit_OK.svg")) - self.grid.addWidget(self.okButton, 4, 0, 1, 7) - # add new self.newtitle = QtGui.QLabel(self.form) @@ -215,6 +255,7 @@ class _ArchWindowTaskPanel: self.field1.setVisible(False) self.field2.setVisible(False) self.field3.setVisible(False) + self.field3.setReadOnly(True) self.field4.setVisible(False) self.field5.setVisible(False) self.createButton.setVisible(False) @@ -222,11 +263,13 @@ class _ArchWindowTaskPanel: QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addElement) QtCore.QObject.connect(self.delButton, QtCore.SIGNAL("clicked()"), self.removeElement) QtCore.QObject.connect(self.editButton, QtCore.SIGNAL("clicked()"), self.editElement) - QtCore.QObject.connect(self.okButton, QtCore.SIGNAL("clicked()"), self.finish) QtCore.QObject.connect(self.createButton, QtCore.SIGNAL("clicked()"), self.create) QtCore.QObject.connect(self.comptree, QtCore.SIGNAL("itemClicked(QTreeWidgetItem*,int)"), self.check) + QtCore.QObject.connect(self.wiretree, QtCore.SIGNAL("itemClicked(QTreeWidgetItem*,int)"), self.select) self.update() + FreeCADGui.Selection.clearSelection() + def isAllowedAlterSelection(self): return True @@ -234,12 +277,28 @@ class _ArchWindowTaskPanel: return True def getStandardButtons(self): - return 0 + return int(QtGui.QDialogButtonBox.Ok) def check(self,wid,col): self.editButton.setEnabled(True) self.delButton.setEnabled(True) + def select(self,wid,col): + FreeCADGui.Selection.clearSelection() + ws = '' + for it in self.wiretree.selectedItems(): + if ws: ws += "," + ws += str(it.text(0)) + w = int(str(it.text(0)[4:])) + if self.obj: + if self.obj.Base: + edges = self.obj.Base.Shape.Wires[w].Edges + for e in edges: + for i in range(len(self.obj.Base.Shape.Edges)): + if e.hashCode() == self.obj.Base.Shape.Edges[i].hashCode(): + FreeCADGui.Selection.addSelection(self.obj.Base,"Edge"+str(i+1)) + self.field3.setText(ws) + def getIcon(self,obj): if hasattr(obj.ViewObject,"Proxy"): return QtGui.QIcon(obj.ViewObject.Proxy.getIcon()) @@ -282,12 +341,12 @@ class _ArchWindowTaskPanel: self.field5.setText('') self.newtitle.setVisible(True) self.new1.setVisible(True) - self.new2.setVisible(True) + #self.new2.setVisible(True) self.new3.setVisible(True) self.new4.setVisible(True) self.new5.setVisible(True) self.field1.setVisible(True) - self.field2.setVisible(True) + #self.field2.setVisible(True) self.field3.setVisible(True) self.field4.setVisible(True) self.field5.setVisible(True) @@ -297,8 +356,7 @@ class _ArchWindowTaskPanel: self.delButton.setEnabled(False) def removeElement(self): - it = self.comptree.currentItem() - if it: + for it in self.comptree.selectedItems(): comp = str(it.text(0)) if self.obj: p = self.obj.WindowParts @@ -312,8 +370,7 @@ class _ArchWindowTaskPanel: self.delButton.setEnabled(False) def editElement(self): - it = self.comptree.currentItem() - if it: + for it in self.comptree.selectedItems(): self.addElement() comp = str(it.text(0)) if self.obj: @@ -332,7 +389,8 @@ class _ArchWindowTaskPanel: for i in range(5): t = str(getattr(self,"field"+str(i+1)).text()) if t == "": - ok = False + if not(i in [1,5]): + ok = False else: if i > 2: try: @@ -344,9 +402,19 @@ class _ArchWindowTaskPanel: if ok: if self.obj: parts = self.obj.WindowParts - parts.extend(ar) + if ar[0] in parts: + b = parts.index(ar[0]) + for i in range(5): + parts[b+i] = ar[i] + else: + parts.extend(ar) self.obj.WindowParts = parts self.update() + else: + FreeCAD.Console.PrintWarning(str( + QtGui.QApplication.translate( + "Arch", "Unable to create component", + None, QtGui.QApplication.UnicodeUTF8))) self.newtitle.setVisible(False) self.new1.setVisible(False) @@ -362,17 +430,17 @@ class _ArchWindowTaskPanel: self.createButton.setVisible(False) self.addButton.setEnabled(True) - def finish(self): + def accept(self): FreeCAD.ActiveDocument.recompute() if self.obj: self.obj.ViewObject.finishEditing() + return True def retranslateUi(self, TaskPanel): TaskPanel.setWindowTitle(QtGui.QApplication.translate("Arch", "Components", None, QtGui.QApplication.UnicodeUTF8)) self.delButton.setText(QtGui.QApplication.translate("Arch", "Remove", None, QtGui.QApplication.UnicodeUTF8)) self.addButton.setText(QtGui.QApplication.translate("Arch", "Add", None, QtGui.QApplication.UnicodeUTF8)) self.editButton.setText(QtGui.QApplication.translate("Arch", "Edit", None, QtGui.QApplication.UnicodeUTF8)) - self.okButton.setText(QtGui.QApplication.translate("Arch", "Done", None, QtGui.QApplication.UnicodeUTF8)) self.createButton.setText(QtGui.QApplication.translate("Arch", "Create/update component", None, QtGui.QApplication.UnicodeUTF8)) self.title.setText(QtGui.QApplication.translate("Arch", "Base 2D object", None, QtGui.QApplication.UnicodeUTF8)) self.wiretree.setHeaderLabels([QtGui.QApplication.translate("Arch", "Wires", None, QtGui.QApplication.UnicodeUTF8)]) diff --git a/src/Mod/Arch/Arch_rc.py b/src/Mod/Arch/Arch_rc.py index 62078f065..7c1c30950 100644 --- a/src/Mod/Arch/Arch_rc.py +++ b/src/Mod/Arch/Arch_rc.py @@ -2,7 +2,7 @@ # Resource object code # -# Created: Sun Jan 15 17:53:12 2012 +# Created: Tue Jan 17 17:15:03 2012 # by: The Resource Compiler for PyQt (Qt v4.7.4) # # WARNING! All changes made in this file will be lost! @@ -5697,122 +5697,122 @@ qt_resource_data = "\ \x00\x00\x00\x12\x00\x57\x00\x65\x00\x72\x00\x6b\x00\x7a\x00\x65\ \x00\x75\x00\x67\x00\x65\x08\x00\x00\x00\x00\x06\x00\x00\x00\x05\ \x54\x6f\x6f\x6c\x73\x07\x00\x00\x00\x04\x61\x72\x63\x68\x01\ -\x00\x00\x07\x16\ +\x00\x00\x07\x1c\ \x00\ -\x00\x23\xb1\x78\x9c\xed\x5a\x6d\x6f\xdb\x36\x10\xfe\x9e\x5f\xc1\ -\x79\x40\xbb\x01\xb1\xe5\xbc\x36\x71\x64\x17\xad\x93\x34\x01\xd2\ -\xd5\xad\xdd\x16\xfb\x14\xc8\x12\x6d\xb1\xa5\x44\x45\xa4\x2a\xbb\ -\xc3\xfe\xfb\x8e\x2f\xb2\x24\xcb\x76\x5e\xec\xb4\x6b\x51\x20\x41\ -\x44\x1e\x79\x77\x7c\x78\x7c\xee\xa8\xc8\x7e\x3e\x09\x28\xfa\x82\ -\x63\x4e\x58\xd8\xae\xed\x34\x9a\x35\x84\x43\x97\x79\x24\x1c\xb7\ -\x6b\xef\x07\xe7\xf5\xa3\xda\xf3\xce\x96\x9d\x90\x7c\xd0\x3e\x0c\ -\xea\x6c\x21\xdb\xa5\x0e\xe7\x9d\x57\x09\x69\xb5\x4e\x89\x43\xd9\ -\x18\xfe\xd2\x71\x1f\x0b\x01\x93\xf9\x8b\xd8\xf5\x6d\x4b\x8f\x81\ -\xc1\x29\xf1\xc6\x58\x20\xd5\x6e\xd7\xde\x7e\x54\xcd\x1a\x0a\x9d\ -\x00\xb7\x6b\xab\x74\x48\x53\xc8\x8e\x62\x16\xe1\x58\x4c\xcd\x84\ -\x31\x66\x01\x16\xf1\x54\x09\x91\x1d\x63\x57\xa8\x27\x64\x4f\x3a\ -\x4d\xdb\x9a\x98\xc6\x54\x36\xa6\xa6\x01\x1e\x08\xbf\x73\xf0\xec\ -\xc0\xb6\xf4\xa3\xee\xf6\x31\x19\xfb\xa2\x73\xb8\x7b\x6c\x5b\xe6\ -\x59\xe9\xb4\x32\xa5\xb6\x95\x19\x5f\xe4\x49\x4a\x42\x8f\xa5\x03\ -\x22\x28\x36\xce\x70\x11\x83\xef\x9d\x57\x38\xc4\xb1\x43\x11\x37\ -\x6b\xb1\x2d\x23\xa8\xaa\xa4\xce\x94\x25\x39\x36\x1f\x5e\xb2\xc9\ -\x95\xea\x32\x1a\xe7\x4c\xf2\xc8\x71\x41\x51\xcd\x2c\x20\x4c\x82\ -\x21\x8e\x3b\x87\xb6\x65\x9e\xb4\xfb\x45\x0b\x15\x15\x81\x13\x8f\ -\x49\x38\xa7\xe1\x78\xa5\x06\x22\x70\x90\x23\x59\xdc\xcb\x57\x31\ -\x4b\x22\xf0\x39\xdb\xcd\x71\xd6\xd6\xc3\x2b\xc6\x45\x0e\xd6\x02\ -\xbc\xe4\x9e\xa3\xfe\x02\xd0\xaa\x3e\xad\x84\xce\x18\x83\xa8\x15\ -\xc4\x75\xa8\xee\xbd\xde\xcd\xed\xe6\x0b\x5a\xa0\xe8\xa2\xa2\xc8\ -\x67\x31\xf9\xca\x42\xb1\x40\xd5\xbc\xb2\x2a\x44\x57\xce\x10\xd3\ -\x4c\x13\x95\x8d\xd2\xf4\x05\x18\xe1\x89\x28\x0d\x98\xe1\x74\x8a\ -\x47\x4e\x42\x41\x35\xa3\x2c\x46\x23\xf8\x4d\x1d\x4a\xe7\x91\x5a\ -\x0c\x97\xee\xd4\xbe\x15\x9c\xb7\xca\xde\x57\x16\x23\x03\x0e\xc7\ -\x15\x1c\xfa\xaa\x7b\xe5\x32\x60\x2c\x86\xa1\x02\x78\x63\x6e\x35\ -\x18\x42\xad\xf3\x56\xb4\x5a\x17\x33\x7d\xb6\xa5\x3a\x6f\x5b\x40\ -\xf5\x3c\x90\xaf\xf8\x82\x84\xb0\x53\x5c\x78\x70\xdc\xda\xb5\xe6\ -\x3c\x74\x30\xa2\xd4\x93\xb1\xc1\x7e\xb3\x44\x06\x33\xa9\x21\x82\ -\xdd\x66\x89\x13\x72\xb7\xe6\x15\x2e\x41\x5a\x03\x77\x0f\xa4\xcb\ -\x61\xa3\x68\xb1\x17\xe3\x51\x57\xee\xf5\xcb\x44\x08\x80\x31\x3b\ -\x64\x52\x16\x81\x4c\xc5\xc1\x50\xcb\x56\x46\x14\x63\x74\x40\xa2\ -\xc5\x41\x35\xf0\x09\x47\xf0\x23\x7c\x8c\xbc\x4a\x80\x85\x38\x45\ -\x1f\x21\xc8\x10\x1b\x7e\x02\x52\xbc\x7b\xac\x55\x9c\x50\x3a\xe7\ -\x5c\x50\x7d\x73\xf8\xc7\xd8\xeb\xec\x1e\x1c\x48\x12\xf6\xe6\x44\ -\xe3\x18\xe3\xb0\xb3\x73\x0c\x5b\xa3\x1f\xcb\xe2\x21\x4d\x70\x67\ -\xe7\x19\x48\xd5\x53\x79\xdb\x2a\xa6\xee\xe6\xb5\x84\xf9\x2c\x94\ -\xe9\x66\x69\x84\xb9\x06\x11\x09\x93\xda\x2d\x30\xf6\x50\x90\xa4\ -\xb9\x9e\x23\xfc\xdb\xad\xbd\x66\x9e\x65\xf2\xec\xa6\x4e\xbf\x6d\ -\x69\x26\x9c\xd1\x64\x49\xbc\x2e\x69\xae\x45\x99\x1b\x23\x4c\x10\ -\x24\xae\x48\x62\xfc\xfd\x58\xf3\x16\xfa\xff\xc5\x9b\xdf\x92\x37\ -\x6f\xcb\xc5\xeb\x31\x67\x3f\x8b\xb6\x6f\x4b\x9f\x3b\x07\xcd\x15\ -\xf4\x79\x78\xbc\x8a\x3e\x8f\x0e\xbf\x13\x7d\xce\xb0\xfa\x79\x39\ -\xb4\x2c\x2c\xe9\x2a\x8c\x7b\x40\xb9\x9d\x47\xf1\xdd\x0a\xee\xcb\ -\xf3\x2e\x22\x41\xc4\x62\xb1\xe9\x2a\x7b\x73\x35\xf6\xde\x7a\x35\ -\xf6\xde\x03\x53\xc6\x13\x2a\x4e\x7e\x3b\x7d\xd3\x1d\xfc\xdd\x3b\ -\x43\x17\x83\xd7\x57\xa8\xf7\xfe\xe5\xd5\x65\x17\x3d\xb9\x49\x98\ -\x38\xa9\x5b\xd6\xc7\xbd\xae\x65\x9d\x0e\x4e\xb5\x14\x6e\xc4\x96\ -\x75\xf6\x97\x96\x9a\x41\xbe\x10\x51\xcb\xb2\xd2\x34\x6d\xa4\x7b\ -\x0d\x16\x8f\xad\xc1\x3b\xeb\xdd\x59\xb7\xee\x8b\x80\xee\x37\x15\ -\xe4\xae\x68\x78\xc2\xd3\xe3\x9f\x8c\xc5\xc9\x96\x34\x2c\xe5\xb2\ -\xa1\x9e\xb1\xe3\x65\xcf\x70\xe1\x75\xb4\xe7\x7a\xc2\x0d\xcc\xf7\ -\xe5\x1a\x8c\x59\x17\x80\x83\xa4\x61\xa4\x3b\xa6\xd7\xca\xa6\x73\ -\x31\xa5\x18\x89\x69\x94\xcd\x97\x53\x21\xe6\x79\xc1\x7c\xb4\x8d\ -\x28\x41\xff\xa0\xd4\x07\xac\xeb\x8a\x85\x5b\x08\x8e\x52\x3d\x8d\ -\x9d\xe8\x04\xfd\xab\xfc\xb3\x94\xa6\x4c\xad\x55\x74\x71\xc8\xbc\ -\x29\x52\x62\x63\x03\x48\x30\x14\xf5\x91\x13\x10\x3a\x6d\x3d\x3d\ -\xc5\x9f\x9c\x0f\x09\xea\x3b\x21\x7f\x6a\x44\x32\x21\xb4\x8e\xa2\ -\x6c\x64\xaa\x92\x46\x6b\xbf\xd9\xcc\xe4\x52\x59\x2b\x64\x71\xe0\ -\xd0\x93\x39\xa0\xa2\xb2\x29\x7d\xa7\xad\x0b\x16\xb5\x9a\xd1\x64\ -\xd6\x1e\x32\xa0\xf8\xa0\xd4\x45\xf1\x48\x94\x3a\x62\x65\x55\xf5\ -\xd4\x6f\x44\x7d\x48\x99\xfb\xb9\x0e\x17\x7b\x80\xb3\x05\x9e\x48\ -\xa4\x66\x4d\x18\x94\xfb\x71\x0e\x1c\x2f\x99\x5f\x9e\xa5\x18\x80\ -\x80\x7c\x2f\x18\x1a\x25\xa1\x2b\x53\xf7\x36\x82\x20\x86\x1c\x80\ -\x3d\xe4\x84\x6a\x4c\xdf\xf5\x71\xe0\xa0\xb3\x09\x80\xca\x39\x1a\ -\x11\xd8\x92\x3f\x1a\x78\x12\xfd\x89\x9c\x2f\x0e\x81\xa8\x85\x0e\ -\x1f\xc7\xb8\xa5\xb0\x8d\xfe\x4f\x6b\x95\x6e\x38\xc8\x07\x62\x6d\ -\x57\x22\x9c\x0b\x1c\xc9\x34\xc9\x1b\x2e\x0b\x2c\x9e\x44\x92\x56\ -\x20\x50\x3c\xfc\xe5\xda\x63\x2e\xb7\xb0\x5e\xb1\x45\x46\xee\xee\ -\x64\xcf\xfc\xb9\x16\xee\x8e\x5c\x7c\xd9\x06\x84\x5d\x58\x5e\xad\ -\xf2\xc9\xc3\x2e\x8b\x55\x45\xd4\x42\x09\xf8\x17\x53\x12\xe2\x13\ -\x9d\x6b\x5b\xbf\x1f\x34\x8f\xb0\x77\x54\xf0\x76\x73\xce\xa9\x90\ -\x07\x9f\x66\x11\xef\xcc\x9e\xa2\xd9\x93\x8c\xfc\xfc\x48\x98\x13\ -\xbc\xb9\xea\xf2\x71\xab\xf2\xeb\xfd\xbb\xd3\x6c\x5e\x5b\xf9\xd8\ -\xfd\x5c\x4c\x43\xb3\xc2\x4a\x0a\x86\xc5\x7c\xb4\x98\x7d\x57\x55\ -\x55\x64\x04\xc7\x4a\x17\x56\x4a\x1d\xf6\xb6\xd5\x39\x83\x6a\x15\ -\xc7\x61\xf6\x96\x48\x9e\xa8\xc8\x89\x39\x9c\xba\x94\xc0\xf5\x74\ -\x88\x51\xc2\xb1\x3c\x81\xc3\x84\x50\x4f\x0f\x32\x45\x17\x1a\xc5\ -\x2c\x40\x9f\x43\x96\xea\x93\x28\x89\x90\x37\x1e\x5e\x8a\x2d\x4f\ -\x1e\xd2\x85\x99\x9f\xb9\x8b\x6b\x54\x7d\x1a\x81\x39\x6b\x43\xc0\ -\xaf\x03\xe5\x12\x86\x52\x4d\x3e\x3e\x66\x59\x06\x4b\xba\x1c\xb9\ -\x3d\xb3\x8e\x1f\xb3\x28\xbb\xef\x05\x6d\x75\xed\xf0\xeb\x82\xb6\ -\xce\x05\x6d\x51\xad\xb6\xff\xc0\x5a\xad\x90\x56\x55\x3a\x85\x7c\ -\xa6\xb6\xe5\x31\xaf\xf6\x4b\x28\xf1\x1c\xec\x77\x7d\xc6\xe0\x94\ -\x54\x58\x51\xfa\xe6\x1a\xd9\x83\x69\x71\x73\xe5\x46\x03\x49\x5d\ -\x94\xb8\x38\xe4\xa0\x59\x6a\xe3\x2c\xe4\x28\xc5\xc8\x81\x9b\x6a\ -\xc8\x04\x72\x28\x65\x29\xe8\x02\x0b\xdc\x27\x11\x18\x76\x84\x56\ -\x91\x12\xe1\xa3\x73\xb8\x3d\x76\x5f\x9c\x6e\x23\xce\x94\xdd\x20\ -\xe1\x02\x79\x40\xaf\x94\x39\x1e\x22\x42\x76\x02\x5f\xd0\x51\x03\ -\xf5\x28\x44\x4b\x61\x3e\x81\xfc\xce\x82\x7c\xab\x10\xfc\xc8\xd1\ -\x90\xcc\x83\x28\x01\xe6\xdc\x86\x05\x78\x08\x26\x03\x73\xab\x05\ -\xab\x69\xb2\x2e\x5a\x83\xb1\xef\xc1\x77\x40\x76\x1a\xba\x1f\x95\ -\xec\x1e\xb9\x5e\x38\x78\x8c\x7a\xe1\xe1\xc7\xe2\x72\x49\xb5\x00\ -\x47\xe0\x4d\x84\xc3\xbe\x8f\xa1\x38\xd0\x57\xdd\x72\xa9\xe0\xa9\ -\x97\x34\x59\x85\x20\x83\xde\x87\xc0\xa3\xd0\x3f\x9c\x96\xeb\x8d\ -\x75\x73\xf8\x72\xfe\x7a\xcf\xcb\x8e\x7e\x93\x00\xd7\x09\xbd\x60\ -\xf3\x27\x0c\xf3\xfb\xbf\x68\x29\x15\x04\xd9\x2b\x8d\xf2\x7f\xb9\ -\xee\x52\x07\xe4\x25\xc0\x07\xa3\xa3\x54\x00\x54\x5f\xaf\xdc\x23\ -\xed\x97\x33\xbe\x49\xf6\xbb\x95\x64\x9f\xe5\xf9\xfd\x4a\x9e\x2f\ -\xa5\xf8\x79\x57\x4a\x89\x3d\x07\xa9\x80\x64\x01\x46\xc3\x1b\xd9\ -\x4b\x4f\xf3\x5f\xe9\x76\xed\xb0\x66\xae\x9a\xed\xda\xce\x4e\xcd\ -\x92\x23\x23\x32\x09\x9c\x28\xcb\x53\x9d\x9b\x9e\x6a\x9f\x43\x45\ -\xfe\x9a\x04\xb8\x0f\xd4\xef\x42\x19\x3b\x37\x4a\x7e\x61\x00\x39\ -\x85\x05\xda\x22\x57\x9e\x14\x7b\xb4\x97\x85\xaf\x10\x0a\xf9\x37\ -\xff\xf2\x40\xee\xc7\x44\xe0\xd0\xe3\x1d\xf3\xd5\x01\xec\x86\xe9\ -\xd8\xd2\x50\xc9\x44\x2a\x35\x58\x52\x81\xfe\x0c\xa1\xe1\xdb\x96\ -\x11\x28\x00\xe6\xed\xae\x76\xa4\xf0\xde\x79\xb1\x23\xbd\x84\xfb\ -\x99\x7c\x99\x33\xda\x59\xbe\x9e\x27\x73\x65\xc9\x42\x6f\xaa\xd8\ -\x2d\x73\x49\x6a\xdb\x98\x5b\xb7\x81\x54\x45\xf2\xdb\xb8\x65\xf2\ -\xd4\xe2\x8d\xcb\xa5\xeb\x3b\x53\xee\x50\x5f\xc9\x40\x99\xa6\x0e\ -\x03\x57\xc7\xc6\x65\x61\x88\xd5\x61\x90\x6d\xdb\x4a\x48\x67\xeb\ -\x3f\x96\xcd\xb4\x36\ +\x00\x27\x43\x78\x9c\xed\x5a\x6d\x73\xda\x38\x10\xfe\x9e\x5f\xa1\ +\xe3\x66\xda\xbb\x99\x80\x21\x81\x34\x21\xc6\x9d\x96\x24\x4d\x66\ +\xd2\x2b\x2d\xb4\x99\xfb\xd4\x31\xb6\xc0\x6a\x65\xcb\xb1\xe4\x1a\ +\x7a\x73\xff\xfd\x56\x92\x0d\x36\x06\xf2\x02\x49\xae\x9d\xce\x24\ +\x13\x4b\xbb\xda\x5d\xad\x76\x9f\x5d\x39\x36\x5f\x4e\x7c\x8a\xbe\ +\xe1\x88\x13\x16\x74\x2a\x8d\x5a\xbd\x82\x70\xe0\x30\x97\x04\xe3\ +\x4e\xe5\xe3\xe0\xac\x7a\x58\x79\x69\xed\x98\x31\x99\x33\x35\x81\ +\xc9\xda\x41\xa6\x43\x6d\xce\xad\x37\x31\x69\xb7\x4f\x88\x4d\xd9\ +\x18\xfe\xd2\x71\x1f\x0b\x01\x8b\xf9\xab\xc8\xf1\x4c\x43\xf3\x00\ +\x73\x42\xdc\x31\x16\x48\x8d\x3b\x95\xf7\x57\x6a\x58\x41\x81\xed\ +\xe3\x4e\x65\x9d\x0c\xa9\x0a\x99\x61\xc4\x42\x1c\x89\x69\xba\x60\ +\x8c\x99\x8f\x45\x34\x55\x44\x64\x46\xd8\x11\xea\x09\x99\x13\xab\ +\x6e\x1a\x93\x74\x30\x95\x83\x69\x3a\x00\x0b\x84\x67\xb5\x5e\xb4\ +\x4c\x43\x3f\xea\x69\x0f\x93\xb1\x27\xac\x83\xbd\x23\xd3\x48\x9f\ +\x95\x4c\x23\x13\x6a\x1a\x99\xf2\x65\x96\x24\x24\x70\x59\x32\x20\ +\x82\xe2\xd4\x18\x2e\x22\xb0\xdd\x7a\x83\x03\x1c\xd9\x14\xf1\x74\ +\x2f\xa6\x91\x12\xca\x22\xa9\x3d\x65\xf1\xdc\x37\x9f\x5e\xb3\xc9\ +\xa5\x9a\x4a\x25\x2e\xa8\xe4\xa1\xed\x80\xa0\x4a\xba\x81\x20\xf6\ +\x87\x38\xb2\x0e\x4c\x23\x7d\xd2\xe6\xe7\x35\x94\x44\xf8\x76\x34\ +\x26\xc1\x82\x84\xa3\xb5\x12\x88\xc0\xfe\xdc\x93\xf9\xb3\x7c\x13\ +\xb1\x38\x04\x9b\xb3\xd3\x1c\x67\x63\xcd\x5e\x52\x2e\xe6\xce\x5a\ +\xe2\x2f\x79\xe6\xa8\xbf\xc4\x69\x65\x9b\xd6\xba\x2e\x55\x06\x51\ +\x2b\x88\x63\x53\x3d\xfb\x79\x6f\xae\x77\xbe\xa1\x25\x82\xce\x4b\ +\x82\x3c\x16\x91\xef\x2c\x10\x4b\x44\x2d\x0a\x2b\xbb\xe8\xd2\x1e\ +\x62\x9a\x49\xa2\x72\x50\x58\xbe\xc4\x47\x78\x22\x0a\x0c\x33\x3f\ +\x9d\xe0\x91\x1d\x53\x10\xcd\x28\x8b\xd0\x08\x7e\x13\x9b\xd2\x45\ +\x4f\x2d\x77\x97\x9e\xd4\xb6\xe5\x8c\x37\x8a\xd6\x97\x36\x23\x03\ +\x0e\x47\x25\x3f\xf4\xd5\xf4\xda\x6d\x00\x2f\x06\x56\x01\xb8\xb1\ +\xb0\x1b\x0c\xa1\x66\xbd\x17\xed\xf6\xf9\x4c\x9e\x69\xa8\xc9\x9b\ +\x36\x50\xce\x07\xf2\x1d\x9f\x93\x00\x4e\x8a\x0b\x17\xd2\xad\x53\ +\xa9\x2f\xba\x0e\x38\x0a\x33\x19\x1a\x34\xeb\x05\x30\x98\x51\x53\ +\x20\xd8\xab\x17\x30\x61\x6e\xd6\xa2\xc0\x15\x9e\xd6\x8e\xbb\x83\ +\xa7\x8b\x61\xa3\x60\xb1\x17\xe1\x51\x57\x9e\xf5\xeb\x58\x08\x70\ +\x63\x96\x64\x92\x16\x02\x4d\xc5\xc1\x50\xd3\xd6\x46\x14\x63\x74\ +\x40\xc2\xe5\x41\x35\xf0\x08\x47\xf0\x23\x3c\x8c\xdc\x52\x80\x05\ +\x38\x41\x57\x10\x64\x88\x0d\xbf\x00\x28\xde\x3e\xd6\x4a\x46\x28\ +\x99\x0b\x26\xa8\xb9\x05\xff\x47\xd8\xb5\xf6\x5a\x2d\x09\xc2\xee\ +\x02\x69\x1c\x61\x1c\x58\x8d\x23\x38\x1a\xfd\x58\x24\x0f\x69\x8c\ +\xad\xc6\x0b\xa0\xaa\xa7\xe2\xb1\x95\x54\xdd\xce\x6a\xe9\xe6\xd3\ +\x40\x96\x9b\x95\x11\xe6\xa4\x1e\x91\x6e\x52\xa7\x05\xca\xee\xeb\ +\x24\xa9\xae\x67\x0b\xef\x66\x6d\x6f\x99\x6b\xa4\x75\x76\x5b\xd9\ +\x6f\x1a\x1a\x09\x67\x30\x59\x20\x6f\x0a\x9a\x1b\x41\xe6\xd6\x00\ +\x13\x08\xb1\x23\xe2\x08\x3f\x1d\x6a\xde\x00\xff\xbf\x70\xf3\x31\ +\x71\xf3\xa6\x5a\xbc\x19\x72\xf6\xb3\x68\x7b\x5c\xf8\x6c\xb4\xea\ +\x6b\xe0\xf3\xe0\x68\x1d\x7c\x1e\x1e\x3c\x11\x7c\xce\x7c\xf5\x0b\ +\x43\x57\x37\x9e\x07\x9b\x35\x9e\xad\xed\x35\x9e\xea\xee\xf3\x84\ +\x20\xda\xfc\x05\xa2\xab\x7d\xfd\xd8\x20\xba\xbf\xf6\x30\xee\x02\ +\x5d\xad\xa3\x35\xc8\xb5\xbf\xb7\x0e\xb9\x9a\x4f\x85\x5c\x57\x2a\ +\x17\x7e\x5e\xd8\x2a\x12\x0b\xb2\x72\x7c\xf7\x78\x4b\x30\x2f\xbe\ +\xb7\x7b\x4f\x70\x71\xd6\x45\xc4\x0f\x59\x24\xb6\xfd\x72\x60\x7b\ +\xaf\x06\xf6\x37\x43\xe8\xf5\x99\xb4\x1a\xa1\x9f\x51\x71\xfc\xdb\ +\xc9\xbb\xee\xe0\xef\xde\x29\x3a\x1f\xbc\xbd\x44\xbd\x8f\xaf\x2f\ +\x2f\xba\xe8\xd9\x75\xcc\xc4\x71\xd5\x30\xae\xf6\xbb\x86\x71\x32\ +\x38\xd1\xd4\x66\xad\x6e\x18\xa7\x7f\x69\x6a\xca\xe4\x09\x11\xb6\ +\x0d\x23\x49\x92\x5a\xb2\x5f\x63\xd1\xd8\x18\x7c\x30\x3e\x9c\x76\ +\xab\x9e\xf0\x69\xb3\xae\x5c\xee\x88\x9a\x2b\x5c\xcd\xff\x6c\x2c\ +\x8e\x77\xa4\x62\x49\x97\x03\xf5\x8c\x6d\x37\x7b\xf6\xb1\xb0\xb5\ +\xe5\x7a\xc1\x35\xac\xf7\xe4\x1e\x52\xb5\x0e\x38\x0e\x60\x3a\xa5\ +\x36\xd2\x59\x23\x5b\xce\xc5\x94\x62\x24\xa6\x61\xb6\x5e\x2e\x85\ +\x98\xe7\x39\xf5\xe1\x2e\xa2\x04\xfd\x83\x12\x0f\x7c\x5d\x55\xb8\ +\xd7\x46\x90\x4a\xd5\x24\xb2\xc3\x63\xf4\xaf\xb2\xcf\x50\x92\x32\ +\xb1\x46\xde\xc4\x21\x73\xa7\x48\x91\x53\x1d\x50\xdd\x02\x51\x1d\ +\xd9\x3e\xa1\xd3\xf6\xf3\x13\xfc\xc5\xfe\x14\xa3\xbe\x1d\xf0\xe7\ +\x29\x49\x42\x70\xfb\x30\xcc\x38\x13\x05\xd3\xed\x66\xbd\x9e\xd1\ +\xa5\xb0\x76\xc0\x22\xdf\xa6\xc7\x0b\x8e\x0a\x8b\xaa\xf4\xab\xb8\ +\xaa\x60\x61\xbb\x1e\x4e\x66\xe3\x21\x03\x50\xf5\x0b\x53\x14\x8f\ +\x44\x61\x22\x52\x5a\xd5\x4c\xf5\x5a\x54\x87\x94\x39\x5f\xab\x80\ +\x43\xe0\xce\x36\x58\x22\x3d\x35\x1b\x02\xd3\xdc\x8e\x33\x28\xde\ +\xb2\x61\x95\xb9\x14\x81\x23\xa0\xc2\x0a\x86\x46\x71\xe0\xc8\x62\ +\xb9\x8b\x20\x88\xa1\x75\xc5\x2e\xb2\x03\xc5\xd3\x77\x3c\xec\xdb\ +\xe8\x74\x02\x4e\xe5\x1c\x8d\x08\x1c\xc9\x1f\x35\x3c\x09\xff\x44\ +\xf6\x37\x9b\x40\xd4\xc2\x84\x87\x23\xdc\x56\xbe\x0d\xff\x4f\x7b\ +\x95\x66\xd8\xc8\x03\x60\xed\x94\x22\x9c\x0b\x1c\xca\xee\x9e\xd7\ +\x1c\xe6\x1b\x3c\x0e\x25\xac\x40\xa0\xb8\xf8\xdb\x67\x97\x39\xdc\ +\xc0\x7a\xc7\x06\x19\x39\x7b\x93\xfd\xf4\xcf\x67\xe1\x34\xe4\xe6\ +\x8b\x3a\x20\xec\x82\xe2\x6e\x95\x4d\x2e\x76\x58\xa4\x7a\x90\x36\ +\x8a\xc1\xbe\x88\x92\x00\x1f\xeb\x26\xaa\xfd\x7b\xab\x7e\x88\xdd\ +\xc3\x9c\xb5\xdb\x33\x4e\x85\x3c\xd8\x34\x8b\x78\x7b\xf6\x14\xce\ +\x9e\x64\xe4\xcf\x53\x22\xcd\xe0\xed\xf5\x73\x0f\xdc\x08\x37\x6f\ +\x0f\xb3\xf3\x6e\xc6\xc3\xce\xd7\x7c\x19\x9a\xb5\x32\x92\x30\xcc\ +\xd7\xa3\xe5\xe8\xbb\xee\x32\x48\x46\x90\x56\xfa\x3e\xa8\xc4\x61\ +\x77\x57\xe5\x19\xf4\x87\x38\x0a\xb2\x97\xdb\x32\xa3\x42\x3b\xe2\ +\x58\x76\xd0\x94\xa2\x21\x46\x31\xc7\x32\x03\x87\x31\xa1\xae\x66\ +\x4a\xef\x8a\x68\x14\x31\x1f\x7d\x0d\x58\xa2\x33\x51\x02\x21\xaf\ +\xdd\xff\x06\xb9\xba\x78\x48\x13\x66\x76\xce\x4d\xdc\xe0\xb2\xaa\ +\x3d\xb0\xa0\x6d\x08\xfe\xb3\xe0\x96\x87\xa1\x4f\x93\x8f\x0f\xd9\ +\x93\xc1\x96\x2e\x46\x4e\x2f\xdd\xc7\x8f\xd9\x94\xdd\xf5\x4a\xb4\ +\xbe\x77\xf8\x75\x25\xda\xe4\x4a\xb4\xac\x57\x5b\x7f\x05\x5d\x9d\ +\x6e\xb9\xb2\xaa\xca\x29\xd4\x33\x75\x2c\x0f\x79\x99\x5e\x01\x89\ +\x67\xa0\xbf\xeb\x31\x06\x59\x52\x42\x45\x69\x9b\x93\xd2\xee\x0d\ +\x8b\xdb\x6b\x37\x6a\x48\xca\xa2\xc4\xc1\x01\x07\xc9\x52\x1a\x67\ +\x01\x47\x09\x46\x76\x84\x51\xc0\x04\xb2\x29\x65\x09\xc8\x02\x0d\ +\xdc\x23\x21\x28\xb6\x85\x16\x91\x10\xe1\xa1\x33\xb8\x3a\x76\x5f\ +\x9d\xec\x22\xce\x94\x5e\x3f\xe6\x02\xc1\xcd\x2d\xa0\xcc\x76\x11\ +\x11\x72\x12\xf0\x82\x8e\x6a\xa8\x47\x21\x5a\x72\xeb\x09\xd4\x77\ +\xe6\xcf\x8f\x0a\xc1\x8f\xe4\x86\x62\xee\x87\x31\x20\xe7\x2e\x6c\ +\xc0\x45\xb0\x18\x90\x5b\x6d\x58\x2d\x93\x7d\xd1\x06\x88\x7d\x07\ +\xbc\x03\xb0\xd3\xae\xfb\x51\xc1\xee\x81\xfb\x85\xd6\x43\xf4\x0b\ +\xf7\x4f\x8b\x8b\x15\xdd\x02\xa4\xc0\xbb\x10\x07\x7d\x0f\x43\x73\ +\xa0\xaf\xba\xc5\x56\xc1\x55\x6f\xdf\xb2\x0e\x41\x06\xbd\x07\x81\ +\x47\x61\x7e\x38\x2d\xf6\x1b\x9b\xd6\xf0\xd5\xf8\xf5\x91\x17\x0d\ +\x7d\x94\x00\xd7\x05\x3d\xa7\xf3\x27\x0c\xf3\x5b\xbd\x68\xc9\x31\ +\xe5\x38\xd2\x94\xc8\xfe\x0d\x91\x7e\x27\xd2\xa9\x1c\x54\xd2\x5b\ +\x54\xa7\xd2\x68\x54\x0c\xc9\x19\x92\x89\x6f\x87\x19\x04\x5b\xd7\ +\x3d\x35\x3e\x83\x66\xf3\x2d\xf1\x71\x1f\x50\xcd\x81\x0e\x6d\x81\ +\x4b\x7e\xf3\x03\x70\xc9\x7c\xad\x91\x2b\x4b\xf2\x33\xda\xca\xdc\ +\x77\x41\xb9\xd2\x32\xff\x16\x48\x76\x1b\x13\xb8\xf3\xbb\xdc\x4a\ +\xbf\x03\x82\x4e\x23\x9d\x50\x54\x4f\xd5\x08\x29\xc1\x90\x02\xf4\ +\x87\x41\x35\xcf\x34\x52\x82\x72\xc0\xa2\xde\xf5\x86\xe4\x5e\x62\ +\x2e\x37\xa4\x17\x73\x2f\xa3\xaf\x32\x46\x1b\xcb\x37\xb3\x64\xa1\ +\xe2\x2e\xb5\xa6\xec\xbb\x55\x26\x49\x69\x5b\x33\xeb\x26\x27\x95\ +\x3d\xf9\x38\x66\xa5\x10\xbc\xfc\xe0\xe6\xd4\xcd\x8d\x29\x4e\xa8\ +\xef\xd6\xa0\x03\x51\xc9\xc0\x55\xda\x38\x2c\x08\xb0\x4a\x06\x39\ +\x36\x8d\x98\x58\x3b\xff\x01\xea\x67\xa5\xfc\ \x00\x00\x07\x4c\ \x00\ \x00\x29\xd1\x78\x9c\xed\x59\x5b\x8f\xe2\x46\x16\x7e\xef\x5f\xe1\ @@ -10089,30 +10089,30 @@ qt_resource_struct = "\ \x00\x00\x00\x86\x00\x00\x00\x00\x00\x01\x00\x00\x3e\x30\ \x00\x00\x01\x70\x00\x00\x00\x00\x00\x01\x00\x01\x08\x08\ \x00\x00\x00\x38\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x05\x12\x00\x01\x00\x00\x00\x01\x00\x02\x30\x32\ -\x00\x00\x04\x1e\x00\x00\x00\x00\x00\x01\x00\x01\xf2\x63\ -\x00\x00\x02\xfc\x00\x00\x00\x00\x00\x01\x00\x01\xa3\xf1\ -\x00\x00\x05\xb2\x00\x01\x00\x00\x00\x01\x00\x02\x5b\xc4\ -\x00\x00\x04\xe4\x00\x01\x00\x00\x00\x01\x00\x02\x29\x60\ -\x00\x00\x03\x36\x00\x01\x00\x00\x00\x01\x00\x01\xb2\x60\ -\x00\x00\x03\x88\x00\x01\x00\x00\x00\x01\x00\x01\xc5\xe7\ -\x00\x00\x02\xa0\x00\x01\x00\x00\x00\x01\x00\x01\x89\x51\ -\x00\x00\x04\x5e\x00\x00\x00\x00\x00\x01\x00\x02\x0c\x3d\ -\x00\x00\x02\x7e\x00\x01\x00\x00\x00\x01\x00\x01\x80\x58\ -\x00\x00\x03\x64\x00\x01\x00\x00\x00\x01\x00\x01\xbb\xb8\ -\x00\x00\x02\x34\x00\x01\x00\x00\x00\x01\x00\x01\x6f\xb0\ -\x00\x00\x02\x5e\x00\x01\x00\x00\x00\x01\x00\x01\x79\x58\ -\x00\x00\x04\x8e\x00\x01\x00\x00\x00\x01\x00\x02\x1b\xab\ -\x00\x00\x03\xf4\x00\x00\x00\x00\x00\x01\x00\x01\xe1\xe2\ -\x00\x00\x04\xbc\x00\x01\x00\x00\x00\x01\x00\x02\x20\xfb\ -\x00\x00\x05\x3c\x00\x00\x00\x00\x00\x01\x00\x02\x37\x0d\ -\x00\x00\x03\xac\x00\x01\x00\x00\x00\x01\x00\x01\xca\xfe\ -\x00\x00\x05\x86\x00\x01\x00\x00\x00\x01\x00\x02\x53\x4a\ -\x00\x00\x05\x66\x00\x01\x00\x00\x00\x01\x00\x02\x49\x10\ -\x00\x00\x04\x3e\x00\x01\x00\x00\x00\x01\x00\x02\x06\x25\ -\x00\x00\x02\xd2\x00\x00\x00\x00\x00\x01\x00\x01\x91\x93\ -\x00\x00\x03\xd6\x00\x00\x00\x00\x00\x01\x00\x01\xd2\xe6\ -\x00\x00\x02\x00\x00\x01\x00\x00\x00\x01\x00\x01\x68\x60\ +\x00\x00\x05\x12\x00\x01\x00\x00\x00\x01\x00\x02\x30\x38\ +\x00\x00\x04\x1e\x00\x00\x00\x00\x00\x01\x00\x01\xf2\x69\ +\x00\x00\x02\xfc\x00\x00\x00\x00\x00\x01\x00\x01\xa3\xf7\ +\x00\x00\x05\xb2\x00\x01\x00\x00\x00\x01\x00\x02\x5b\xca\ +\x00\x00\x04\xe4\x00\x01\x00\x00\x00\x01\x00\x02\x29\x66\ +\x00\x00\x03\x36\x00\x01\x00\x00\x00\x01\x00\x01\xb2\x66\ +\x00\x00\x03\x88\x00\x01\x00\x00\x00\x01\x00\x01\xc5\xed\ +\x00\x00\x02\xa0\x00\x01\x00\x00\x00\x01\x00\x01\x89\x57\ +\x00\x00\x04\x5e\x00\x00\x00\x00\x00\x01\x00\x02\x0c\x43\ +\x00\x00\x02\x7e\x00\x01\x00\x00\x00\x01\x00\x01\x80\x5e\ +\x00\x00\x03\x64\x00\x01\x00\x00\x00\x01\x00\x01\xbb\xbe\ +\x00\x00\x02\x34\x00\x01\x00\x00\x00\x01\x00\x01\x6f\xb6\ +\x00\x00\x02\x5e\x00\x01\x00\x00\x00\x01\x00\x01\x79\x5e\ +\x00\x00\x04\x8e\x00\x01\x00\x00\x00\x01\x00\x02\x1b\xb1\ +\x00\x00\x03\xf4\x00\x00\x00\x00\x00\x01\x00\x01\xe1\xe8\ +\x00\x00\x04\xbc\x00\x01\x00\x00\x00\x01\x00\x02\x21\x01\ +\x00\x00\x05\x3c\x00\x00\x00\x00\x00\x01\x00\x02\x37\x13\ +\x00\x00\x03\xac\x00\x01\x00\x00\x00\x01\x00\x01\xcb\x04\ +\x00\x00\x05\x86\x00\x01\x00\x00\x00\x01\x00\x02\x53\x50\ +\x00\x00\x05\x66\x00\x01\x00\x00\x00\x01\x00\x02\x49\x16\ +\x00\x00\x04\x3e\x00\x01\x00\x00\x00\x01\x00\x02\x06\x2b\ +\x00\x00\x02\xd2\x00\x00\x00\x00\x00\x01\x00\x01\x91\x99\ +\x00\x00\x03\xd6\x00\x00\x00\x00\x00\x01\x00\x01\xd2\xec\ +\x00\x00\x02\x00\x00\x01\x00\x00\x00\x01\x00\x01\x68\x66\ \x00\x00\x01\xd8\x00\x01\x00\x00\x00\x01\x00\x01\x61\x46\ " diff --git a/src/Mod/Arch/Resources/ui/archprefs-base.ui b/src/Mod/Arch/Resources/ui/archprefs-base.ui index b5aa13d49..296388584 100644 --- a/src/Mod/Arch/Resources/ui/archprefs-base.ui +++ b/src/Mod/Arch/Resources/ui/archprefs-base.ui @@ -114,6 +114,47 @@ + + + + + + Default color for windows + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 59 + 132 + 146 + + + + WindowColor + + + Mod/Arch + + + + + @@ -218,19 +259,6 @@ p, li { white-space: pre-wrap; } - - - - Qt::Vertical - - - - 20 - 40 - - - - diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index f81c8a367..9cfdf57c3 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -93,7 +93,7 @@ def readOpenShell(filename): while True: obj = IfcImport.Get() - if DEBUG: print "parsing ",obj.guid,": ",obj.name," of type ",obj.type + if DEBUG: print "parsing ",obj.id,": ",obj.name," of type ",obj.type meshdata = [] n = obj.name if not n: n = "Unnamed" diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index fcf427afe..2085faf1e 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -543,6 +543,10 @@ def makeCopy(obj): import Arch Arch._Wall(newobj) Arch._ViewProviderWall(newobj.ViewObject) + elif getType(obj) == "Window": + import Arch + Arch._Window(newobj) + Arch._ViewProviderWindow(newobj.ViewObject) elif obj.isDerivedFrom("Part::Feature"): newobj.Shape = obj.Shape else: From 822308cdde0441003b230f5d37c8da512d93bd76 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 18 Jan 2012 11:03:51 -0200 Subject: [PATCH 3/6] Small fix in Arch module --- src/Mod/Arch/ArchCommands.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index 0803b5411..83f6059ad 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -215,12 +215,12 @@ def removeShape(objs,mark=True): print tp if tp == "Structure": FreeCAD.ActiveDocument.removeObject(name) - import Structure - str = Structure.makeStructure(length=dims[1],width=dims[2],height=dims[3],name=name) + import ArchStructure + str = ArchStructure.makeStructure(length=dims[1],width=dims[2],height=dims[3],name=name) str.Placement = dims[0] elif tp == "Wall": FreeCAD.ActiveDocument.removeObject(name) - import Wall + import ArchWall length = dims[1] width = dims[2] v1 = Vector(length/2,0,0) @@ -228,7 +228,7 @@ def removeShape(objs,mark=True): v1 = dims[0].multVec(v1) v2 = dims[0].multVec(v2) line = Draft.makeLine(v1,v2) - wal = Wall.makeWall(line,width=width,height=dims[3],name=name) + wal = ArchWall.makeWall(line,width=width,height=dims[3],name=name) else: if mark: obj.ViewObject.ShapeColor = (1.0,0.0,0.0,1.0) From d02c928b4be8d2f3f36e14b3b322e9fb07f3ddcd Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 19 Jan 2012 20:59:09 -0200 Subject: [PATCH 4/6] Fixed bug #574 - Draft hatches svg pattern definitions are now embedded inside the View objects, since they don't need to be in the defs section. --- src/Mod/Draft/Draft.py | 16 ++++++++++++---- src/Mod/Draft/DraftTools.py | 17 ----------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 2085faf1e..7b03d5ebd 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -1037,6 +1037,11 @@ def getSVG(obj,modifier=100,textmodifier=100,linestyle="continuous",fillstyle="s if abs(ny.getAngle(plane.v)) > 0.1: ly = -ly return Vector(lx,ly,0) + def getPattern(pat): + if pat in FreeCAD.svgpatterns: + return FreeCAD.svgpatterns[pat] + return '' + def getPath(edges): svg =' 1: wiredEdges = [] if obj.Shape.Faces: @@ -2349,9 +2356,10 @@ class _Shape2DView: pl = obj.Placement if obj.Base: if obj.Base.isDerivedFrom("Part::Feature"): - [visibleG0,visibleG1,hiddenG0,hiddenG1] = Drawing.project(obj.Base.Shape,obj.Projection) - if visibleG0: - obj.Shape = visibleG0 + if not fcvec.isNull(obj.Projection): + [visibleG0,visibleG1,hiddenG0,hiddenG1] = Drawing.project(obj.Base.Shape,obj.Projection) + if visibleG0: + obj.Shape = visibleG0 if not fcgeo.isNull(pl): obj.Placement = pl diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 312e8e59f..4fdb850a5 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -3014,7 +3014,6 @@ class Drawing(Modifier): self.page = self.createDefaultPage() sel.reverse() for obj in sel: - self.insertPattern(obj) if obj.ViewObject.isVisible(): name = 'View'+obj.Name oldobj = self.page.getObject(name) @@ -3022,22 +3021,6 @@ class Drawing(Modifier): Draft.makeDrawingView(obj,self.page) self.doc.recompute() - def insertPattern(self,obj): - "inserts a pattern object on the page" - if 'FillStyle' in obj.ViewObject.PropertiesList: - if obj.ViewObject.FillStyle != 'shape color': - hatch = obj.ViewObject.FillStyle - vobj = self.page.getObject('Pattern'+hatch) - if not vobj: - if hatch in FreeCAD.svgpatterns: - view = self.doc.addObject('Drawing::FeatureView','Pattern'+hatch) - svg = FreeCAD.svgpatterns[hatch] - view.ViewResult = svg - view.X = 0 - view.Y = 0 - view.Scale = 1 - self.page.addObject(view) - def createDefaultPage(self): "created a default page" template = Draft.getParam("template") From 7b6eab37813b225b595f7660effbb65c77687b4b Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 19 Jan 2012 21:01:57 -0200 Subject: [PATCH 5/6] Added Drawing_OpenBrowserView command While the Drawing viewer is still based on QtSvg, I added this little button to make it handy to check how a page renders in the webkit window. --- src/Mod/Drawing/Gui/Command.cpp | 39 + src/Mod/Drawing/Gui/Resources/Drawing.qrc | 1 + src/Mod/Drawing/Gui/Resources/Makefile.am | 1 + .../icons/actions/drawing-openbrowser.svg | 727 ++++++++++++++++++ src/Mod/Drawing/Gui/Workbench.cpp | 3 + 5 files changed, 771 insertions(+) create mode 100755 src/Mod/Drawing/Gui/Resources/icons/actions/drawing-openbrowser.svg diff --git a/src/Mod/Drawing/Gui/Command.cpp b/src/Mod/Drawing/Gui/Command.cpp index b4aa2640f..2dc1a4957 100644 --- a/src/Mod/Drawing/Gui/Command.cpp +++ b/src/Mod/Drawing/Gui/Command.cpp @@ -317,6 +317,44 @@ void CmdDrawingOrthoViews::activated(int iMsg) } +//=========================================================================== +// Drawing_OpenBrowserView +//=========================================================================== + +DEF_STD_CMD_A(CmdDrawingOpenBrowserView); + +CmdDrawingOpenBrowserView::CmdDrawingOpenBrowserView() + : Command("Drawing_OpenBrowserView") +{ + // seting the + sGroup = QT_TR_NOOP("Drawing"); + sMenuText = QT_TR_NOOP("Open &browser view"); + sToolTipText = QT_TR_NOOP("Opens the selected page in a browser view"); + sWhatsThis = "Drawing_OpenBrowserView"; + sStatusTip = QT_TR_NOOP("Opens the selected page in a browser view"); + sPixmap = "actions/drawing-openbrowser"; +} + +void CmdDrawingOpenBrowserView::activated(int iMsg) +{ + unsigned int n = getSelection().countObjectsOfType(Drawing::FeaturePage::getClassTypeId()); + if (n != 1) { + QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), + QObject::tr("Select one Page object.")); + return; + } + std::vector Sel = getSelection().getSelection(); + doCommand(Doc,"PageName = App.activeDocument().%s.PageResult",Sel[0].FeatName); + doCommand(Doc,"import WebGui"); + doCommand(Doc,"WebGui.openBrowser(PageName)"); +} + +bool CmdDrawingOpenBrowserView::isActive(void) +{ + return (getActiveGuiDocument() ? true : false); +} + + //=========================================================================== // Drawing_ExportPage //=========================================================================== @@ -412,6 +450,7 @@ void CreateDrawingCommands(void) rcCmdMgr.addCommand(new CmdDrawingNewA3Landscape()); rcCmdMgr.addCommand(new CmdDrawingNewView()); rcCmdMgr.addCommand(new CmdDrawingOrthoViews()); + rcCmdMgr.addCommand(new CmdDrawingOpenBrowserView()); rcCmdMgr.addCommand(new CmdDrawingExportPage()); rcCmdMgr.addCommand(new CmdDrawingProjectShape()); } diff --git a/src/Mod/Drawing/Gui/Resources/Drawing.qrc b/src/Mod/Drawing/Gui/Resources/Drawing.qrc index 6eb1358e1..853d6aa5e 100644 --- a/src/Mod/Drawing/Gui/Resources/Drawing.qrc +++ b/src/Mod/Drawing/Gui/Resources/Drawing.qrc @@ -15,6 +15,7 @@ icons/actions/drawing-portrait-A4.svg icons/actions/drawing-view.svg icons/actions/drawing-orthoviews.svg + icons/actions/drawing-openbrowser.svg translations/Drawing_af.qm translations/Drawing_de.qm translations/Drawing_es.qm diff --git a/src/Mod/Drawing/Gui/Resources/Makefile.am b/src/Mod/Drawing/Gui/Resources/Makefile.am index 19f31fdb2..dbca09f2e 100644 --- a/src/Mod/Drawing/Gui/Resources/Makefile.am +++ b/src/Mod/Drawing/Gui/Resources/Makefile.am @@ -19,6 +19,7 @@ EXTRA_DIST = \ icons/actions/drawing-landscape-new.svg \ icons/actions/drawing-portrait-A4.svg \ icons/actions/drawing-orthoviews.svg \ + icons/actions/drawing-openbrowser.svg \ icons/Page.svg \ icons/Pages.svg \ icons/View.svg \ diff --git a/src/Mod/Drawing/Gui/Resources/icons/actions/drawing-openbrowser.svg b/src/Mod/Drawing/Gui/Resources/icons/actions/drawing-openbrowser.svg new file mode 100755 index 000000000..fa26b7eac --- /dev/null +++ b/src/Mod/Drawing/Gui/Resources/icons/actions/drawing-openbrowser.svg @@ -0,0 +1,727 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/Drawing/Gui/Workbench.cpp b/src/Mod/Drawing/Gui/Workbench.cpp index 993a77462..d4816ada2 100644 --- a/src/Mod/Drawing/Gui/Workbench.cpp +++ b/src/Mod/Drawing/Gui/Workbench.cpp @@ -61,6 +61,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const *part << "Drawing_NewPage"; *part << "Drawing_NewView"; *part << "Drawing_OrthoViews"; + *part << "Drawing_OpenBrowserView"; *part << "Drawing_ExportPage"; return root; @@ -76,6 +77,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const *part << "Drawing_NewPage"; *part << "Drawing_NewView"; *part << "Drawing_OrthoViews"; + *part << "Drawing_OpenBrowserView"; *part << "Drawing_ExportPage"; return root; } @@ -92,6 +94,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const //*img << "Drawing_NewA3Landscape"; *img << "Drawing_NewPage"; *img << "Drawing_OrthoViews"; + *img << "Drawing_OpenBrowserView"; img = new Gui::ToolBarItem(root); img->setCommand("Views"); *img << "Drawing_NewView"; From 1bcf31fd3a176af71cadc9aa35d3c2c39c7f5775 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 19 Jan 2012 22:42:09 -0200 Subject: [PATCH 6/6] allowed BrowserView to zoom with Ctrl+Wheel --- src/Mod/Web/Gui/BrowserView.cpp | 68 +++++++++++++++++++++++---------- src/Mod/Web/Gui/BrowserView.h | 13 ++++++- 2 files changed, 60 insertions(+), 21 deletions(-) diff --git a/src/Mod/Web/Gui/BrowserView.cpp b/src/Mod/Web/Gui/BrowserView.cpp index b9f04ee4e..7410edc1d 100644 --- a/src/Mod/Web/Gui/BrowserView.cpp +++ b/src/Mod/Web/Gui/BrowserView.cpp @@ -35,6 +35,7 @@ # include # include # include +# include # if QT_VERSION >= 0x040400 # include # include @@ -62,6 +63,27 @@ using namespace WebGui; using namespace Gui; +/** + * Constructs a WebView widget which can be zoomed with Ctrl+Mousewheel + * + */ + +WebView::WebView(QWidget *parent) + : QWebView(parent) +{ +} + +void WebView::wheelEvent(QWheelEvent *event) +{ + if (QApplication::keyboardModifiers() & Qt::ControlModifier) + { + qreal factor = zoomFactor() + (-event->delta() / 800.0); + setZoomFactor(factor); + event->accept(); + return; + } + QWebView::wheelEvent(event); +} /* TRANSLATOR Gui::BrowserView */ @@ -75,28 +97,34 @@ BrowserView::BrowserView(QWidget* parent) isLoading(false), textSizeMultiplier(1.0) { - WebView = new QWebView(this); - setCentralWidget(WebView); + view = new WebView(this); + setCentralWidget(view); - WebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); - WebView->page()->setForwardUnsupportedContent(true); + view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); + view->page()->setForwardUnsupportedContent(true); - connect(WebView, SIGNAL(loadStarted()), + // setting background to white + QPalette palette = view->palette(); + palette.setBrush(QPalette::Base, Qt::white); + view->page()->setPalette(palette); + view->setAttribute(Qt::WA_OpaquePaintEvent, true); + + connect(view, SIGNAL(loadStarted()), this, SLOT(onLoadStarted())); - connect(WebView, SIGNAL(loadProgress(int)), + connect(view, SIGNAL(loadProgress(int)), this, SLOT(onLoadProgress(int))); - connect(WebView, SIGNAL(loadFinished(bool)), + connect(view, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished())); - connect(WebView, SIGNAL(linkClicked(const QUrl &)), + connect(view, SIGNAL(linkClicked(const QUrl &)), this, SLOT(onLinkClicked(const QUrl &))); - connect(WebView->page(), SIGNAL(downloadRequested(const QNetworkRequest &)), + connect(view->page(), SIGNAL(downloadRequested(const QNetworkRequest &)), this, SLOT(onDownloadRequested(const QNetworkRequest &))); } /** Destroys the object and frees any allocated resources */ BrowserView::~BrowserView() { - delete WebView; + delete view; } void BrowserView::onLinkClicked (const QUrl & url) @@ -168,8 +196,8 @@ void BrowserView::load(const QUrl & url) if(isLoading) stop(); - WebView->load(url); - WebView->setUrl(url); + view->load(url); + view->setUrl(url); if (url.scheme().size() < 2) { QString path = url.path(); QFileInfo fi(path); @@ -189,14 +217,14 @@ void BrowserView::setHtml(const QString& HtmlCode,const QUrl & BaseUrl,const QSt if (isLoading) stop(); - WebView->setHtml(HtmlCode,BaseUrl); + view->setHtml(HtmlCode,BaseUrl); setWindowTitle(TabName); setWindowIcon(QWebSettings::iconForUrl(BaseUrl)); } void BrowserView::stop(void) { - WebView->stop(); + view->stop(); } void BrowserView::onLoadStarted() @@ -204,7 +232,7 @@ void BrowserView::onLoadStarted() QProgressBar* bar = Gui::Sequencer::instance()->getProgressBar(); bar->setRange(0, 100); bar->show(); - Gui::getMainWindow()->statusBar()->showMessage(tr("Loading %1...").arg(WebView->url().toString())); + Gui::getMainWindow()->statusBar()->showMessage(tr("Loading %1...").arg(view->url().toString())); isLoading = true; } @@ -233,24 +261,24 @@ void BrowserView::OnChange(Base::Subject &rCaller,const char* rcRea bool BrowserView::onMsg(const char* pMsg,const char** ppReturn) { if (strcmp(pMsg,"Back")==0){ - WebView->back(); + view->back(); return true; } else if (strcmp(pMsg,"Next")==0){ - WebView->forward(); + view->forward(); return true; } else if (strcmp(pMsg,"Refresh")==0){ - WebView->reload(); + view->reload(); return true; } else if (strcmp(pMsg,"Stop")==0){ stop(); return true; } else if (strcmp(pMsg,"ZoomIn")==0){ textSizeMultiplier += 0.2f; - WebView->setTextSizeMultiplier(textSizeMultiplier); + view->setTextSizeMultiplier(textSizeMultiplier); return true; } else if (strcmp(pMsg,"ZoomOut")==0){ textSizeMultiplier -= 0.2f; - WebView->setTextSizeMultiplier(textSizeMultiplier); + view->setTextSizeMultiplier(textSizeMultiplier); return true; } diff --git a/src/Mod/Web/Gui/BrowserView.h b/src/Mod/Web/Gui/BrowserView.h index bb2ada13c..c32dfd659 100644 --- a/src/Mod/Web/Gui/BrowserView.h +++ b/src/Mod/Web/Gui/BrowserView.h @@ -28,13 +28,24 @@ #include #include +# if QT_VERSION >= 0x040400 +#include +#endif + class QWebView; class QUrl; class QNetworkRequest; namespace WebGui { +class WebGuiExport WebView : public QWebView +{ + Q_OBJECT +public: + WebView(QWidget *parent = 0); + void wheelEvent(QWheelEvent *event); +}; /** * A special view class which sends the messages from the application to @@ -87,7 +98,7 @@ protected Q_SLOTS: void onDownloadRequested(const QNetworkRequest & request); private: - QWebView* WebView; + WebView* view; bool isLoading; float textSizeMultiplier; };