class FirmwareUpgradePage(InfoPage):
def __init__(self, parent):
super(FirmwareUpgradePage, self).__init__(parent, "Upgrade Ultimaker Firmware")
- self.AddText(
- 'Firmware is the piece of software running directly on your 3D printer.\nThis firmware controls the step motors, regulates the temperature\nand ultimately makes your printer work.')
+ self.AddText('Firmware is the piece of software running directly on your 3D printer.\nThis firmware controls the step motors, regulates the temperature\nand ultimately makes your printer work.')
self.AddHiddenSeperator()
- self.AddText(
- 'The firmware shipping with new Ultimakers works, but upgrades\nhave been made to make better prints, and make calibration easier.')
+ self.AddText('The firmware shipping with new Ultimakers works, but upgrades\nhave been made to make better prints, and make calibration easier.')
self.AddHiddenSeperator()
- self.AddText(
- 'Cura requires these new features and thus\nyour firmware will most likely need to be upgraded.\nYou will get the chance to do so now.')
+ self.AddText('Cura requires these new features and thus\nyour firmware will most likely need to be upgraded.\nYou will get the chance to do so now.')
upgradeButton, skipUpgradeButton = self.AddDualButton('Upgrade to Marlin firmware', 'Skip upgrade')
upgradeButton.Bind(wx.EVT_BUTTON, self.OnUpgradeClick)
skipUpgradeButton.Bind(wx.EVT_BUTTON, self.OnSkipClick)
self.GetParent().ShowPage(self.GetNext())
def OnUrlClick(self, e):
- webbrowser.open('http://daid.mine.nu/~daid/marlin_build/')
+ webbrowser.open('http://marlinbuilder.robotfuzz.com/')
class UltimakerCheckupPage(InfoPage):
self.simpleSettingsPanel = simpleMode.simpleModePanel(self.leftPane, lambda : self.scene.sceneUpdated())
self.normalSettingsPanel = normalSettingsPanel(self.leftPane, lambda : self.scene.sceneUpdated())
- self.youmagineButton = wx.BitmapButton(self.leftPane, -1, wx.Bitmap(resources.getPathForImage('youmagine-text.png')))
+ self.youmagineButton = wx.BitmapButton(self.leftPane, -1, wx.Bitmap(resources.getPathForImage('youmagine-icon.png')))
self.youmagineButton.SetToolTipString("Share your design to YouMagine.com")
self.youmagineButton.Bind(wx.EVT_BUTTON, self.OnYouMagine)
def __init__(self, parent, objectScene):
self._mainWindow = parent
self._scene = objectScene
- self._ym = youmagine.Youmagine(profile.getPreference('youmagine_token'))
+ self._ym = youmagine.Youmagine(profile.getPreference('youmagine_token'), self._progressCallback)
self._indicatorWindow = workingIndicatorWindow(self._mainWindow)
self._getAuthorizationWindow = getAuthorizationWindow(self._mainWindow, self._ym)
thread.daemon = True
thread.start()
+ def _progressCallback(self, progress):
+ self._indicatorWindow.progress(progress)
+
#Do all the youmagine communication in a background thread, because it can take a while and block the UI thread otherwise
def checkAuthorizationThread(self):
wx.CallAfter(self._indicatorWindow.showBusy, 'Checking token')
self._indicatorBitmap = wx.StaticBitmap(self._panel, -1, wx.EmptyBitmapRGBA(24, 24, red=255, green=255, blue=255, alpha=1))
self._statusText = wx.StaticText(self._panel, -1, '...')
+ self._progress = wx.Gauge(self._panel, -1)
+ self._progress.SetRange(1000)
+ self._progress.SetMinSize((250, 30))
self._panel._sizer = wx.GridBagSizer(2, 2)
self._panel.SetSizer(self._panel._sizer)
self._panel._sizer.Add(self._indicatorBitmap, (0, 0))
self._panel._sizer.Add(self._statusText, (0, 1), flag=wx.ALIGN_CENTER_VERTICAL)
+ self._panel._sizer.Add(self._progress, (1, 0), span=(1,2), flag=wx.EXPAND)
self._busyState = 0
self._busyTimer = wx.Timer(self)
self._busyState = 0
self._indicatorBitmap.SetBitmap(self._busyBitmaps[self._busyState])
+ def progress(self, progressAmount):
+ wx.CallAfter(self._progress.Show)
+ wx.CallAfter(self._progress.SetValue, progressAmount*1000)
+ wx.CallAfter(self.Layout)
+ wx.CallAfter(self.Fit)
+
def showBusy(self, text):
self._statusText.SetLabel(text)
+ self._progress.Hide()
+ self.Layout()
self.Fit()
self.Centre()
self.Show()
from __future__ import absolute_import
__copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
-import sys
import json
import httplib as httpclient
import urllib
-import cStringIO as StringIO
+
+class httpUploadDataStream(object):
+ def __init__(self, progressCallback):
+ self._dataList = []
+ self._totalLength = 0
+ self._readPos = 0
+ self._progressCallback = progressCallback
+
+ def write(self, data):
+ size = len(data)
+ if size < 1:
+ return
+ blocks = size / 2048
+ for n in xrange(0, blocks):
+ self._dataList.append(data[n*2048:n*2048+2048])
+ self._dataList.append(data[blocks*2048:])
+ self._totalLength += size
+
+ def read(self, size):
+ if self._readPos >= len(self._dataList):
+ return None
+ ret = self._dataList[self._readPos]
+ self._readPos += 1
+ if self._progressCallback is not None:
+ self._progressCallback(float(self._readPos / len(self._dataList)))
+ return ret
+
+ def __len__(self):
+ return self._totalLength
class Youmagine(object):
- def __init__(self, authToken):
- self._hostUrl = ''
- self._viewUrl = ''
- self._authUrl = ''
+ def __init__(self, authToken, progressCallback = None):
+ self._hostUrl = 'api.youmagine.com'
+ self._viewUrl = 'www.youmagine.com'
+ self._authUrl = 'https://www.youmagine.com/integrations/cura/authorized_integrations/new'
self._authToken = authToken
self._userName = None
self._userID = None
self._http = None
self._hostReachable = True
+ self._progressCallback = progressCallback
self._categories = [
('Art', 2),
('Fashion', 3),
try:
if files is not None:
boundary = 'wL36Yn8afVp8Ag7AmP8qZ0SA4n1v9T'
- s = StringIO.StringIO()
+ s = httpUploadDataStream(self._progressCallback)
for k, v in files.iteritems():
filename = v[0]
fileContents = v[1]
s.write('\r\n')
s.write('--%s--\r\n' % (boundary))
- s = s.getvalue()
- self._http.request(method, url, StringIO.StringIO(s), {"Content-type": "multipart/form-data; boundary=%s" % (boundary), "Content-Length": len(s)})
+ self._http.request(method, url, s, {"Content-type": "multipart/form-data; boundary=%s" % (boundary), "Content-Length": len(s)})
elif postData is not None:
self._http.request(method, url, urllib.urlencode(postData), {"Content-type": "application/x-www-form-urlencoded"})
else:
return json.loads(responseText)
except ValueError:
print response.getheaders()
+ print responseText
error = 'Failed to decode JSON response'
self._hostReachable = False
return {'error': error}