From: daid303 Date: Fri, 8 Mar 2013 13:13:54 +0000 (+0100) Subject: Update the statistics upload with preferences and version info. X-Git-Tag: 13.03 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=636ee8b6f6bb5cc15a47cfcb55fc68c10a76e498;p=cura.git Update the statistics upload with preferences and version info. --- diff --git a/Cura/gui/preview3d.py b/Cura/gui/preview3d.py index df36953e..77b8bdc2 100644 --- a/Cura/gui/preview3d.py +++ b/Cura/gui/preview3d.py @@ -98,6 +98,10 @@ class previewPanel(wx.Panel): self.sliceButton = openglGui.glButton(self.glCanvas, 5, 'Prepare', (1,0), lambda : self.GetParent().GetParent().GetParent().OnSlice(None)) self.printButton = openglGui.glButton(self.glCanvas, 6, 'Print', (2,0), lambda : self.GetParent().GetParent().GetParent().OnPrint(None)) + self.rotateToolButton.setExpandArrow(True) + self.scaleToolButton.setExpandArrow(True) + self.mirrorToolButton.setExpandArrow(True) + extruderCount = int(profile.getPreference('extruder_amount')) if extruderCount > 1: openglGui.glButton(self.glCanvas, 4, 'Load dual', (0,1), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(2)) diff --git a/Cura/gui/util/openglGui.py b/Cura/gui/util/openglGui.py index 43847525..1782d1fe 100644 --- a/Cura/gui/util/openglGui.py +++ b/Cura/gui/util/openglGui.py @@ -328,10 +328,14 @@ class glButton(glGuiControl): self._focus = False self._hidden = False self._disabled = False + self._showExpandArrow = False def setSelected(self, value): self._selected = value + def setExpandArrow(self, value): + self._showExpandArrow = value + def setHidden(self, value): self._hidden = value @@ -369,6 +373,11 @@ class glButton(glGuiControl): glColor4ub(255,255,255,255) opengl.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, 0) opengl.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, self._imageID) + if self._showExpandArrow: + if self._selected: + opengl.glDrawTexturedQuad(pos[0]+bs*scale/2-bs*scale/4*1.2, pos[1]-bs*scale/2*1.2, bs*scale/4, bs*scale/4, 1) + else: + opengl.glDrawTexturedQuad(pos[0]+bs*scale/2-bs*scale/4*1.2, pos[1]-bs*scale/2*1.2, bs*scale/4, bs*scale/4, 1, 2) glPushMatrix() glTranslatef(pos[0], pos[1], 0) glDisable(GL_TEXTURE_2D) diff --git a/Cura/resources/images/glButtons.png b/Cura/resources/images/glButtons.png index 51db5c73..9d079212 100644 Binary files a/Cura/resources/images/glButtons.png and b/Cura/resources/images/glButtons.png differ diff --git a/Cura/slice/__main__.py b/Cura/slice/__main__.py index 9f4e5858..eecb3f48 100644 --- a/Cura/slice/__main__.py +++ b/Cura/slice/__main__.py @@ -15,6 +15,7 @@ if not hasattr(sys, 'frozen'): sys.path.append(cura_sf_path) from Cura.util import profile +from Cura.util import version from Cura.slice.cura_sf.skeinforge_application.skeinforge_plugins.craft_plugins import export def fixUTF8(input): @@ -108,10 +109,12 @@ def main(): 'machine': platform.machine(), 'platform': platform.platform(), 'profile': profile.getGlobalProfileString(), + 'preferences': profile.getGlobalPreferencesString(), 'modelhash': m.hexdigest(), + 'version': version.getVersion(), } try: - f = urllib2.urlopen("http://software.ultimaker.com/upload_stats.php", data = urllib.urlencode(data), timeout = 5); + f = urllib2.urlopen("http://platform.ultimaker.com/curastats/", data = urllib.urlencode(data), timeout = 5); f.read() f.close() except: diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 823fe3e9..023fae49 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -284,6 +284,24 @@ def getGlobalProfileString(): ret = base64.b64encode(zlib.compress(ret, 9)) return ret +def getGlobalPreferencesString(): + global globalPreferenceParser + if globalPreferenceParser is None: + globalPreferenceParser = ConfigParser.ConfigParser() + try: + globalPreferenceParser.read(getPreferencePath()) + except ConfigParser.ParsingError: + pass + + p = [] + if globalPreferenceParser.has_section('preference'): + for key in globalPreferenceParser.options('preference'): + p.append(key + "=" + globalPreferenceParser.get('preference', key)) + ret = '\b'.join(p) + ret = base64.b64encode(zlib.compress(ret, 9)) + return ret + + def getProfileSetting(name): if name in tempOverride: return unicode(tempOverride[name], "utf-8")