chiark / gitweb /
Add youmagine uploader (inactive, no API urls filled)
[cura.git] / Cura / gui / mainWindow.py
index 0ce1827dfdc562c799ae1123d06b8d9c5f25d329..e432b8a81533d06ac892f797ae9c8183e52d1f09 100644 (file)
@@ -18,9 +18,11 @@ from Cura.gui.util import dropTarget
 #from Cura.gui.tools import batchRun
 from Cura.gui.tools import pidDebugger
 from Cura.gui.tools import minecraftImport
+from Cura.gui.tools import youmagineGui
 from Cura.util import profile
 from Cura.util import version
 from Cura.util import meshLoader
+from Cura.util import resources
 
 class mainWindow(wx.Frame):
        def __init__(self):
@@ -165,9 +167,14 @@ class mainWindow(wx.Frame):
                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.SetToolTipString("Share your design to YouMagine.com")
+               self.youmagineButton.Bind(wx.EVT_BUTTON, self.OnYouMagine)
+
                self.leftSizer = wx.BoxSizer(wx.VERTICAL)
-               self.leftSizer.Add(self.simpleSettingsPanel)
+               self.leftSizer.Add(self.simpleSettingsPanel, 1)
                self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND)
+               self.leftSizer.Add(self.youmagineButton, 0, wx.ALIGN_CENTER)
                self.leftPane.SetSizer(self.leftSizer)
                
                #Preview window
@@ -248,6 +255,7 @@ class mainWindow(wx.Frame):
                        
                        # Change location of sash to width of quick mode pane 
                        (width, height) = self.simpleSettingsPanel.GetSizer().GetSize() 
+                       (width, height) = self.youmagineButton.GetSize()
                        self.splitter.SetSashPosition(width, True)
                        
                        # Disable sash
@@ -257,7 +265,7 @@ class mainWindow(wx.Frame):
                        # Enabled sash
                        self.splitter.SetSashSize(4)
                self.scene.updateProfileToControls()
-                                                               
+
        def OnPreferences(self, e):
                prefDialog = preferencesDialog.preferencesDialog(self)
                prefDialog.Centre()
@@ -356,11 +364,6 @@ class mainWindow(wx.Frame):
                        profile.resetProfile()
                        self.updateProfileToControls()
 
-       def OnBatchRun(self, e):
-               br = batchRun.batchRunWindow(self)
-               br.Centre()
-               br.Show(True)
-
        def OnSimpleSwitch(self, e):
                profile.putPreference('startMode', 'Simple')
                self.updateSliceMode()
@@ -409,6 +412,12 @@ class mainWindow(wx.Frame):
                debugger.Centre()
                debugger.Show(True)
 
+       def OnYouMagine(self, e):
+               if len(self.scene._scene.objects()) < 1:
+                       wx.MessageBox('You cannot upload to YouMagine without have a file loaded.', 'Cura', wx.OK | wx.ICON_ERROR)
+                       return
+               youmagineGui.youmagineManager(self, self.scene._scene)
+
        def OnCheckForUpdate(self, e):
                newVersion = version.checkForNewerVersion()
                if newVersion is not None: