chiark / gitweb /
Change how the engine is interfaced from the python code. Put the GCode viewer in...
[cura.git] / Cura / gui / mainWindow.py
index d58b3a6093d7bb72d34c65a39d93c92a1255ad78..590252a53d3bc4adfbe1d1751e5894bcd36ce187 100644 (file)
@@ -27,8 +27,6 @@ class mainWindow(wx.Frame):
        def __init__(self):
                super(mainWindow, self).__init__(None, title='Cura - ' + version.getVersion())
 
-               self.extruderCount = int(profile.getMachineSetting('extruder_amount'))
-
                wx.EVT_CLOSE(self, self.OnClose)
 
                # allow dropping any file, restrict later
@@ -124,6 +122,17 @@ class mainWindow(wx.Frame):
 
                i = toolsMenu.Append(-1, _("Copy profile to clipboard"))
                self.Bind(wx.EVT_MENU, self.onCopyProfileClipboard,i)
+
+               toolsMenu.AppendSeparator()
+               self.allAtOnceItem = toolsMenu.Append(-1, _("Print all at once"), kind=wx.ITEM_RADIO)
+               self.Bind(wx.EVT_MENU, self.onOneAtATimeSwitch, self.allAtOnceItem)
+               self.oneAtATime = toolsMenu.Append(-1, _("Print one at a time"), kind=wx.ITEM_RADIO)
+               self.Bind(wx.EVT_MENU, self.onOneAtATimeSwitch, self.oneAtATime)
+               if profile.getPreference('oneAtATime') == 'True':
+                       self.oneAtATime.Check(True)
+               else:
+                       self.allAtOnceItem.Check(True)
+
                self.menubar.Append(toolsMenu, _("Tools"))
 
                #Machine menu for machine configuration/tooling
@@ -142,7 +151,7 @@ class mainWindow(wx.Frame):
                self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i)
                expertMenu.AppendSeparator()
 
-               i = expertMenu.Append(-1, _("Open expert settings..."))
+               i = expertMenu.Append(-1, _("Open expert settings...\tCTRL+E"))
                self.normalModeOnlyItems.append(i)
                self.Bind(wx.EVT_MENU, self.OnExpertOpen, i)
                expertMenu.AppendSeparator()
@@ -150,11 +159,8 @@ class mainWindow(wx.Frame):
                self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i)
                self.bedLevelWizardMenuItem = expertMenu.Append(-1, _("Run bed leveling wizard..."))
                self.Bind(wx.EVT_MENU, self.OnBedLevelWizard, self.bedLevelWizardMenuItem)
-               if self.extruderCount > 1:
-                       self.headOffsetWizardMenuItem = expertMenu.Append(-1, _("Run head offset wizard..."))
-                       self.Bind(wx.EVT_MENU, self.OnHeadOffsetWizard, self.headOffsetWizardMenuItem)
-               else:
-                       self.headOffsetWizardMenuItem = None
+               self.headOffsetWizardMenuItem = expertMenu.Append(-1, _("Run head offset wizard..."))
+               self.Bind(wx.EVT_MENU, self.OnHeadOffsetWizard, self.headOffsetWizardMenuItem)
 
                self.menubar.Append(expertMenu, _("Expert"))
 
@@ -250,6 +256,7 @@ class mainWindow(wx.Frame):
                        self.Centre()
 
                self.updateSliceMode()
+               self.scene.SetFocus()
 
        def onTimer(self, e):
                #Check if there is something in the clipboard
@@ -310,20 +317,30 @@ class mainWindow(wx.Frame):
                self.defaultFirmwareInstallMenuItem.Enable(firmwareInstall.getDefaultFirmware() is not None)
                if profile.getMachineSetting('machine_type') == 'ultimaker2':
                        self.bedLevelWizardMenuItem.Enable(False)
-                       if self.headOffsetWizardMenuItem is not None:
-                               self.headOffsetWizardMenuItem.Enable(False)
+                       self.headOffsetWizardMenuItem.Enable(False)
+               if int(profile.getMachineSetting('extruder_amount')) < 2:
+                       self.headOffsetWizardMenuItem.Enable(False)
+               self.scene.updateProfileToControls()
+
+       def onOneAtATimeSwitch(self, e):
+               profile.putPreference('oneAtATime', self.oneAtATime.IsChecked())
+               if self.oneAtATime.IsChecked() and profile.getMachineSettingFloat('extruder_head_size_height') < 1:
+                       wx.MessageBox(_('For "One at a time" printing, you need to have entered the correct head size and gantry height in the machine settings'), _('One at a time warning'), wx.OK | wx.ICON_WARNING)
                self.scene.updateProfileToControls()
+               self.scene.sceneUpdated()
 
        def OnPreferences(self, e):
                prefDialog = preferencesDialog.preferencesDialog(self)
                prefDialog.Centre()
                prefDialog.Show()
+               prefDialog.Raise()
                wx.CallAfter(prefDialog.Show)
 
        def OnMachineSettings(self, e):
                prefDialog = preferencesDialog.machineSettingsDialog(self)
                prefDialog.Centre()
                prefDialog.Show()
+               prefDialog.Raise()
 
        def OnDropFiles(self, files):
                if len(files) > 0:
@@ -398,8 +415,9 @@ class mainWindow(wx.Frame):
                        self.Bind(wx.EVT_MENU, lambda e: self.OnSelectMachine(e.GetId() - 0x1000), i)
 
                self.machineMenu.AppendSeparator()
-               i = self.machineMenu.Append(-1, _("Add new machine..."))
-               self.Bind(wx.EVT_MENU, self.OnAddNewMachine, i)
+
+               i = self.machineMenu.Append(-1, _("Machine settings..."))
+               self.Bind(wx.EVT_MENU, self.OnMachineSettings, i)
 
                #Add tools for machines.
                self.machineMenu.AppendSeparator()
@@ -484,14 +502,6 @@ class mainWindow(wx.Frame):
                self.Show()
                self.reloadSettingPanels()
 
-       def OnAddNewMachine(self, e):
-               self.Hide()
-               profile.setActiveMachine(profile.getMachineCount())
-               configWizard.configWizard(True)
-               self.Show()
-               self.reloadSettingPanels()
-               self.updateMachineMenu()
-
        def OnSelectMachine(self, index):
                profile.setActiveMachine(index)
                self.reloadSettingPanels()
@@ -565,7 +575,7 @@ class mainWindow(wx.Frame):
                #HACK: Set the paint function of the glCanvas to nothing so it won't keep refreshing. Which can keep wxWidgets from quiting.
                print "Closing down"
                self.scene.OnPaint = lambda e : e
-               self.scene._slicer.cleanup()
+               self.scene._engine.cleanup()
                self.Destroy()
 
        def OnQuit(self, e):