From: Youness Alaoui Date: Thu, 30 Jul 2015 18:03:55 +0000 (-0400) Subject: Show machine_name (toolhead_shortname) instead of adding the toolhead name as part... X-Git-Tag: lulzbot-15.02.1-2.01~56^2~7 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=afba7f6f43f4782e7770dd46df08f13a4705a347;p=cura.git Show machine_name (toolhead_shortname) instead of adding the toolhead name as part of the machine name This allows users to configure the name of their printer without losing that value when they change toolheads --- diff --git a/Cura/gui/configWizard.py b/Cura/gui/configWizard.py index 2f56c90a..17a7a472 100644 --- a/Cura/gui/configWizard.py +++ b/Cura/gui/configWizard.py @@ -1139,17 +1139,20 @@ class LulzbotMachineSelectPage(InfoPage): profile.putMachineSetting('machine_depth', '275') profile.putMachineSetting('machine_height', '250') profile.putMachineSetting('machine_type', 'lulzbot_TAZ_4') + profile.putMachineSetting('machine_name', 'LulzBot TAZ 4') profile.putMachineSetting('serial_baud', '115200') elif self.LulzbotTaz5.GetValue(): # Nozzle size will be set in the toolhead selection page # We set the machine_type here so later pages can differenciate between TAZ 4 and 5 profile.putMachineSetting('machine_type', 'lulzbot_TAZ_5') + profile.putMachineSetting('machine_name', 'LulzBot TAZ 5') profile.putMachineSetting('machine_width', '290') profile.putMachineSetting('machine_depth', '275') profile.putMachineSetting('machine_height', '250') profile.putMachineSetting('serial_baud', '115200') else: - # Nozzle size and machine name/type will be set in the toolhead selection page + # Nozzle size and machine type will be set in the toolhead selection page + profile.putMachineSetting('machine_name', 'LulzBot Mini') profile.putMachineSetting('machine_width', '155') profile.putMachineSetting('machine_depth', '155') profile.putMachineSetting('machine_height', '163') @@ -1224,13 +1227,13 @@ class LulzbotMiniToolheadSelectPage(LulzbotToolheadSelectPage): profile.putProfileSetting('nozzle_size', '0.5') profile.putMachineSetting('extruder_amount', '1') profile.putMachineSetting('toolhead', 'Single Extruder V2') - profile.putMachineSetting('machine_name', 'LulzBot Mini') + profile.putMachineSetting('toolhead_shortname', '') profile.putMachineSetting('machine_type', 'lulzbot_mini') else: profile.putProfileSetting('nozzle_size', '0.6') profile.putMachineSetting('extruder_amount', '1') profile.putMachineSetting('toolhead', 'Flexystruder V2') - profile.putMachineSetting('machine_name', 'LulzBot Mini (Flexy)') + profile.putMachineSetting('toolhead_shortname', 'Flexy') profile.putMachineSetting('machine_type', 'lulzbot_mini_flexy') @@ -1297,25 +1300,25 @@ class LulzbotTazToolheadSelectPage(LulzbotToolheadSelectPage): profile.putProfileSetting('nozzle_size', '0.5' if self.version == 2 else '0.35') profile.putMachineSetting('extruder_amount', '1') profile.putMachineSetting('toolhead', 'Single Extruder V%d' % self.version) - profile.putMachineSetting('machine_name', 'LulzBot TAZ %d' % taz_version) + profile.putMachineSetting('toolhead_shortname', '') profile.putMachineSetting('machine_type', 'lulzbot_TAZ_%d_SingleV%d' % version) elif self.flexy.GetValue(): profile.putProfileSetting('nozzle_size', '0.6') profile.putMachineSetting('extruder_amount', '1') profile.putMachineSetting('toolhead', 'Flexystruder V%d' % self.version) - profile.putMachineSetting('machine_name', 'LulzBot TAZ %d (Flexy v%d)' % version) + profile.putMachineSetting('toolhead_shortname', 'Flexy v%d' % self.version) profile.putMachineSetting('machine_type', 'lulzbot_TAZ_%d_flexyV%d' % version) elif self.dually.GetValue(): - profile.putMachineSetting('extruder_amount', '2') profile.putProfileSetting('nozzle_size', '0.5') + profile.putMachineSetting('extruder_amount', '2') profile.putMachineSetting('toolhead', 'Dual Extruder V%d' % self.version) - profile.putMachineSetting('machine_name', 'LulzBot TAZ %d (Dually v%d)' % version) + profile.putMachineSetting('toolhead_shortname', 'Dually v%d' % self.version) profile.putMachineSetting('machine_type', 'lulzbot_TAZ_%d_DuallyV%d' % version) elif self.flexydually.GetValue(): profile.putProfileSetting('nozzle_size', '0.6') profile.putMachineSetting('extruder_amount', '2') profile.putMachineSetting('toolhead', 'FlexyDually V%d' % self.version) - profile.putMachineSetting('machine_name', 'LulzBot TAZ %d (FlexyDually v%d)' % version) + profile.putMachineSetting('toolhead_shortname', 'FlexyDually v%d' % self.version) profile.putMachineSetting('machine_type', 'lulzbot_TAZ_%d_FlexyDuallyV%d' % version) @@ -1364,14 +1367,14 @@ class LulzbotTaz5NozzleSelectPage(LulzbotToolheadSelectPage): def StoreData(self): if self.Nozzle35Radio.GetValue(): profile.putProfileSetting('nozzle_size', '0.35') - profile.putMachineSetting('toolhead', 'Single Extruder V2 (0.35 nozzle)') - profile.putMachineSetting('machine_name', 'LulzBot TAZ 5 (0.35 nozzle)') + profile.putMachineSetting('toolhead', 'Single Extruder V2 (0.35mm nozzle)') + profile.putMachineSetting('toolhead_shortname', '0.35 nozzle') profile.putMachineSetting('machine_type', 'lulzbot_TAZ_5_035nozzle') else: profile.putProfileSetting('nozzle_size', '0.5') - profile.putMachineSetting('toolhead', 'Single Extruder V2 (0.5 nozzle)') - profile.putMachineSetting('machine_name', 'LulzBot TAZ 5 (0.5 nozzle)') + profile.putMachineSetting('toolhead', 'Single Extruder V2 (0.5mm nozzle)') + profile.putMachineSetting('toolhead_shortname', '0.5 nozzle') profile.putMachineSetting('machine_type', 'lulzbot_TAZ_5_05nozzle') class LulzbotChangeToolheadWizard(wx.wizard.Wizard): diff --git a/Cura/gui/firmwareInstall.py b/Cura/gui/firmwareInstall.py index a06b02ae..90074c24 100644 --- a/Cura/gui/firmwareInstall.py +++ b/Cura/gui/firmwareInstall.py @@ -64,7 +64,7 @@ def getDefaultFirmware(machineIndex = None): class InstallFirmware(wx.Dialog): def __init__(self, parent = None, filename = None, port = None, machineIndex = None): - super(InstallFirmware, self).__init__(parent=parent, title=_("Firmware install for %s") % (profile.getMachineSetting('machine_name', machineIndex).title()), size=(250, 100)) + super(InstallFirmware, self).__init__(parent=parent, title=_("Firmware install for %s") % (profile.getMachineName(machineIndex).title()), size=(250, 100)) if port is None: port = profile.getMachineSetting('serial_port') if filename is None: diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 27223f21..32476d36 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -481,7 +481,7 @@ class mainWindow(wx.Frame): #Add a menu item for each machine configuration. for n in xrange(0, profile.getMachineCount()): - i = self.machineMenu.Append(n + 0x1000, profile.getMachineSetting('machine_name', n).title(), kind=wx.ITEM_RADIO) + i = self.machineMenu.Append(n + 0x1000, profile.getMachineName(n).title(), kind=wx.ITEM_RADIO) if n == int(profile.getPreferenceFloat('active_machine')): i.Check(True) self.Bind(wx.EVT_MENU, lambda e: self.OnSelectMachine(e.GetId() - 0x1000), i) diff --git a/Cura/gui/preferencesDialog.py b/Cura/gui/preferencesDialog.py index 883ce8eb..eee3c35c 100644 --- a/Cura/gui/preferencesDialog.py +++ b/Cura/gui/preferencesDialog.py @@ -144,7 +144,7 @@ class machineSettingsDialog(wx.Dialog): configBase.SettingRow(right, 'serial_port', ['AUTO'] + machineCom.serialList(), index=idx) configBase.SettingRow(right, 'serial_baud', ['AUTO'] + map(str, machineCom.baudrateList()), index=idx) - self.nb.AddPage(main, profile.getMachineSetting('machine_name', idx).title()) + self.nb.AddPage(main, profile.getMachineName(idx).title()) self.nb.SetSelection(int(profile.getPreferenceFloat('active_machine'))) @@ -216,11 +216,12 @@ class machineSettingsDialog(wx.Dialog): wx.CallAfter(self.Close) def OnRenameMachine(self, e): - dialog = wx.TextEntryDialog(self, _("Enter the new name:"), _("Change machine name"), self.nb.GetPageText(self.nb.GetSelection())) + dialog = wx.TextEntryDialog(self, _("Enter the new name:"), _("Change machine name"), + profile.getMachineSetting('machine_name', self.nb.GetSelection())) if dialog.ShowModal() != wx.ID_OK: return - self.nb.SetPageText(self.nb.GetSelection(), dialog.GetValue()) profile.putMachineSetting('machine_name', dialog.GetValue(), self.nb.GetSelection()) + self.nb.SetPageText(self.nb.GetSelection(), profile.getMachineName(self.nb.GetSelection())) self.parent.updateMachineMenu() def OnClose(self, e): diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 2ac0e182..45f052c7 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -553,6 +553,7 @@ setting('serial_baud', 'AUTO', str, 'machine', 'hidden').setLabel(_("Baudrate"), setting('serial_baud_auto', '', int, 'machine', 'hidden') setting('toolhead', 'Default', str, 'machine', 'hidden').setLabel(_("Installed toolhead"), _("Which toolhead is currently installed. This setting is only used by LulzBot machines.")) +setting('toolhead_shortname', '', str, 'machine', 'hidden') setting('extruder_head_size_min_x', '0.0', float, 'machine', 'hidden').setLabel(_("Head size towards X min (mm)"), _("The head size when printing multiple objects, measured from the tip of the nozzle towards the outer part of the head.")) setting('extruder_head_size_min_y', '0.0', float, 'machine', 'hidden').setLabel(_("Head size towards Y min (mm)"), _("The head size when printing multiple objects, measured from the tip of the nozzle towards the outer part of the head.")) setting('extruder_head_size_max_x', '0.0', float, 'machine', 'hidden').setLabel(_("Head size towards X max (mm)"), _("The head size when printing multiple objects, measured from the tip of the nozzle towards the outer part of the head.")) @@ -1104,6 +1105,15 @@ def getMachineCount(): return 1 return n +def getMachineName(index = None): + name = getMachineSetting('machine_name', index) + type = getMachineSetting('machine_type', index) + if type.startswith('lulzbot_'): + toolhead = getMachineSetting('toolhead_shortname', index) + if toolhead != '': + return "%s (%s)" % (name, toolhead) + return name + def setActiveMachine(index): global _selectedMachineIndex _selectedMachineIndex = index