From 274dc09248d06f641e74cbd93435fff60ff4a114 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sun, 9 Mar 2014 18:49:35 -0300 Subject: [PATCH 1/4] Draft: Small fix in hatch patterns --- src/Mod/Draft/Draft.py | 62 ++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index f690ac220..49ecc0ace 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -2815,6 +2815,7 @@ class _ViewProviderDraft: self.texture = None self.texcoords = None self.Object = vobj.Object + self.onChanged(vobj,"Pattern") return def updateData(self, obj, prop): @@ -2842,35 +2843,38 @@ class _ViewProviderDraft: if hasattr(vobj,"Pattern"): if str(vobj.Pattern) in svgpatterns().keys(): path = svgpatterns()[vobj.Pattern][1] - if path: - r = vobj.RootNode.getChild(2).getChild(0).getChild(2) - i = QtCore.QFileInfo(path) - if self.texture: - r.removeChild(self.texture) - self.texture = None - if self.texcoords: - r.removeChild(self.texcoords) - self.texcoords = None - if i.exists(): - size = None - if ".SVG" in path.upper(): - size = getParam("HatchPatternResolution",128) - if not size: - size = 128 - im = loadTexture(path, size) - if im: - self.texture = coin.SoTexture2() - self.texture.image = im - r.insertChild(self.texture,1) - if size: - s =1 - if hasattr(vobj,"PatternSize"): - if vobj.PatternSize: - s = vobj.PatternSize - self.texcoords = coin.SoTextureCoordinatePlane() - self.texcoords.directionS.setValue(s,0,0) - self.texcoords.directionT.setValue(0,s,0) - r.insertChild(self.texcoords,2) + if path and vobj.RootNode: + if vobj.RootNode.getChildren().getLength() > 2: + if vobj.RootNode.getChild(2).getChildren().getLength() > 0: + if vobj.RootNode.getChild(2).getChild(0).getChildren().getLength() > 2: + r = vobj.RootNode.getChild(2).getChild(0).getChild(2) + i = QtCore.QFileInfo(path) + if self.texture: + r.removeChild(self.texture) + self.texture = None + if self.texcoords: + r.removeChild(self.texcoords) + self.texcoords = None + if i.exists(): + size = None + if ".SVG" in path.upper(): + size = getParam("HatchPatternResolution",128) + if not size: + size = 128 + im = loadTexture(path, size) + if im: + self.texture = coin.SoTexture2() + self.texture.image = im + r.insertChild(self.texture,1) + if size: + s =1 + if hasattr(vobj,"PatternSize"): + if vobj.PatternSize: + s = vobj.PatternSize + self.texcoords = coin.SoTextureCoordinatePlane() + self.texcoords.directionS.setValue(s,0,0) + self.texcoords.directionT.setValue(0,s,0) + r.insertChild(self.texcoords,2) elif prop == "PatternSize": if hasattr(self,"texcoords"): if self.texcoords: From 6441ca3ef147d1d40b0c61b1e0f39dafd5021533 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sun, 9 Mar 2014 18:50:13 -0300 Subject: [PATCH 2/4] Start: minor text correction --- src/Mod/Start/StartPage/StartPage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Start/StartPage/StartPage.py b/src/Mod/Start/StartPage/StartPage.py index 1c0c21d4c..1c5156b59 100644 --- a/src/Mod/Start/StartPage/StartPage.py +++ b/src/Mod/Start/StartPage/StartPage.py @@ -156,11 +156,11 @@ page = """ function load() { ddiv = document.getElementById("news"); - ddiv.innerHTML = "Fetching data from the web..."; + ddiv.innerHTML = "Connecting..."; var tobj=new JSONscriptRequest('http://pipes.yahoo.com/pipes/pipe.run?_id=da8b612e97a6bb4588b1ce27db30efd9&_render=json&_callback=showTweets'); tobj.buildScriptTag(); // Build the script tag tobj.addScriptTag(); // Execute (add) the script tag - ddiv.innerHTML = "Done fetching"; + ddiv.innerHTML = "Downloading latest news..."; } function stripTags(text) { From eed8ec27df8702402e0cee6126ea054024dd5b1f Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sun, 9 Mar 2014 19:44:36 -0300 Subject: [PATCH 3/4] Arch: Don't create a drawing view on section plane creation This was very heavy and often caused unnecessary computations. Adding a new Drawing view is now done manually, with the Draft to Drawing tool --- src/Mod/Arch/ArchSectionPlane.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index 2824c3d4a..d4e8b02bb 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -86,7 +86,7 @@ class _CommandSectionPlane: FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Section Plane")) FreeCADGui.doCommand("import Arch") FreeCADGui.doCommand("section = Arch.makeSectionPlane("+ss+")") - FreeCADGui.doCommand("Arch.makeSectionView(section)") + #FreeCADGui.doCommand("Arch.makeSectionView(section)") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() From 664c50b6b6b0c50a4825f52accc1921204c4f3b3 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sun, 9 Mar 2014 22:13:15 -0300 Subject: [PATCH 4/4] Spreadsheet: small bugfixes --- src/Mod/Spreadsheet/Spreadsheet.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Mod/Spreadsheet/Spreadsheet.py b/src/Mod/Spreadsheet/Spreadsheet.py index 30d05924a..75b90b571 100644 --- a/src/Mod/Spreadsheet/Spreadsheet.py +++ b/src/Mod/Spreadsheet/Spreadsheet.py @@ -519,10 +519,10 @@ class SpreadsheetController: elif obj.FilterType == "Object Name": for o in baseset: if obj.Filter: - if obj.Filter in obl.Label: - result.append(obj) + if obj.Filter in o.Label: + result.append(o) else: - result.append(obj) + result.append(o) return result def getCells(self,obj,spreadsheet): @@ -531,7 +531,7 @@ class SpreadsheetController: if obj.BaseCell: if obj.DataType == "Count": return obj.BaseCell - for i in range(len(self.getDataSet())): + for i in range(len(self.getDataSet(obj))): # get the correct cell key c,r = spreadsheet.Proxy.splitKey(obj.BaseCell) if obj.Direction == "Horizontal": @@ -546,7 +546,7 @@ class SpreadsheetController: def setCells(self,obj,spreadsheet): "Fills the controlled cells of the given spreadsheet" if obj.BaseCell: - dataset = self.getDataSet() + dataset = self.getDataSet(obj) if obj.DataType == "Count": if spreadsheet.Proxy.isKey(obj.BaseCell): try: @@ -570,6 +570,7 @@ class SpreadsheetController: args = obj.Data.split(".") value = dataset[i] for arg in args: + print arg if hasattr(value,arg): value = getattr(value,arg) try: @@ -660,7 +661,8 @@ class SpreadsheetView(QtGui.QWidget): if cell in controlled: brush = QtGui.QBrush(QtGui.QColor(255, 0, 0)) brush.setStyle(QtCore.Qt.Dense6Pattern) - self.table.item(r,c).setBackground(brush) + if self.table.item(r,c): + self.table.item(r,c).setBackground(brush) def changeCell(self,r,c,value=None): "changes the contens of a cell"