From: daid Date: Mon, 16 Sep 2013 13:23:26 +0000 (+0200) Subject: Fix localization merge. X-Git-Tag: 13.10~79 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=0b48ed7f2f91386542604ff94e7ae878db2e1269;p=cura.git Fix localization merge. --- 0b48ed7f2f91386542604ff94e7ae878db2e1269 diff --cc Cura/gui/configWizard.py index a6415977,214d76ec..f68f8d8c --- a/Cura/gui/configWizard.py +++ b/Cura/gui/configWizard.py @@@ -261,28 -261,23 +261,28 @@@ class RepRapInfoPage(InfoPage) class MachineSelectPage(InfoPage): def __init__(self, parent): - super(MachineSelectPage, self).__init__(parent, "Select your machine") - self.AddText('What kind of machine do you have:') + super(MachineSelectPage, self).__init__(parent, _("Select your machine")) + self.AddText(_("What kind of machine do you have:")) - self.UltimakerRadio = self.AddRadioButton("Ultimaker", style=wx.RB_GROUP) - self.UltimakerRadio.SetValue(True) + self.Ultimaker2Radio = self.AddRadioButton("Ultimaker2", style=wx.RB_GROUP) + self.Ultimaker2Radio.SetValue(True) + self.Ultimaker2Radio.Bind(wx.EVT_RADIOBUTTON, self.OnUltimaker2Select) + self.UltimakerRadio = self.AddRadioButton("Ultimaker") self.UltimakerRadio.Bind(wx.EVT_RADIOBUTTON, self.OnUltimakerSelect) - self.OtherRadio = self.AddRadioButton("Other (Ex: RepRap)") + self.OtherRadio = self.AddRadioButton(_("Other (Ex: RepRap)")) self.OtherRadio.Bind(wx.EVT_RADIOBUTTON, self.OnOtherSelect) self.AddSeperator() - self.AddText('The collection of anonymous usage information helps with the continued improvement of Cura.') - self.AddText('This does NOT submit your models online nor gathers any privacy related information.') - self.SubmitUserStats = self.AddCheckbox('Submit anonymous usage information:') - self.AddText('For full details see: http://wiki.ultimaker.com/Cura:stats') + self.AddText(_("The collection of anonymous usage information helps with the continued improvement of Cura.")) + self.AddText(_("This does NOT submit your models online nor gathers any privacy related information.")) + self.SubmitUserStats = self.AddCheckbox(_("Submit anonymous usage information:")) + self.AddText(_("For full details see: http://wiki.ultimaker.com/Cura:stats")) self.SubmitUserStats.SetValue(True) + def OnUltimaker2Select(self, e): + wx.wizard.WizardPageSimple.Chain(self, self.GetParent().ultimaker2ReadyPage) + def OnUltimakerSelect(self, e): - wx.wizard.WizardPageSimple.Chain(self, self.GetParent().ultimakerFirmwareUpgradePage) + wx.wizard.WizardPageSimple.Chain(self, self.GetParent().ultimakerSelectParts) def OnOtherSelect(self, e): wx.wizard.WizardPageSimple.Chain(self, self.GetParent().repRapInfoPage) @@@ -355,14 -335,14 +355,14 @@@ class SelectParts(InfoPage) profile.putProfileSetting('retraction_enable', 'False') -class FirmwareUpgradePage(InfoPage): +class UltimakerFirmwareUpgradePage(InfoPage): def __init__(self, parent): - super(UltimakerFirmwareUpgradePage, 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.') - super(FirmwareUpgradePage, self).__init__(parent, "Upgrade Ultimaker Firmware") ++ super(UltimakerFirmwareUpgradePage, 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.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) diff --cc Cura/gui/mainWindow.py index dcebc581,cd656e74..41cb1f06 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@@ -100,20 -100,20 +100,20 @@@ class mainWindow(wx.Frame) self.profileFileHistory.UseMenu(profileHistoryMenu) self.profileFileHistory.AddFilesToMenu() self.Bind(wx.EVT_MENU_RANGE, self.OnProfileMRU, id=self.ID_MRU_PROFILE1, id2=self.ID_MRU_PROFILE10) - + self.fileMenu.AppendSeparator() - i = self.fileMenu.Append(wx.ID_EXIT, 'Quit') + i = self.fileMenu.Append(wx.ID_EXIT, _("Quit")) self.Bind(wx.EVT_MENU, self.OnQuit, i) - self.menubar.Append(self.fileMenu, '&File') + self.menubar.Append(self.fileMenu, _("&File")) toolsMenu = wx.Menu() - i = toolsMenu.Append(-1, 'Switch to quickprint...') + i = toolsMenu.Append(-1, _("Switch to quickprint...")) self.switchToQuickprintMenuItem = i self.Bind(wx.EVT_MENU, self.OnSimpleSwitch, i) - i = toolsMenu.Append(-1, 'Switch to full settings...') + i = toolsMenu.Append(-1, _("Switch to full settings...")) self.switchToNormalMenuItem = i self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) - toolsMenu.AppendSeparator() + #toolsMenu.AppendSeparator() #i = toolsMenu.Append(-1, 'Batch run...') #self.Bind(wx.EVT_MENU, self.OnBatchRun, i) #self.normalModeOnlyItems.append(i) diff --cc Cura/gui/sceneView.py index da35e2c0,916eaa02..5023bdc5 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@@ -617,13 -614,13 +617,13 @@@ class SceneView(openglGui.glGuiPanel) if e.GetButton() == 3: menu = wx.Menu() if self._focusObj is not None: - self.Bind(wx.EVT_MENU, lambda e: self._deleteObject(self._focusObj), menu.Append(-1, 'Delete')) - self.Bind(wx.EVT_MENU, self.OnMultiply, menu.Append(-1, 'Multiply')) - self.Bind(wx.EVT_MENU, self.OnSplitObject, menu.Append(-1, 'Split')) + self.Bind(wx.EVT_MENU, lambda e: self._deleteObject(self._focusObj), menu.Append(-1, _("Delete"))) + self.Bind(wx.EVT_MENU, self.OnMultiply, menu.Append(-1, _("Multiply"))) + self.Bind(wx.EVT_MENU, self.OnSplitObject, menu.Append(-1, _("Split"))) - if self._selectedObj != self._focusObj and self._focusObj is not None and int(profile.getPreference('extruder_amount')) > 1: + if ((self._selectedObj != self._focusObj and self._focusObj is not None and self._selectedObj is not None) or len(self._scene.objects()) == 2) and int(profile.getPreference('extruder_amount')) > 1: - self.Bind(wx.EVT_MENU, self.OnMergeObjects, menu.Append(-1, 'Dual extrusion merge')) + self.Bind(wx.EVT_MENU, self.OnMergeObjects, menu.Append(-1, _("Dual extrusion merge"))) if len(self._scene.objects()) > 0: - self.Bind(wx.EVT_MENU, self.OnDeleteAll, menu.Append(-1, 'Delete all')) + self.Bind(wx.EVT_MENU, self.OnDeleteAll, menu.Append(-1, _("Delete all"))) if menu.MenuItemCount > 0: self.PopupMenu(menu) menu.Destroy() diff --cc Cura/gui/simpleMode.py index 498993b3,c5552230..13ea7a22 --- a/Cura/gui/simpleMode.py +++ b/Cura/gui/simpleMode.py @@@ -27,10 -27,8 +27,10 @@@ class simpleModePanel(wx.Panel) self.printMaterialPLA = wx.RadioButton(printMaterialPanel, -1, 'PLA', style=wx.RB_GROUP) self.printMaterialABS = wx.RadioButton(printMaterialPanel, -1, 'ABS') self.printMaterialDiameter = wx.TextCtrl(printMaterialPanel, -1, profile.getProfileSetting('filament_diameter')) + if profile.getPreference('gcode_flavor') == 'UltiGCode': + printMaterialPanel.Show(False) - self.printSupport = wx.CheckBox(self, -1, 'Print support structure') + self.printSupport = wx.CheckBox(self, -1, _("Print support structure")) sizer = wx.GridBagSizer() self.SetSizer(sizer) diff --cc Cura/gui/tools/youmagineGui.py index a9104f62,951acfea..126d3a77 --- a/Cura/gui/tools/youmagineGui.py +++ b/Cura/gui/tools/youmagineGui.py @@@ -275,8 -275,8 +275,8 @@@ class newDesignWindow(wx.Frame) self._designDescription = wx.TextCtrl(p, -1, '', size=(1, 150), style = wx.TE_MULTILINE) self._designLicense = wx.ComboBox(p, -1, licenseOptions[0], choices=licenseOptions, style=wx.CB_DROPDOWN|wx.CB_READONLY) self._category = wx.ComboBox(p, -1, categoryOptions[-1], choices=categoryOptions, style=wx.CB_DROPDOWN|wx.CB_READONLY) - self._publish = wx.CheckBox(p, -1, 'Publish after upload') - self._shareButton = wx.Button(p, -1, 'Share!') + self._publish = wx.CheckBox(p, -1, _("Publish after upload")) - self._shareButton = wx.Button(p, -1, _("Upload")) ++ self._shareButton = wx.Button(p, -1, _("Share!")) self._imageScroll = wx.lib.scrolledpanel.ScrolledPanel(p) self._additionalFiles = wx.CheckListBox(p, -1) self._additionalFiles.InsertItems(getAdditionalFiles(self._manager._scene.objects(), True), 0) @@@ -299,19 -300,19 +300,20 @@@ p.SetSizer(s) s.Add(wx.StaticBitmap(p, -1, wx.Bitmap(getPathForImage('youmagine-text.png'))), (0,0), span=(1,3), flag=wx.ALIGN_CENTRE | wx.ALL, border=5) - s.Add(wx.StaticText(p, -1, 'Design name:'), (1, 0), flag=wx.LEFT|wx.TOP, border=5) + s.Add(wx.StaticText(p, -1, _("Design name:")), (1, 0), flag=wx.LEFT|wx.TOP, border=5) s.Add(self._designName, (1, 1), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5) - s.Add(wx.StaticText(p, -1, 'Description:'), (2, 0), flag=wx.LEFT|wx.TOP, border=5) + s.Add(wx.StaticText(p, -1, _("Description:")), (2, 0), flag=wx.LEFT|wx.TOP, border=5) s.Add(self._designDescription, (2, 1), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5) - s.Add(wx.StaticText(p, -1, 'Category:'), (3, 0), flag=wx.LEFT|wx.TOP, border=5) + s.Add(wx.StaticText(p, -1, _("Category:")), (3, 0), flag=wx.LEFT|wx.TOP, border=5) s.Add(self._category, (3, 1), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5) - s.Add(wx.StaticText(p, -1, 'License:'), (4, 0), flag=wx.LEFT|wx.TOP, border=5) + s.Add(wx.StaticText(p, -1, _("License:")), (4, 0), flag=wx.LEFT|wx.TOP, border=5) s.Add(self._designLicense, (4, 1), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5) s.Add(wx.StaticLine(p, -1), (5,0), span=(1,3), flag=wx.EXPAND|wx.ALL) - s.Add(wx.StaticText(p, -1, 'Images:'), (6, 0), flag=wx.LEFT|wx.TOP, border=5) + s.Add(wx.StaticText(p, -1, _("Images:")), (6, 0), flag=wx.LEFT|wx.TOP, border=5) s.Add(self._imageScroll, (6, 1), span=(1, 2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5) s.Add(wx.StaticLine(p, -1), (7,0), span=(1,3), flag=wx.EXPAND|wx.ALL) - s.Add(wx.StaticText(p, -1, 'Related design files:'), (8, 0), flag=wx.LEFT|wx.TOP, border=5) - s.Add(wx.StaticText(p, -1, _("Design files:")), (8, 0), flag=wx.LEFT|wx.TOP, border=5) ++ s.Add(wx.StaticText(p, -1, _("Related design files:")), (8, 0), flag=wx.LEFT|wx.TOP, border=5) ++ s.Add(self._additionalFiles, (8, 1), span=(1, 2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5) s.Add(wx.StaticLine(p, -1), (9,0), span=(1,3), flag=wx.EXPAND|wx.ALL) s.Add(self._shareButton, (10, 1), flag=wx.BOTTOM, border=15) diff --cc Cura/util/resources.py index ad1e5ebc,473f4964..a5879277 --- a/Cura/util/resources.py +++ b/Cura/util/resources.py @@@ -37,3 -42,16 +42,18 @@@ def getPathForMesh(name) def getPathForFirmware(name): return getPathForResource(resourceBasePath, 'firmware', name) + + def setupLocalization(): + try: + if sys.platform.startswith('darwin'): + languages = NSLocale.preferredLanguages() + else: - languages = [wx.Locale(wx.LANGUAGE_DEFAULT).GetCanonicalName()] ++ #Using wx.Locale before you created wx.App seems to cause an nasty exception. So default to 'en' at the moment. ++ #languages = [wx.Locale(wx.LANGUAGE_DEFAULT).GetCanonicalName()] ++ languages = ['en'] + except Exception as e: + languages = ['en'] + + locale_path = os.path.normpath(os.path.join(resourceBasePath, 'locale')) + translation = gettext.translation('Cura', locale_path, languages, fallback=True) + translation.install(unicode=True)