def __init__(self, files): if platform.system( ) == "Windows" and not 'PYCHARM_HOSTED' in os.environ: from Cura.util import profile super(CuraApp, self).__init__(redirect=True, filename=os.path.join(profile.getBasePath(), 'output_log.txt')) else: super(CuraApp, self).__init__(redirect=False) self.mainWindow = None self.splash = None self.loadFiles = files if platform.system() == "Darwin": self.Bind(wx.EVT_ACTIVATE_APP, self.OnActivate) if sys.platform.startswith('win'): #Check for an already running instance, if another instance is running load files in there from Cura.util import version from ctypes import windll import ctypes import socket import threading portNr = 0xCA00 + sum(map(ord, version.getVersion(False))) if len(files) > 0: try: other_hwnd = windll.user32.FindWindowA( None, ctypes.c_char_p('Cura - ' + version.getVersion())) if other_hwnd != 0: sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.sendto('\0'.join(files), ("127.0.0.1", portNr)) windll.user32.SetForegroundWindow(other_hwnd) return except: pass socketListener = threading.Thread(target=self.Win32SocketListener, args=(portNr, )) socketListener.daemon = True socketListener.start() if sys.platform.startswith('darwin'): #Do not show a splashscreen on OSX, as by Apple guidelines self.afterSplashCallback() else: from Cura.gui import splashScreen self.splash = splashScreen.splashScreen(self.afterSplashCallback)
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in version 15.04.2:')) s.Add(wx.StaticText(p, -1, '* New firmwares for the Ultimaker2, Ultimaker2go and Ultimaker2extended')) s.Add(wx.StaticText(p, -1, '* New and updated 3th party machine configurations')) s.Add(wx.StaticText(p, -1, 'New in version 15.04:')) s.Add(wx.StaticText(p, -1, '* Fixed a small issue where Cura sometimes failed enable the save button')) s.Add(wx.StaticText(p, -1, '* Added save gcode shortcut key (CTRL+G)')) s.Add(wx.StaticText(p, -1, '* Updated UM2, UM2go and UM2extended firmware for the new support url on errors')) s.Add(wx.StaticText(p, -1, '* Fixed small issue in the UM2go firmware')) self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2:')) s.Add(wx.StaticText(p, -1, '* Added option to change filament when pausing during a print.')) s.Add(wx.StaticText(p, -1, '* Prevent temperature display jitter (thanks to TinkerGnome)')) s.Add(wx.StaticText(p, -1, '* Fixed problems with filenames containing an umlaut.')) s.Add(wx.StaticText(p, -1, '* Improved pause handling (thanks to ThinkerGnome)')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP|wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def getAlterationFileContents(filename): prefix = '' postfix = '' alterationContents = getAlterationFile(filename) if filename == 'start.gcode': #For the start code, hack the temperature and the steps per E value into it. So the temperature is reached before the start code extrusion. #We also set our steps per E here, if configured. #eSteps = getPreferenceFloat('steps_per_e') prefix += _(';Sliced with Tinkerine Suite version ') + version.getVersion() + '\n' prefix += 'M104 S220\n' prefix += 'T0\n' prefix += 'G28\n' prefix += 'G90\n' # prefix += 'M83\n' ;for relative extruder movements prefix += 'M106 S0\n' prefix += 'G92 E0\n' prefix += 'G1 Z0.5 F2000\n' #if eSteps > 0: # prefix += 'M92 E%f\n' % (eSteps) temp = getProfileSettingFloat('print_temperature') + 10 if temp > 230: temp = 230 print_temp = getProfileSettingFloat('print_temperature') bedTemp = 0 if getPreference('has_heated_bed') == 'True': bedTemp = getProfileSettingFloat('print_bed_temperature') if bedTemp > 0 and not '{print_bed_temperature}' in alterationContents: prefix += 'M140 S%f\n' % (bedTemp) # if temp > 0 and not '{first_layer_print_temperature}' in alterationContents: if temp > 0: prefix += 'M109 S%f\n' % (temp) #prefix += 'M109 215' if bedTemp > 0 and not '{print_bed_temperature}' in alterationContents: prefix += 'M190 S%f\n' % (bedTemp) #prefix += 'G1 Z0 F2000\n' #prefix += 'G92 E0\n' #prefix += 'G1 X65 E7 F2000\n' #prefix += 'G1 X0 Y2 E14 F2000\n' #prefix += 'G92 E0\n' elif filename == 'end.gcode': #Append the profile string to the end of the GCode, so we can load it from the GCode file later. #postfix = ';CURA_PROFILE_STRING:%s\n' % (getGlobalProfileString()) postfix = ';' elif filename == 'replace.csv': #Always remove the extruder on/off M codes. These are no longer needed in 5D printing. prefix = 'M101\nM103\n' elif filename == 'support_start.gcode' or filename == 'support_end.gcode': #Add support start/end code if getProfileSetting('support_dual_extrusion') == 'True' and int(getPreference('extruder_amount')) > 1: if filename == 'support_start.gcode': setTempOverride('extruder', '1') else: setTempOverride('extruder', '0') alterationContents = getAlterationFileContents('switchExtruder.gcode') clearTempOverride('extruder') else: alterationContents = '' return unicode(prefix + re.sub("(.)\{([^\}]*)\}", replaceTagMatch, alterationContents).rstrip() + '\n' + postfix).strip().encode('utf-8')
def __init__(self): super(flatSlicerWindow, self).__init__(None, title='Cura - ' + version.getVersion()) self.machineSize = util3d.Vector3(profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height')) self.filename = None self.svg = None wx.EVT_CLOSE(self, self.OnClose) self.panel = wx.Panel(self, -1) self.SetSizer(wx.BoxSizer(wx.VERTICAL)) self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND) self.toolbar = toolbarUtil.Toolbar(self.panel) toolbarUtil.NormalButton(self.toolbar, self.OnOpenSVG, 'open.png', 'Open SVG') self.toolbar.AddSeparator() group = [] toolbarUtil.RadioButton(self.toolbar, group, 'object-3d-on.png', 'object-3d-off.png', '3D view', callback=self.On3DClick) toolbarUtil.RadioButton(self.toolbar, group, 'object-top-on.png', 'object-top-off.png', 'Topdown view', callback=self.OnTopClick).SetValue(True) self.toolbar.AddSeparator() toolbarUtil.NormalButton(self.toolbar, self.OnQuit, 'exit.png', 'Close project planner') self.toolbar.Realize() sizer = wx.GridBagSizer(2,2) self.panel.SetSizer(sizer) self.preview = PreviewGLCanvas(self.panel, self) sizer.Add(self.toolbar, (0,0), span=(1,1), flag=wx.EXPAND|wx.LEFT|wx.RIGHT) sizer.Add(self.preview, (1,0), span=(5,1), flag=wx.EXPAND) sizer.AddGrowableCol(0) sizer.AddGrowableRow(1) self.SetSize((600,400))
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title_text = 'Cura - ' + version.getVersion() title = wx.StaticText(p, -1, title_text) font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD) title.SetFont(font) dc = wx.ScreenDC() dc.SetFont(font) title.SetMinSize(dc.GetTextExtent(title_text)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, _('Welcome to the latest version of Cura LulzBot Edition, '))) s.Add(wx.StaticText(p, -1, _('a Free Software program. Find a list of improvements'))) s.Add(wx.StaticText(p, -1, _('and changes in the release notes, available online here:'))) s.Add(wx.HyperlinkCtrl(p, -1, newVersionDialog.url, newVersionDialog.url)) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) button = wx.Button(p, -1, _('OK')) self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP|wx.ALIGN_RIGHT, border=5) s = wx.BoxSizer() s.Add(p, flag=wx.ALL, border=15) self.Layout() self.SetSizerAndFit(s) self.Centre()
def __init__(self, files): if platform.system() == "Windows" and not 'PYCHARM_HOSTED' in os.environ: from Cura.util import profile super(CuraApp, self).__init__(redirect=True, filename=os.path.join(profile.getBasePath(), 'output_log.txt')) else: super(CuraApp, self).__init__(redirect=False) self.mainWindow = None self.splash = None self.loadFiles = files self.Bind(wx.EVT_ACTIVATE_APP, self.OnActivate) if sys.platform.startswith('win'): #Check for an already running instance, if another instance is running load files in there from Cura.util import version from ctypes import windll import ctypes import socket import threading portNr = 0xCA00 + sum(map(ord, version.getVersion(False))) if len(files) > 0: try: other_hwnd = windll.user32.FindWindowA(None, ctypes.c_char_p('Cura - ' + version.getVersion())) if other_hwnd != 0: sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.sendto('\0'.join(files), ("127.0.0.1", portNr)) windll.user32.SetForegroundWindow(other_hwnd) return except: pass socketListener = threading.Thread(target=self.Win32SocketListener, args=(portNr,)) socketListener.daemon = True socketListener.start() # if sys.platform.startswith('darwin'): # #Do not show a splashscreen on OSX, as by Apple guidelines # self.afterSplashCallback() # else: # from Cura.gui import splashScreen # self.splash = splashScreen.splashScreen(self.afterSplashCallback) from Cura.gui import splashScreen self.splash = splashScreen.splashScreen(self.afterSplashCallback)
def _loadModels(self, filelist): self.filelist = filelist self.SetTitle('Cura - %s - %s' % (version.getVersion(), filelist[-1])) profile.putPreference('lastFile', ';'.join(self.filelist)) self.preview3d.loadModelFiles(self.filelist, True) self.preview3d.setViewMode("Normal") # Update the Model MRU for idx in xrange(0, len(self.filelist)): self.addToModelMRU(self.filelist[idx])
def getPreferencePath(): if platform.system() == "Windows": basePath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) #If we have a frozen python install, we need to step out of the library.zip if hasattr(sys, 'frozen'): basePath = os.path.normpath(os.path.join(basePath, "..")) else: basePath = os.path.expanduser('~/.cura/%s' % version.getVersion(False)) if not os.path.isdir(basePath): os.makedirs(basePath) return os.path.join(basePath, 'preferences.ini')
def getBasePath(): if platform.system() == "Windows": basePath = os.path.normpath( os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) #If we have a frozen python install, we need to step out of the library.zip if hasattr(sys, 'frozen'): basePath = os.path.normpath(os.path.join(basePath, "..")) else: basePath = os.path.expanduser('~/.cura/%s' % version.getVersion(False)) if not os.path.isdir(basePath): os.makedirs(basePath) return basePath
def __init__(self): super(flatSlicerWindow, self).__init__(None, title='Cura - ' + version.getVersion()) self.machineSize = util3d.Vector3( profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height')) self.filename = None self.svg = None wx.EVT_CLOSE(self, self.OnClose) self.panel = wx.Panel(self, -1) self.SetSizer(wx.BoxSizer(wx.VERTICAL)) self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND) self.toolbar = toolbarUtil.Toolbar(self.panel) toolbarUtil.NormalButton(self.toolbar, self.OnOpenSVG, 'open.png', 'Open SVG') self.toolbar.AddSeparator() group = [] toolbarUtil.RadioButton(self.toolbar, group, 'object-3d-on.png', 'object-3d-off.png', '3D view', callback=self.On3DClick) toolbarUtil.RadioButton(self.toolbar, group, 'object-top-on.png', 'object-top-off.png', 'Topdown view', callback=self.OnTopClick).SetValue(True) self.toolbar.AddSeparator() toolbarUtil.NormalButton(self.toolbar, self.OnQuit, 'exit.png', 'Close project planner') self.toolbar.Realize() sizer = wx.GridBagSizer(2, 2) self.panel.SetSizer(sizer) self.preview = PreviewGLCanvas(self.panel, self) sizer.Add(self.toolbar, (0, 0), span=(1, 1), flag=wx.EXPAND | wx.LEFT | wx.RIGHT) sizer.Add(self.preview, (1, 0), span=(5, 1), flag=wx.EXPAND) sizer.AddGrowableCol(0) sizer.AddGrowableRow(1) self.SetSize((600, 400))
def __init__(self, parent): super(aboutWindow, self).__init__(parent, title=_("About"), style = wx.DEFAULT_DIALOG_STYLE) wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura FabLab Karlsruhe Edition') title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) version_num = version.getVersion() s.Add(wx.StaticText(p, -1, 'Version {}'.format(version_num))) s.Add(wx.StaticText(p, -1, 'End solution for Open Source Fused Filament Fabrication 3D printing.'), flag=wx.TOP, border=5) s.Add(wx.StaticText(p, -1, 'Cura is currently developed and maintained by David Braam and Ultimaker.'), flag=wx.TOP, border=5) s.Add(wx.StaticText(p, -1, 'Cura FabLab Karlsruhe Edition has been modified and maintained by Aleph Objects, Inc. and FabLab Karlsruhe e.V.')) s.Add(wx.StaticText(p, -1, 'for use with Hexagon V2 3D printers.')) s.Add(wx.StaticText(p, -1, 'Cura is built with the following components:'), flag=wx.TOP, border=10) self.addComponent('Cura', 'Graphical user interface', 'AGPLv3', 'https://github.com/daid/Cura') self.addComponent('CuraEngine', 'GCode Generator', 'AGPLv3', 'https://github.com/Ultimaker/CuraEngine') self.addComponent('Clipper', 'Polygon clipping library', 'Boost', 'http://www.angusj.com/delphi/clipper.php') self.addComponent('Python 2.7', 'Framework', 'Python', 'http://python.org/') self.addComponent('wxPython', 'GUI Framework', 'wxWindows', 'http://www.wxpython.org/') self.addComponent('PyOpenGL', '3D Rendering Framework', 'BSD', 'http://pyopengl.sourceforge.net/') self.addComponent('PySerial', 'Serial communication library', 'Python license', 'http://pyserial.sourceforge.net/') self.addComponent('NumPy', 'Support library for faster math', 'BSD', 'http://www.numpy.org/') if platform.system() == "Windows": self.addComponent('VideoCapture', 'Library for WebCam capture on windows', 'LGPLv2.1', 'http://videocapture.sourceforge.net/') #self.addComponent('ffmpeg', 'Support for making timelaps video files', 'GPL', 'http://www.ffmpeg.org/') self.addComponent('comtypes', 'Library to help with windows taskbar features on Windows 7', 'MIT', 'http://starship.python.net/crew/theller/comtypes/') self.addComponent('EjectMedia', 'Utility to safe-remove SD cards', 'Freeware', 'http://www.uwe-sieber.de/english.html') self.addComponent('Pymclevel', 'Python library for reading Minecraft levels.', 'ISC', 'https://github.com/mcedit/pymclevel') s.Add(wx.StaticText(p, -1, "Copyright (C) 2014 Aleph Objects, Inc. - Released under terms of the AGPLv3 License"), flag=wx.TOP, border=10) s.Add(wx.StaticText(p, -1, "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License")) #Translations done by: #Dutch: Charlotte Jansen #German: Gregor Luetolf, Lars Potter #Polish: Piotr Paczynski #French: Jeremie Francois #Spanish: Jose Gemez self.Fit()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title_text = 'Cura - ' + version.getVersion() title = wx.StaticText(p, -1, title_text) font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD) title.SetFont(font) dc = wx.ScreenDC() dc.SetFont(font) title.SetMinSize(dc.GetTextExtent(title_text)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText( p, -1, _('Welcome to the latest version of Cura LulzBot Edition, '))) s.Add( wx.StaticText( p, -1, _('a Free Software program. Find a list of improvements'))) s.Add( wx.StaticText( p, -1, _('and changes in the release notes, available online here:'))) s.Add( wx.HyperlinkCtrl(p, -1, newVersionDialog.url, newVersionDialog.url)) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) button = wx.Button(p, -1, _('OK')) self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP | wx.ALIGN_RIGHT, border=5) s = wx.BoxSizer() s.Add(p, flag=wx.ALL, border=15) self.Layout() self.SetSizerAndFit(s) self.Centre()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title_text = 'Cura - ' + version.getVersion() title = wx.StaticText(p, -1, title_text) font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD) title.SetFont(font) dc = wx.ScreenDC() dc.SetFont(font) title.SetMinSize(dc.GetTextExtent(title_text)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) s.Add( wx.StaticText( p, -1, _('Welcome to the new release of Cura LulzBot Edition!'))) s.Add(wx.StaticText(p, -1, _('(This dialog is only shown once)'))) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText( p, -1, _('Want to know what is new and cool in this version?'))) s.Add(wx.StaticText(p, -1, _('Click here for a list of changes:'))) s.Add( wx.HyperlinkCtrl(p, -1, newVersionDialog.url, newVersionDialog.url)) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) button = wx.Button(p, -1, _('OK')) self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP | wx.ALIGN_RIGHT, border=5) s = wx.BoxSizer() s.Add(p, flag=wx.ALL, border=15) self.Layout() self.SetSizerAndFit(s) self.Centre()
def submitSliceInfoOnline(self): if profile.getPreference("submit_slice_information") != "True": return if version.isDevVersion(): return data = { "processor": platform.processor(), "machine": platform.machine(), "platform": platform.platform(), "profile": profile.getProfileString(), "preferences": profile.getPreferencesString(), "modelhash": self._modelHash, "version": version.getVersion(), } try: f = urllib2.urlopen("http://www.youmagine.com/curastats/", data=urllib.urlencode(data), timeout=1) f.read() f.close() except: pass
def submitSliceInfoOnline(self): if profile.getPreference('submit_slice_information') != 'True': return if version.isDevVersion(): return data = { 'processor': platform.processor(), 'machine': platform.machine(), 'platform': platform.platform(), 'profile': profile.getProfileString(), 'preferences': profile.getPreferencesString(), 'modelhash': self._modelHash, 'version': version.getVersion(), } try: f = urllib2.urlopen("http://www.youmagine.com/curastats/", data = urllib.urlencode(data), timeout = 1) f.read() f.close() except: pass
def submitSliceInfoOnline(self): if profile.getPreference('submit_slice_information') != 'True': return if version.isDevVersion(): return data = { 'processor': platform.processor(), 'machine': platform.machine(), 'platform': platform.platform(), 'profile': profile.getGlobalProfileString(), 'preferences': profile.getGlobalPreferencesString(), 'modelhash': self._modelHash, 'version': version.getVersion(), } try: f = urllib2.urlopen("http://www.youmagine.com/curastats/", data = urllib.urlencode(data), timeout = 1) f.read() f.close() except: pass
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title_text = 'Cura - ' + version.getVersion() title = wx.StaticText(p, -1, title_text) font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD) title.SetFont(font) dc = wx.ScreenDC() dc.SetFont(font) title.SetMinSize(dc.GetTextExtent(title_text)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, _('Welcome to the new release of Cura LulzBot Edition!'))) s.Add(wx.StaticText(p, -1, _('(This dialog is only shown once)'))) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, _('Want to know what is new and cool in this version?'))) s.Add(wx.StaticText(p, -1, _('Click here for a list of changes:'))) s.Add(wx.HyperlinkCtrl(p, -1, newVersionDialog.url, newVersionDialog.url)) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) button = wx.Button(p, -1, _('OK')) self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP|wx.ALIGN_RIGHT, border=5) s = wx.BoxSizer() s.Add(p, flag=wx.ALL, border=15) self.Layout() self.SetSizerAndFit(s) self.Centre()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in this version:')) s.Add(wx.StaticText(p, -1, '* Improved the LayerView rendering speed.')) s.Add( wx.StaticText( p, -1, '* Made the LayerView update during slicing, so you can see the result before it is ready.' )) s.Add( wx.StaticText(p, -1, '* New USB printing dialog, smaller, cleaner.')) s.Add( wx.StaticText(p, -1, '* Selectable USB printing dialogs, from plugins.')) s.Add( wx.StaticText( p, -1, '* Selection between new grid or old line based support material.' )) s.Add( wx.StaticText( p, -1, '* Profile settings are now stored per machine instead of global for all machines.' )) s.Add( wx.StaticText( p, -1, '* Added TweakAtZ 3.1 plugin per default. Thanks to Steve Morlock, Ricardo Gomez and Stefan Heule.' )) s.Add( wx.StaticText( p, -1, '* Added separate speeds for outer and inner shells.')) s.Add(wx.StaticText(p, -1, '* Added expert Z-Hop feature.')) s.Add( wx.StaticText( p, -1, '* Removed need for temp files, which speeds up Cura on slower harddisks.' )) s.Add( wx.StaticText( p, -1, '* Added expert setting to configure support material angle.')) s.Add(wx.StaticText(p, -1, '* Allow round printer beds for Deltabots.')) self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2:')) s.Add( wx.StaticText(p, -1, '* Added pause function during printing.')) s.Add( wx.StaticText( p, -1, '* Added material selection when changing material.')) s.Add( wx.StaticText( p, -1, '* Fixed the move material maintenance function.')) s.Add( wx.StaticText(p, -1, '* Fixed the led brightness on startup.')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP | wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def __init__(self): super(mainWindow, self).__init__(None, title='Cura - ' + version.getVersion()) self.extruderCount = int(profile.getPreference('extruder_amount')) wx.EVT_CLOSE(self, self.OnClose) self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.supportedExtensions())) self.normalModeOnlyItems = [] self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() i = self.fileMenu.Append(-1, 'Load model file...\tCTRL+L') self.Bind(wx.EVT_MENU, lambda e: self._showModelLoadDialog(1), i) i = self.fileMenu.Append(-1, 'Prepare print...\tCTRL+R') self.Bind(wx.EVT_MENU, self.OnSlice, i) i = self.fileMenu.Append(-1, 'Print...\tCTRL+P') self.Bind(wx.EVT_MENU, self.OnPrint, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Open Profile...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) i = self.fileMenu.Append(-1, 'Save Profile...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) i = self.fileMenu.Append(-1, 'Load Profile from GCode...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Reset Profile to default') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnResetProfile, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Preferences...\tCTRL+,') self.Bind(wx.EVT_MENU, self.OnPreferences, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(wx.ID_EXIT, 'Quit') self.Bind(wx.EVT_MENU, self.OnQuit, i) self.menubar.Append(self.fileMenu, '&File') toolsMenu = wx.Menu() 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...') self.switchToNormalMenuItem = i self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) toolsMenu.AppendSeparator() i = toolsMenu.Append(-1, 'Batch run...') self.Bind(wx.EVT_MENU, self.OnBatchRun, i) i = toolsMenu.Append(-1, 'Project planner...') self.Bind(wx.EVT_MENU, self.OnProjectPlanner, i) # i = toolsMenu.Append(-1, 'Open SVG (2D) slicer...') # self.Bind(wx.EVT_MENU, self.OnSVGSlicerOpen, i) self.menubar.Append(toolsMenu, 'Tools') expertMenu = wx.Menu() i = expertMenu.Append(-1, 'Open expert settings...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) expertMenu.AppendSeparator() if firmwareInstall.getDefaultFirmware() is not None: i = expertMenu.Append(-1, 'Install default Marlin firmware') self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware, i) i = expertMenu.Append(-1, 'Install custom firmware') self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, 'Run first run wizard...') self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i) i = expertMenu.Append(-1, 'Run bed leveling wizard...') self.Bind(wx.EVT_MENU, self.OnBedLevelWizard, i) self.menubar.Append(expertMenu, 'Expert') helpMenu = wx.Menu() i = helpMenu.Append(-1, 'Online documentation...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('http://daid.github.com/Cura'), i) i = helpMenu.Append(-1, 'Report a problem...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i) self.menubar.Append(helpMenu, 'Help') self.SetMenuBar(self.menubar) if profile.getPreference('lastFile') != '': self.filelist = profile.getPreference('lastFile').split(';') self.SetTitle('Cura - %s - %s' % (version.getVersion(), self.filelist[-1])) else: self.filelist = [] self.progressPanelList = [] ##Gui components## self.simpleSettingsPanel = simpleMode.simpleModePanel(self) self.normalSettingsPanel = normalSettingsPanel(self) #Preview window self.preview3d = preview3d.previewPanel(self) # load and slice buttons. loadButton = wx.Button(self, -1, '&Load model') sliceButton = wx.Button(self, -1, 'P&repare print') printButton = wx.Button(self, -1, '&Print') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(1), loadButton) self.Bind(wx.EVT_BUTTON, self.OnSlice, sliceButton) self.Bind(wx.EVT_BUTTON, self.OnPrint, printButton) if self.extruderCount > 1: loadButton2 = wx.Button(self, -1, 'Load Dual') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(2), loadButton2) if self.extruderCount > 2: loadButton3 = wx.Button(self, -1, 'Load Triple') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(3), loadButton3) if self.extruderCount > 3: loadButton4 = wx.Button(self, -1, 'Load Quad') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(4), loadButton4) #Also bind double clicking the 3D preview to load an STL file. self.preview3d.glCanvas.Bind(wx.EVT_LEFT_DCLICK, lambda e: self._showModelLoadDialog(1), self.preview3d.glCanvas) #Main sizer, to position the preview window, buttons and tab control sizer = wx.GridBagSizer() self.SetSizer(sizer) sizer.Add(self.preview3d, (0,1), span=(1,2+self.extruderCount), flag=wx.EXPAND) sizer.AddGrowableCol(2 + self.extruderCount) sizer.AddGrowableRow(0) sizer.Add(loadButton, (1,1), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) if self.extruderCount > 1: sizer.Add(loadButton2, (1,2), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) if self.extruderCount > 2: sizer.Add(loadButton3, (1,3), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) if self.extruderCount > 3: sizer.Add(loadButton4, (1,4), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) sizer.Add(sliceButton, (1,1+self.extruderCount), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) sizer.Add(printButton, (1,2+self.extruderCount), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) self.sizer = sizer if len(self.filelist) > 0: self.preview3d.loadModelFiles(self.filelist) self.updateProfileToControls() self.SetBackgroundColour(self.normalSettingsPanel.GetBackgroundColour()) self.simpleSettingsPanel.Show(False) self.normalSettingsPanel.Show(False) self.updateSliceMode() if wx.Display().GetClientArea().GetWidth() < self.GetSize().GetWidth(): f = self.GetSize().GetWidth() - wx.Display().GetClientArea().GetWidth() self.preview3d.SetMinSize(self.preview3d.GetMinSize().DecBy(f, 0)) self.Fit() self.preview3d.Fit() #self.SetMinSize(self.GetSize()) self.Centre() self.Show(True) self.Centre()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in version 15.04.6:')) s.Add(wx.StaticText(p, -1, '* Improved material profiles for PLA, ABS and CPE for the Ultimaker 2+ family.')) s.Add(wx.StaticText(p, -1, 'New in version 15.04.5:')) s.Add(wx.StaticText(p, -1, '* Fixed Ultimaker2 family build volume, which was configured too big by default.')) s.Add(wx.StaticText(p, -1, '* Bugfix for nozzle sizes being incorrectly copied when switching from quickprint to full settings.')) s.Add(wx.StaticText(p, -1, '* Bugfix for selected platform adhesion type not being remembered in quickprint mode.')) s.Add(wx.StaticText(p, -1, '* Bugfix for head size of the Ultimaker2+, which caused the head to bump into prints in one-at-a-time mode.')) self.has_machine = {} for n in xrange(0, profile.getMachineCount()): self.has_machine[profile.getMachineSetting('machine_type', n)] = n if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if 'ultimaker' in self.has_machine and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2' in self.has_machine and True: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker 2:')) s.Add(wx.StaticText(p, -1, '* Updated error messages, to assist in getting better support')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker2']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2+' in self.has_machine and True: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker 2+:')) s.Add(wx.StaticText(p, -1, '* Updated error messages, to assist in getting better support')) s.Add(wx.StaticText(p, -1, '* Bugfix for the import/export material settings which was not working properly')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker2+']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2+extended' in self.has_machine and True: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2+Extended:')) s.Add(wx.StaticText(p, -1, '* Fixed temperature stability.')) s.Add(wx.StaticText(p, -1, '* Fixed print starting problems when a material warning was ignored')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker2+extended']), button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP|wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def __init__(self): super(mainWindow, self).__init__(None, title='SawersPrinter3D - ' + version.getVersion()) wx.EVT_CLOSE(self, self.OnClose) # allow dropping any file, restrict later self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles)) self.normalModeOnlyItems = [] mruFile = os.path.join(profile.getBasePath(), 'mru_filelist.ini') self.config = wx.FileConfig(appName="Cura", localFilename=mruFile, style=wx.CONFIG_USE_LOCAL_FILE) self.ID_MRU_MODEL1, self.ID_MRU_MODEL2, self.ID_MRU_MODEL3, self.ID_MRU_MODEL4, self.ID_MRU_MODEL5, self.ID_MRU_MODEL6, self.ID_MRU_MODEL7, self.ID_MRU_MODEL8, self.ID_MRU_MODEL9, self.ID_MRU_MODEL10 = [wx.NewId() for line in xrange(10)] self.modelFileHistory = wx.FileHistory(10, self.ID_MRU_MODEL1) self.config.SetPath("/ModelMRU") self.modelFileHistory.Load(self.config) self.ID_MRU_PROFILE1, self.ID_MRU_PROFILE2, self.ID_MRU_PROFILE3, self.ID_MRU_PROFILE4, self.ID_MRU_PROFILE5, self.ID_MRU_PROFILE6, self.ID_MRU_PROFILE7, self.ID_MRU_PROFILE8, self.ID_MRU_PROFILE9, self.ID_MRU_PROFILE10 = [wx.NewId() for line in xrange(10)] self.profileFileHistory = wx.FileHistory(10, self.ID_MRU_PROFILE1) self.config.SetPath("/ProfileMRU") self.profileFileHistory.Load(self.config) self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() i = self.fileMenu.Append(-1, _("Load model file...\tCTRL+L")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showLoadModel(), i) i = self.fileMenu.Append(-1, _("Save model...\tCTRL+S")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveModel(), i) i = self.fileMenu.Append(-1, _("Clear platform")) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnDeleteAll(e), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Print...\tCTRL+P")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showPrintWindow(), i) i = self.fileMenu.Append(-1, _("Save GCode...")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveGCode(), i) i = self.fileMenu.Append(-1, _("Show slice engine log...")) self.Bind(wx.EVT_MENU, lambda e: self.scene._showSliceLog(), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Open Profile...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) i = self.fileMenu.Append(-1, _("Save Profile...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) i = self.fileMenu.Append(-1, _("Load Profile from GCode...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Reset Profile to default")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnResetProfile, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Preferences...\tCTRL+,")) self.Bind(wx.EVT_MENU, self.OnPreferences, i) i = self.fileMenu.Append(-1, _("Machine settings...")) self.Bind(wx.EVT_MENU, self.OnMachineSettings, i) self.fileMenu.AppendSeparator() # Model MRU list modelHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), '&' + _("Recent Model Files"), modelHistoryMenu) self.modelFileHistory.UseMenu(modelHistoryMenu) self.modelFileHistory.AddFilesToMenu() self.Bind(wx.EVT_MENU_RANGE, self.OnModelMRU, id=self.ID_MRU_MODEL1, id2=self.ID_MRU_MODEL10) # Profle MRU list profileHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), _("Recent Profile Files"), profileHistoryMenu) 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")) self.Bind(wx.EVT_MENU, self.OnQuit, i) self.menubar.Append(self.fileMenu, '&' + _("File")) toolsMenu = wx.Menu() #i = toolsMenu.Append(-1, 'Batch run...') #self.Bind(wx.EVT_MENU, self.OnBatchRun, i) #self.normalModeOnlyItems.append(i) if minecraftImport.hasMinecraft(): i = toolsMenu.Append(-1, _("Minecraft map import...")) self.Bind(wx.EVT_MENU, self.OnMinecraftImport, i) if version.isDevVersion(): i = toolsMenu.Append(-1, _("PID Debugger...")) self.Bind(wx.EVT_MENU, self.OnPIDDebugger, i) i = toolsMenu.Append(-1, _("Copy profile to clipboard")) self.Bind(wx.EVT_MENU, self.onCopyProfileClipboard,i) self.menubar.Append(toolsMenu, _("Tools")) #Machine menu for machine configuration/tooling self.machineMenu = wx.Menu() self.updateMachineMenu() self.menubar.Append(self.machineMenu, _("Machine")) expertMenu = wx.Menu() i = expertMenu.Append(-1, _("Switch to quickprint..."), kind=wx.ITEM_RADIO) self.switchToQuickprintMenuItem = i self.Bind(wx.EVT_MENU, self.OnSimpleSwitch, i) i = expertMenu.Append(-1, _("Switch to full settings..."), kind=wx.ITEM_RADIO) self.switchToNormalMenuItem = i self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, _("Open expert settings...\tCTRL+E")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, _("Run first run wizard...")) 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) self.headOffsetWizardMenuItem = expertMenu.Append(-1, _("Run head offset wizard...")) self.Bind(wx.EVT_MENU, self.OnHeadOffsetWizard, self.headOffsetWizardMenuItem) self.menubar.Append(expertMenu, _("Expert")) helpMenu = wx.Menu() i = helpMenu.Append(-1, _("Online documentation...")) self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('http://daid.github.com/Cura'), i) i = helpMenu.Append(-1, _("Report a problem...")) self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i) i = helpMenu.Append(-1, _("Check for update...")) self.Bind(wx.EVT_MENU, self.OnCheckForUpdate, i) i = helpMenu.Append(-1, _("Open YouMagine website...")) self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://www.youmagine.com/'), i) i = helpMenu.Append(-1, _("About Cura...")) self.Bind(wx.EVT_MENU, self.OnAbout, i) self.menubar.Append(helpMenu, _("Help")) self.SetMenuBar(self.menubar) self.splitter = wx.SplitterWindow(self, style = wx.SP_3D | wx.SP_LIVE_UPDATE) self.leftPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.rightPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.splitter.Bind(wx.EVT_SPLITTER_DCLICK, lambda evt: evt.Veto()) ##Gui components## self.simpleSettingsPanel = simpleMode.simpleModePanel(self.leftPane, lambda : self.scene.sceneUpdated()) self.normalSettingsPanel = normalSettingsPanel(self.leftPane, lambda : self.scene.sceneUpdated()) self.leftSizer = wx.BoxSizer(wx.VERTICAL) self.leftSizer.Add(self.simpleSettingsPanel, 1) self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND) self.leftPane.SetSizer(self.leftSizer) #Preview window self.scene = sceneView.SceneView(self.rightPane) #Main sizer, to position the preview window, buttons and tab control sizer = wx.BoxSizer() self.rightPane.SetSizer(sizer) sizer.Add(self.scene, 1, flag=wx.EXPAND) # Main window sizer sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) sizer.Add(self.splitter, 1, wx.EXPAND) sizer.Layout() self.sizer = sizer self.updateProfileToAllControls() self.SetBackgroundColour(self.normalSettingsPanel.GetBackgroundColour()) self.simpleSettingsPanel.Show(False) self.normalSettingsPanel.Show(False) # Set default window size & position self.SetSize((wx.Display().GetClientArea().GetWidth()/2,wx.Display().GetClientArea().GetHeight()/2)) self.Centre() #Timer set; used to check if profile is on the clipboard self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.onTimer) self.timer.Start(1000) self.lastTriedClipboard = profile.getProfileString() # Restore the window position, size & state from the preferences file try: if profile.getPreference('window_maximized') == 'True': self.Maximize(True) else: posx = int(profile.getPreference('window_pos_x')) posy = int(profile.getPreference('window_pos_y')) width = int(profile.getPreference('window_width')) height = int(profile.getPreference('window_height')) if posx > 0 or posy > 0: self.SetPosition((posx,posy)) if width > 0 and height > 0: self.SetSize((width,height)) self.normalSashPos = int(profile.getPreference('window_normal_sash')) except: self.normalSashPos = 0 self.Maximize(True) if self.normalSashPos < self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5: self.normalSashPos = self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5 self.splitter.SplitVertically(self.leftPane, self.rightPane, self.normalSashPos) if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.Centre() if wx.Display.GetFromPoint((self.GetPositionTuple()[0] + self.GetSizeTuple()[1], self.GetPositionTuple()[1] + self.GetSizeTuple()[1])) < 0: self.Centre() if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.SetSize((800,600)) self.Centre() self.updateSliceMode()
def __init__(self): super(mainWindow, self).__init__(None, title=_('Tinkerine Suite - ') + version.getVersion()) #super(mainWindow, self).__init__(None, title='Cura - ' + version.getVersion(),style=wx.DEFAULT_FRAME_STYLE & wx.NO_BORDER & ~wx.SYSTEM_MENU) ico = wx.Icon(getPathForImage(_('../suite.ico')), wx.BITMAP_TYPE_ICO) self.SetIcon(ico) self.extruderCount = int(profile.getPreference('extruder_amount')) wx.EVT_CLOSE(self, self.OnClose) self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.loadSupportedExtensions())) self.normalModeOnlyItems = [] mruFile = os.path.join(profile.getBasePath(), 'mru_filelist.ini') self.config = wx.FileConfig(appName=_("Tinkerine Suite"), localFilename=mruFile, style=wx.CONFIG_USE_LOCAL_FILE) self.ID_MRU_MODEL1, self.ID_MRU_MODEL2, self.ID_MRU_MODEL3, self.ID_MRU_MODEL4, self.ID_MRU_MODEL5, self.ID_MRU_MODEL6, self.ID_MRU_MODEL7, self.ID_MRU_MODEL8, self.ID_MRU_MODEL9, self.ID_MRU_MODEL10 = [wx.NewId() for line in xrange(10)] self.modelFileHistory = wx.FileHistory(10, self.ID_MRU_MODEL1) self.config.SetPath("/ModelMRU") self.modelFileHistory.Load(self.config) self.ID_MRU_PROFILE1, self.ID_MRU_PROFILE2, self.ID_MRU_PROFILE3, self.ID_MRU_PROFILE4, self.ID_MRU_PROFILE5, self.ID_MRU_PROFILE6, self.ID_MRU_PROFILE7, self.ID_MRU_PROFILE8, self.ID_MRU_PROFILE9, self.ID_MRU_PROFILE10 = [wx.NewId() for line in xrange(10)] self.profileFileHistory = wx.FileHistory(10, self.ID_MRU_PROFILE1) self.config.SetPath("/ProfileMRU") self.profileFileHistory.Load(self.config) self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() i = self.fileMenu.Append(-1, _('Load model file...\tCTRL+L')) self.Bind(wx.EVT_MENU, lambda e: self.scene.showLoadModel(), i) i = self.fileMenu.Append(-1, _('Save model...\tCTRL+S')) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveModel(), i) i = self.fileMenu.Append(-1, _('Clear platform')) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnDeleteAll(e), i) #self.fileMenu.AppendSeparator() #i = self.fileMenu.Append(-1, 'Print...\tCTRL+P') #self.Bind(wx.EVT_MENU, lambda e: self.scene.showPrintWindow(), i) #i = self.fileMenu.Append(-1, 'Save GCode...') #self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveGCode(), i) #i = self.fileMenu.Append(-1, 'Show slice engine log...') #self.Bind(wx.EVT_MENU, lambda e: self.scene._showSliceLog(), i) #self.fileMenu.AppendSeparator() #i = self.fileMenu.Append(-1, 'Open Profile...') #self.normalModeOnlyItems.append(i) #self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) #i = self.fileMenu.Append(-1, 'Save Profile...') #self.normalModeOnlyItems.append(i) #self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) #i = self.fileMenu.Append(-1, 'Load Profile from GCode...') #self.normalModeOnlyItems.append(i) #self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) #self.fileMenu.AppendSeparator() #i = self.fileMenu.Append(-1, 'Reset Profile to default') #self.normalModeOnlyItems.append(i) #self.Bind(wx.EVT_MENU, self.OnResetProfile, i) #self.fileMenu.AppendSeparator() #i = self.fileMenu.Append(-1, 'Preferences...\tCTRL+,') #self.Bind(wx.EVT_MENU, self.OnPreferences, i) self.fileMenu.AppendSeparator() # Model MRU list modelHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), _("&Recent Model Files"), modelHistoryMenu) self.modelFileHistory.UseMenu(modelHistoryMenu) self.modelFileHistory.AddFilesToMenu() self.Bind(wx.EVT_MENU_RANGE, self.OnModelMRU, id=self.ID_MRU_MODEL1, id2=self.ID_MRU_MODEL10) # Profle MRU list #profileHistoryMenu = wx.Menu() #self.fileMenu.AppendMenu(wx.NewId(), "&Recent Profile Files", profileHistoryMenu) #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')) self.Bind(wx.EVT_MENU, self.OnQuit, i) self.menubar.Append(self.fileMenu, _('&File')) #toolsMenu = wx.Menu() #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...') #self.switchToNormalMenuItem = i #self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) #toolsMenu.AppendSeparator() #i = toolsMenu.Append(-1, 'Batch run...') #self.Bind(wx.EVT_MENU, self.OnBatchRun, i) #self.normalModeOnlyItems.append(i) #if minecraftImport.hasMinecraft(): # i = toolsMenu.Append(-1, 'Minecraft import...') # self.Bind(wx.EVT_MENU, self.OnMinecraftImport, i) #self.menubar.Append(toolsMenu, 'Tools') expertMenu = wx.Menu() if version.isDevVersion(): i = expertMenu.Append(-1, _('Open expert settings...')) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) expertMenu.AppendSeparator() if firmwareInstall.getDefaultFirmware() is not None: i = expertMenu.Append(-1, 'Install default Marlin firmware') self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware, i) i = expertMenu.Append(-1, _('Install custom firmware')) self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i) #expertMenu.AppendSeparator() #i = expertMenu.Append(-1, 'Run first run wizard...') #self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i) #i = expertMenu.Append(-1, 'Run bed leveling wizard...') #self.Bind(wx.EVT_MENU, self.OnBedLevelWizard, i) #if self.extruderCount > 1: # i = expertMenu.Append(-1, 'Run head offset wizard...') # self.Bind(wx.EVT_MENU, self.OnHeadOffsetWizard, i) self.menubar.Append(expertMenu, 'Advanced') #DEBUG helpMenu = wx.Menu() #i = helpMenu.Append(-1, 'Online documentation...') #self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('http://daid.github.com/Cura'), i) #i = helpMenu.Append(-1, 'Report a problem...') #self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i)sdf #i = helpMenu.Append(-1, 'Check for update...') #self.Bind(wx.EVT_MENU, self.OnCheckForUpdate, i) i = helpMenu.Append(-1, _('About Tinkerine Suite')) self.Bind(wx.EVT_MENU, self.OnAbout, i) self.menubar.Append(helpMenu, _('About')) self.SetMenuBar(self.menubar) self.splitter = wx.SplitterWindow(self, style = wx.SP_3D | wx.SP_LIVE_UPDATE) #self.splitter2 = wx.SplitterWindow(self.splitter, style = wx.SP_3D | wx.SP_LIVE_UPDATE) #self.leftPane = wx.Panel(self.splitter2, style=wx.BORDER_NONE) self.rightPane = wx.Panel(self, style=wx.BORDER_NONE) #self.splitter.Bind(wx.EVT_SPLITTER_DCLICK, lambda evt: evt.Veto()) # wx.BeginBusyCursor() # self.rightPane.SetCursor(self.defaultCursor) ##Gui components## #self.simpleSettingsPanel = simpleMode.simpleModePanel(self.leftPane, lambda : self.scene.sceneUpdated()) self.normalSettingsPanel = normalSettingsPanel(self, lambda : self.scene.sceneUpdated()) #self.abuttonthing = wx.Button(self.splitter2,2,"<", size=(15,100)) #self.abuttonthing.Bind(wx.EVT_BUTTON,self.changeMode) #self.abuttonthing = wx.Button(self.splitter2,2,">") self.leftSizer = wx.BoxSizer(wx.HORIZONTAL) #self.leftSizer.Add(self.abuttonthing,1) #self.leftSizer.Add(self.simpleSettingsPanel) self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND) #self.leftPane.SetSizer(self.leftSizer) #self.splitter2.SplitVertically(self.abuttonthing, self.leftPane) #self.splitter2.SetSashGravity(0) #self.splitter2.SetSashPosition(10, True) #Preview window self.scene = sceneView.SceneView(self.rightPane) #Main sizer, to position the preview window, buttons and tab control sizer = wx.BoxSizer() self.rightPane.SetSizer(sizer) sizer.Add(self.scene, 1, flag=wx.EXPAND) # Main window sizer sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) sizer.Add(self.rightPane, 1, wx.EXPAND) sizer.Layout() self.sizer = sizer #self.updateProfileToControls() self.SetBackgroundColour(self.normalSettingsPanel.GetBackgroundColour()) #self.simpleSettingsPanel.Show(False) self.normalSettingsPanel.Show(False) # Set default window size & position self.SetSize((wx.Display().GetClientArea().GetWidth()/2,wx.Display().GetClientArea().GetHeight()/2)) self.Centre() #self.splitter.SetSashGravity(1) # Restore the window position, size & state from the preferences file try: if profile.getPreference('window_maximized') == 'True': self.Maximize(True) else: posx = int(profile.getPreference('window_pos_x')) posy = int(profile.getPreference('window_pos_y')) width = int(profile.getPreference('window_width')) height = int(profile.getPreference('window_height')) if posx > 0 or posy > 0: self.SetPosition((posx,posy)) if width > 0 and height > 0: self.SetSize((width,height)) self.normalSashPos = int(profile.getPreference('window_normal_sash')) except: self.normalSashPos = 0 self.Maximize(True) #if self.normalSashPos < self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5: # self.normalSashPos = self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5 #self.splitter.SplitVertically(self.rightPane, self.splitter2, self.normalSashPos) if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.Centre() if wx.Display.GetFromPoint((self.GetPositionTuple()[0] + self.GetSizeTuple()[1], self.GetPositionTuple()[1] + self.GetSizeTuple()[1])) < 0: self.Centre() if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.SetSize((800,600)) self.Centre() self.updateSliceMode()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in version 15.04.4:')) s.Add(wx.StaticText(p, -1, '* Added Ultimaker 2+ and Ultimaker 2 Extended+ machines')) s.Add(wx.StaticText(p, -1, '* Added quick print profiles for Ultimaker 2+ and Ultimaker 2 Extended+')) s.Add(wx.StaticText(p, -1, '* Added feature where quickprint profiles can be per nozzle size and material')) self.has_machine = {} for n in xrange(0, profile.getMachineCount()): self.has_machine[profile.getMachineSetting('machine_type', n)] = n if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if 'ultimaker' in self.has_machine and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2' in self.has_machine and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker 2:')) s.Add(wx.StaticText(p, -1, '* Added option to change filament when pausing during a print.')) s.Add(wx.StaticText(p, -1, '* Prevent temperature display jitter (thanks to TinkerGnome)')) s.Add(wx.StaticText(p, -1, '* Fixed problems with filenames containing an umlaut.')) s.Add(wx.StaticText(p, -1, '* Improved pause handling (thanks to ThinkerGnome)')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker2']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2+' in self.has_machine and True: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker 2+:')) s.Add(wx.StaticText(p, -1, '* Fixed temperature stability.')) s.Add(wx.StaticText(p, -1, '* Fixed print starting problems when a material warning was ignored')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker2+']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2+extended' in self.has_machine and True: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2+Extended:')) s.Add(wx.StaticText(p, -1, '* Fixed temperature stability.')) s.Add(wx.StaticText(p, -1, '* Fixed print starting problems when a material warning was ignored')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker2+extended']), button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP|wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def OnLoadDraudiModel(self, e): if sys.platform.startswith('win'): dir = r"C:\\Program Files (x86)\\Cura-BCN3D-%s-beta2\\resources\\draudi_stl" % version.getVersion( ) dlg = wx.FileDialog(self, _("Load Draudi File"), dir, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE) dlg.SetWildcard("stl files (*.stl)|*.STL") if dlg.ShowModal() != wx.ID_OK: dlg.Destroy() return filenames = dlg.GetPaths() dlg.Destroy() if len(filenames) < 1: return False self.scene.loadFiles(filenames) # If we a running on mac os elif sys.platform.startswith('darwin'): dir = '/Applications/Cura/Cura-BCN3D.app/Contents/Resources/draudi_stl' dlg = wx.FileDialog(self, _("Load Draudi File"), dir, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE) dlg.SetWildcard("stl files (*.stl)|*.STL") if dlg.ShowModal() != wx.ID_OK: dlg.Destroy() return filenames = dlg.GetPaths() dlg.Destroy() if len(filenames) < 1: return False self.scene.loadFiles(filenames)
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura-BCN3D-' + version.getVersion() + ' (beta2)') title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura-BCN3D.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in version 0.1.5 (beta2)')) s.Add(wx.StaticText(p, -1, '* Fixed several bugs')) s.Add(wx.StaticText(p, -1, '* Fixed sequence that would make Cura-BCN3D crash')) self.has_machine = {} for n in xrange(0, profile.getMachineCount()): self.has_machine[profile.getMachineSetting('machine_type', n)] = n if profile.getMachineSetting('machine_type', n) == 'BCN3DSigma': self.hasBCN3DSigma = n if profile.getMachineSetting('machine_type', n) == 'BCN3DPlus': self.hasBCN3DPlus = n if profile.getMachineSetting('machine_type', n) == 'BCN3DR': self.hasBCN3DR = n if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if 'BCN3DSigma' in self.has_machine and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your BCN3D Sigma:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['BCN3DSigma']), button) s.Add(button, flag=wx.TOP, border=5) if 'BCN3DPlus' in self.has_machine and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your BCN3D Plus:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['BCN3DPlus']), button) s.Add(button, flag=wx.TOP, border=5) if 'BCN3DR' in self.has_machine and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your BCN3D R:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['BCN3DR']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker' in self.has_machine and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2' in self.has_machine and True: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker 2:')) s.Add(wx.StaticText(p, -1, '* Updated error messages, to assist in getting better support')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker2']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2+' in self.has_machine and True: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker 2+:')) s.Add(wx.StaticText(p, -1, '* Updated error messages, to assist in getting better support')) s.Add(wx.StaticText(p, -1, '* Bugfix for the import/export material settings which was not working properly')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker2+']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2+extended' in self.has_machine and True: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2+Extended:')) s.Add(wx.StaticText(p, -1, '* Fixed temperature stability.')) s.Add(wx.StaticText(p, -1, '* Fixed print starting problems when a material warning was ignored')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall(self.has_machine['ultimaker2+extended']), button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP|wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def afterSplashCallback(self): #These imports take most of the time and thus should be done after showing the splashscreen import webbrowser from Cura.gui import mainWindow from Cura.gui import configWizard from Cura.gui import newVersionDialog from Cura.util import profile from Cura.util import resources from Cura.util import version resources.setupLocalization(profile.getPreference('language')) # it's important to set up localization at very beginning to install _ try: from distutils.version import LooseVersion if LooseVersion(wx.__version__) < LooseVersion('3.0'): wx.MessageBox(_("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s.") % wx.__version__, _("WxPython version is too old"), wx.OK | wx.ICON_ERROR) return except: # distutils not found.. it can happen! # Only check the first 3 characters of the version string instead if float(wx.__version__[0:3]) < 3.0: wx.MessageBox(_("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s.") % wx.__version__, _("WxPython version is too old"), wx.OK | wx.ICON_ERROR) return #If we do not have preferences yet, try to load it from a previous Cura install if profile.getMachineSetting('machine_type') == 'unknown': try: otherCuraInstalls = profile.getAlternativeBasePaths() for path in otherCuraInstalls[::-1]: try: print 'Loading old settings from %s' % (path) profile.loadPreferences(os.path.join(path, 'preferences.ini')) profile.loadProfile(os.path.join(path, 'current_profile.ini')) break except: import traceback print traceback.print_exc() except: import traceback print traceback.print_exc() #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown': #Check if we need to copy our examples exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'Rocktopus.stl')) self.loadFiles = [exampleFile] self.destroySplashScreen() configWizard.ConfigWizard() if profile.getPreference('check_for_updates') == 'True': newVersion = version.checkForNewerVersion() if newVersion is not None: self.destroySplashScreen() if wx.MessageBox(_("A new version of Cura is available, would you like to download?"), _("New version available"), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES: webbrowser.open(newVersion) return if profile.getMachineSetting('machine_name') == '': return if profile.getPreference('last_run_version') != version.getVersion(False): profile.performVersionUpgrade() # Must happen before the main window is created, in case there are changes # that would affect it (such as machine name changes) if version.isDevVersion(): profile.performVersionUpgrade() self.mainWindow = mainWindow.mainWindow() self.destroySplashScreen() self.SetTopWindow(self.mainWindow) self.mainWindow.Show() self.mainWindow.OnDropFiles(self.loadFiles) setFullScreenCapable(self.mainWindow) if profile.getPreference('last_run_version') != version.getVersion(False): profile.putPreference('last_run_version', version.getVersion(False)) newVersionDialog.newVersionDialog().Show() # Must come after creating the main window #if version.isDevVersion(): #import wx.lib.inspection # Show the WX widget inspection tool #wx.lib.inspection.InspectionTool().Show() if sys.platform.startswith('darwin'): wx.CallAfter(self.StupidMacOSWorkaround)
def __init__(self): super(mainWindow, self).__init__(None, title='Cura - ' + version.getVersion()) wx.EVT_CLOSE(self, self.OnClose) # allow dropping any file, restrict later self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles)) # TODO: wxWidgets 2.9.4 has a bug when NSView does not register for dragged types when wx drop target is set. It was fixed in 2.9.5 if sys.platform.startswith('darwin'): try: import objc nswindow = objc.objc_object(c_void_p=self.MacGetTopLevelWindowRef()) view = nswindow.contentView() view.registerForDraggedTypes_([u'NSFilenamesPboardType']) except: pass self.normalModeOnlyItems = [] mruFile = os.path.join(profile.getBasePath(), 'mru_filelist.ini') self.config = wx.FileConfig(appName="Cura", localFilename=mruFile, style=wx.CONFIG_USE_LOCAL_FILE) self.ID_MRU_MODEL1, self.ID_MRU_MODEL2, self.ID_MRU_MODEL3, self.ID_MRU_MODEL4, self.ID_MRU_MODEL5, self.ID_MRU_MODEL6, self.ID_MRU_MODEL7, self.ID_MRU_MODEL8, self.ID_MRU_MODEL9, self.ID_MRU_MODEL10 = [wx.NewId() for line in xrange(10)] self.modelFileHistory = wx.FileHistory(10, self.ID_MRU_MODEL1) self.config.SetPath("/ModelMRU") self.modelFileHistory.Load(self.config) self.ID_MRU_PROFILE1, self.ID_MRU_PROFILE2, self.ID_MRU_PROFILE3, self.ID_MRU_PROFILE4, self.ID_MRU_PROFILE5, self.ID_MRU_PROFILE6, self.ID_MRU_PROFILE7, self.ID_MRU_PROFILE8, self.ID_MRU_PROFILE9, self.ID_MRU_PROFILE10 = [wx.NewId() for line in xrange(10)] self.profileFileHistory = wx.FileHistory(10, self.ID_MRU_PROFILE1) self.config.SetPath("/ProfileMRU") self.profileFileHistory.Load(self.config) self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() i = self.fileMenu.Append(-1, _(u"모델 불러오기...\tCTRL+L")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showLoadModel(), i) i = self.fileMenu.Append(-1, _(u"모델 저장하기...\tCTRL+S")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveModel(), i) i = self.fileMenu.Append(-1, _(u"새로고침\tF5")) self.Bind(wx.EVT_MENU, lambda e: self.scene.reloadScene(e), i) i = self.fileMenu.Append(-1, _(u"모델링 지우기")) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnDeleteAll(e), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _(u"출력하기...\tCTRL+P")) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnPrintButton(1), i) i = self.fileMenu.Append(-1, _(u"G코드 저장하기...")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveGCode(), i) i = self.fileMenu.Append(-1, _(u"슬라이스 엔진 로그 보기...")) self.Bind(wx.EVT_MENU, lambda e: self.scene._showEngineLog(), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _(u"설정 불러오기...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) i = self.fileMenu.Append(-1, _(u"설정 저장하기...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) i = self.fileMenu.Append(-1, _(u"G코드의 설정값 불러오기...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _(u"설정값 초기화")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnResetProfile, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _(u"환경설정...\tCTRL+,")) self.Bind(wx.EVT_MENU, self.OnPreferences, i) i = self.fileMenu.Append(-1, _(u"기기 세팅...")) self.Bind(wx.EVT_MENU, self.OnMachineSettings, i) self.fileMenu.AppendSeparator() # Model MRU list modelHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), '&' + _(u"최근 모델파일"), modelHistoryMenu) self.modelFileHistory.UseMenu(modelHistoryMenu) self.modelFileHistory.AddFilesToMenu() self.Bind(wx.EVT_MENU_RANGE, self.OnModelMRU, id=self.ID_MRU_MODEL1, id2=self.ID_MRU_MODEL10) # Profle MRU list profileHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), _(u"최근 설정파일"), profileHistoryMenu) 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, _(u"종료")) self.Bind(wx.EVT_MENU, self.OnQuit, i) self.menubar.Append(self.fileMenu, '&' + _(u"파일(File)")) toolsMenu = wx.Menu() #i = toolsMenu.Append(-1, 'Batch run...') #self.Bind(wx.EVT_MENU, self.OnBatchRun, i) #self.normalModeOnlyItems.append(i) if minecraftImport.hasMinecraft(): i = toolsMenu.Append(-1, _("Minecraft map import...")) self.Bind(wx.EVT_MENU, self.OnMinecraftImport, i) if version.isDevVersion(): i = toolsMenu.Append(-1, _("PID Debugger...")) self.Bind(wx.EVT_MENU, self.OnPIDDebugger, i) i = toolsMenu.Append(-1, _(u"클립보드에 설정 복사하기")) self.Bind(wx.EVT_MENU, self.onCopyProfileClipboard,i) toolsMenu.AppendSeparator() self.allAtOnceItem = toolsMenu.Append(-1, _(u"한 번에 모두 출력"), kind=wx.ITEM_RADIO) self.Bind(wx.EVT_MENU, self.onOneAtATimeSwitch, self.allAtOnceItem) self.oneAtATime = toolsMenu.Append(-1, _(u"차례로 하나씩 출력"), 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, _(u"도구(Tools)")) #Machine menu for machine configuration/tooling self.machineMenu = wx.Menu() self.updateMachineMenu() self.menubar.Append(self.machineMenu, _(u"기기(Machine)")) expertMenu = wx.Menu() i = expertMenu.Append(-1, _(u"간편 출력모드로 전환..."), kind=wx.ITEM_RADIO) self.switchToQuickprintMenuItem = i self.Bind(wx.EVT_MENU, self.OnSimpleSwitch, i) i = expertMenu.Append(-1, _(u"상세 설정모드로 전환..."), kind=wx.ITEM_RADIO) self.switchToNormalMenuItem = i self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, _(u"전문가설정...\tCTRL+E")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, _(u"초기설정 마법사...")) self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i) self.bedLevelWizardMenuItem = expertMenu.Append(-1, _(u"베드수평 마법사...")) self.Bind(wx.EVT_MENU, self.OnBedLevelWizard, self.bedLevelWizardMenuItem) self.headOffsetWizardMenuItem = expertMenu.Append(-1, _(u"head offset 마법사...")) self.Bind(wx.EVT_MENU, self.OnHeadOffsetWizard, self.headOffsetWizardMenuItem) self.menubar.Append(expertMenu, _(u"전문가(Expert)")) helpMenu = wx.Menu() i = helpMenu.Append(-1, _(u"온라인 문서...")) self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('http://daid.github.com/Cura'), i) i = helpMenu.Append(-1, _(u"오류 보고...")) self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i) i = helpMenu.Append(-1, _(u"업데이트 확인...")) self.Bind(wx.EVT_MENU, self.OnCheckForUpdate, i) i = helpMenu.Append(-1, _(u"YouMagine website 열기...")) self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://www.youmagine.com/'), i) i = helpMenu.Append(-1, _(u"소프트웨어 정보...")) self.Bind(wx.EVT_MENU, self.OnAbout, i) self.menubar.Append(helpMenu, _(u"도움말(Help)")) self.SetMenuBar(self.menubar) self.splitter = wx.SplitterWindow(self, style = wx.SP_3D | wx.SP_LIVE_UPDATE) self.leftPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.rightPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.splitter.Bind(wx.EVT_SPLITTER_DCLICK, lambda evt: evt.Veto()) ##Gui components## self.simpleSettingsPanel = simpleMode.simpleModePanel(self.leftPane, lambda : self.scene.sceneUpdated()) self.normalSettingsPanel = normalSettingsPanel(self.leftPane, lambda : self.scene.sceneUpdated()) self.leftSizer = wx.BoxSizer(wx.VERTICAL) self.leftSizer.Add(self.simpleSettingsPanel, 1) self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND) self.leftPane.SetSizer(self.leftSizer) #Preview window self.scene = sceneView.SceneView(self.rightPane) #Main sizer, to position the preview window, buttons and tab control sizer = wx.BoxSizer() self.rightPane.SetSizer(sizer) sizer.Add(self.scene, 1, flag=wx.EXPAND) # Main window sizer sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) sizer.Add(self.splitter, 1, wx.EXPAND) sizer.Layout() self.sizer = sizer self.updateProfileToAllControls() self.SetBackgroundColour(self.normalSettingsPanel.GetBackgroundColour()) self.simpleSettingsPanel.Show(False) self.normalSettingsPanel.Show(False) # Set default window size & position self.SetSize((wx.Display().GetClientArea().GetWidth()/2,wx.Display().GetClientArea().GetHeight()/2)) self.Centre() #Timer set; used to check if profile is on the clipboard self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.onTimer) self.timer.Start(1000) self.lastTriedClipboard = profile.getProfileString() # Restore the window position, size & state from the preferences file try: if profile.getPreference('window_maximized') == 'True': self.Maximize(True) else: posx = int(profile.getPreference('window_pos_x')) posy = int(profile.getPreference('window_pos_y')) width = int(profile.getPreference('window_width')) height = int(profile.getPreference('window_height')) if posx > 0 or posy > 0: self.SetPosition((posx,posy)) if width > 0 and height > 0: self.SetSize((width,height)) self.normalSashPos = int(profile.getPreference('window_normal_sash')) except: self.normalSashPos = 0 self.Maximize(True) if self.normalSashPos < self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5: self.normalSashPos = self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5 self.splitter.SplitVertically(self.leftPane, self.rightPane, self.normalSashPos) if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.Centre() if wx.Display.GetFromPoint((self.GetPositionTuple()[0] + self.GetSizeTuple()[1], self.GetPositionTuple()[1] + self.GetSizeTuple()[1])) < 0: self.Centre() if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.SetSize((800,600)) self.Centre() self.updateSliceMode() self.scene.SetFocus()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in this version:')) s.Add( wx.StaticText( p, -1, '* Fixed a problem which was introduced in 14.09.\n There are extreme amounts of head movements generated.' )) s.Add( wx.StaticText( p, -1, '* Speed up GCode generation for large models by as much as 40%' )) s.Add( wx.StaticText( p, -1, '* Fixed problems with placement of multiple objects on the build platform' )) s.Add( wx.StaticText( p, -1, '* Prevent installing firmware for Ultimaker Original+ on an Ultimaker Original' )) s.Add( wx.StaticText( p, -1, '* Fixed generating big GCode files (more then 200MB) on Windows' )) s.Add( wx.StaticText( p, -1, '* French translation updates (Thanks to Jeremie Francois)')) s.Add( wx.StaticText( p, -1, '* Fixed a problem where "everywhere" support did not work when german was used as language.' )) s.Add( wx.StaticText( p, -1, '* Changed the handling of the heated bed, now always heats\n the bed first instead of bed and nozzle at the same time.\n This to prevent the nozzle from leaking empty.' )) s.Add( wx.StaticText( p, -1, '* Fixed the "uninstall old Cura versions" option in the windows installer.' )) s.Add( wx.StaticText( p, -1, '* Improved the search for old installations, so old settings are copied over.' )) s.Add( wx.StaticText( p, -1, '* Fixed a bug where double clicking a file on windows did not load the file in Cura.' )) s.Add( wx.StaticText( p, -1, '* Made sure the firmware versions for Ultimaker printers always match the Cura release number.' )) s.Add( wx.StaticText( p, -1, '* Added a quick access button for expert settings of a certain setting.' )) s.Add( wx.StaticText( p, -1, '* Added some more raft settings to dial in the raft better.')) s.Add( wx.StaticText( p, -1, '* Fixed the tooltip of support material. Now it actually explains the angles properly.' )) s.Add( wx.StaticText( p, -1, '* Fixed a bug which caused the USB printing window to stop working (Thanks to SpaxGuy)' )) s.Add( wx.StaticText( p, -1, '* Fix a bug where Cura would stop generating GCode')) s.Add(wx.StaticText(p, -1, '* Added latest offerings of Printrbot')) self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2:')) s.Add( wx.StaticText( p, -1, '* Detect when the endstops are not working properly.\n Which prevents the bed from damaging the nozzle.' )) s.Add( wx.StaticText( p, -1, '* Added the ability to import/export material profiles to the SD card.' )) s.Add( wx.StaticText(p, -1, '* Improved hotend temperature stability.')) s.Add(wx.StaticText(p, -1, '* Added UPET material profile.')) s.Add( wx.StaticText( p, -1, '* Minor improvements to the time estimate code.')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP | wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def __init__(self): super(simpleModeWindow, self).__init__(title="Cura - Quickprint - " + version.getVersion()) wx.EVT_CLOSE(self, self.OnClose) # self.SetIcon(icon.getMainIcon()) self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.supportedExtensions())) menubar = wx.MenuBar() fileMenu = wx.Menu() i = fileMenu.Append(-1, "Load model file...\tCTRL+L") self.Bind(wx.EVT_MENU, self.OnLoadModel, i) i = fileMenu.Append(-1, "Prepare print...\tCTRL+R") self.Bind(wx.EVT_MENU, self.OnSlice, i) i = fileMenu.Append(-1, "Print...\tCTRL+P") self.Bind(wx.EVT_MENU, self.OnPrint, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, "Preferences...\tCTRL+,") self.Bind(wx.EVT_MENU, self.OnPreferences, i) fileMenu.AppendSeparator() i = fileMenu.Append(wx.ID_EXIT, "Quit") self.Bind(wx.EVT_MENU, self.OnQuit, i) menubar.Append(fileMenu, "&File") toolsMenu = wx.Menu() i = toolsMenu.Append(-1, "Switch to Normal mode...") self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) menubar.Append(toolsMenu, "Normal mode") helpMenu = wx.Menu() i = helpMenu.Append(-1, "Online documentation...") self.Bind(wx.EVT_MENU, lambda e: webbrowser.open("https://daid.github.com/Cura"), i) i = helpMenu.Append(-1, "Report a problem...") self.Bind(wx.EVT_MENU, lambda e: webbrowser.open("https://github.com/daid/Cura/issues"), i) menubar.Append(helpMenu, "Help") self.SetMenuBar(menubar) if profile.getPreference("lastFile") != "": self.filelist = profile.getPreference("lastFile").split(";") self.SetTitle("Cura - %s - %s" % (version.getVersion(), self.filelist[-1])) else: self.filelist = [] self.progressPanelList = [] # Preview window self.preview3d = preview3d.previewPanel(self) configPanel = wx.Panel(self) printTypePanel = wx.Panel(configPanel) self.printTypeNormal = wx.RadioButton(printTypePanel, -1, "Normal quality print", style=wx.RB_GROUP) self.printTypeLow = wx.RadioButton(printTypePanel, -1, "Fast low quality print") self.printTypeHigh = wx.RadioButton(printTypePanel, -1, "High quality print") self.printTypeJoris = wx.RadioButton(printTypePanel, -1, "Thin walled cup or vase") printMaterialPanel = wx.Panel(configPanel) 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")) self.printSupport = wx.CheckBox(configPanel, -1, "Print support structure") sizer = wx.GridBagSizer() configPanel.SetSizer(sizer) sb = wx.StaticBox(printTypePanel, label="Select a print type:") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printTypeNormal) boxsizer.Add(self.printTypeLow) boxsizer.Add(self.printTypeHigh) boxsizer.Add(self.printTypeJoris) printTypePanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printTypePanel.GetSizer().Add(boxsizer, flag=wx.EXPAND) sizer.Add(printTypePanel, (0, 0), flag=wx.EXPAND) sb = wx.StaticBox(printMaterialPanel, label="Material:") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printMaterialPLA) boxsizer.Add(self.printMaterialABS) boxsizer.Add(wx.StaticText(printMaterialPanel, -1, "Diameter:")) boxsizer.Add(self.printMaterialDiameter) printMaterialPanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printMaterialPanel.GetSizer().Add(boxsizer, flag=wx.EXPAND) sizer.Add(printMaterialPanel, (1, 0), flag=wx.EXPAND) sb = wx.StaticBox(configPanel, label="Other:") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printSupport) sizer.Add(boxsizer, (2, 0), flag=wx.EXPAND) # load and slice buttons. loadButton = wx.Button(self, -1, "&Load model") sliceButton = wx.Button(self, -1, "P&repare print") printButton = wx.Button(self, -1, "&Print") self.Bind(wx.EVT_BUTTON, self.OnLoadModel, loadButton) self.Bind(wx.EVT_BUTTON, self.OnSlice, sliceButton) self.Bind(wx.EVT_BUTTON, self.OnPrint, printButton) # Also bind double clicking the 3D preview to load an STL file. self.preview3d.glCanvas.Bind(wx.EVT_LEFT_DCLICK, self.OnLoadModel, self.preview3d.glCanvas) # Main sizer, to position the preview window, buttons and tab control sizer = wx.GridBagSizer() self.SetSizer(sizer) sizer.Add(configPanel, (0, 0), span=(1, 1), flag=wx.EXPAND) sizer.Add(self.preview3d, (0, 1), span=(1, 3), flag=wx.EXPAND) sizer.AddGrowableCol(2) sizer.AddGrowableRow(0) sizer.Add(loadButton, (1, 1), flag=wx.RIGHT | wx.BOTTOM | wx.TOP, border=5) sizer.Add(sliceButton, (1, 2), flag=wx.RIGHT | wx.BOTTOM | wx.TOP, border=5) sizer.Add(printButton, (1, 3), flag=wx.RIGHT | wx.BOTTOM | wx.TOP, border=5) self.sizer = sizer if len(self.filelist) > 0: self.preview3d.loadModelFiles(self.filelist) self.SetBackgroundColour(configPanel.GetBackgroundColour()) self.updateProfileToControls() self.printTypeNormal.SetValue(True) self.printMaterialPLA.SetValue(True) self.Fit() self.preview3d.Fit() self.SetMinSize(self.GetSize()) self.Centre() self.Show(True)
def main(): parser = OptionParser(usage="usage: %prog [options] <X,Y> <filename>[, <X,Y> <filename>][, ...]") parser.add_option("-p", "--profile", action="store", type="string", dest="profile", help="Encoded profile to use for the print") parser.add_option("-o", "--output", action="store", type="string", dest="output", help="Output filename") (options, args) = parser.parse_args() if options.output is None: print 'Missing output filename' sys.exit(1) if options.profile is not None: profile.loadGlobalProfileFromString(options.profile) options.output = fixUTF8(options.output) clearZ = 0 resultFile = open(options.output, "w") for idx in xrange(0, len(args), 2): position = map(float, args[idx].split(',')) if len(position) < 9 + 2: position = position[0:2] position += [1,0,0] position += [0,1,0] position += [0,0,1] filenames = fixUTF8(args[idx + 1]).split('|') profile.setTempOverride('object_center_x', position[0]) profile.setTempOverride('object_center_y', position[1]) if idx == 0: resultFile.write(';TYPE:CUSTOM\n') resultFile.write(profile.getAlterationFileContents('start.gcode', len(filenames)).replace('?filename?', ' '.join(filenames).encode('ascii', 'replace'))) else: resultFile.write(';TYPE:CUSTOM\n') n = output[-1].rfind('Z')+1 zString = output[-1][n:n+20] zString = zString[0:zString.find(' ')] clearZ = max(clearZ, float(zString) + 10) profile.setTempOverride('clear_z', clearZ) print position print profile.getAlterationFileContents('nextobject.gcode') resultFile.write(profile.getAlterationFileContents('nextobject.gcode').replace('?filename?', ' '.join(filenames).encode('ascii', 'replace'))) output = [] for filename in filenames: extruderNr = filenames.index(filename) profile.resetTempOverride() if extruderNr > 0: profile.setTempOverride('object_center_x', position[0] - profile.getPreferenceFloat('extruder_offset_x%d' % (extruderNr))) profile.setTempOverride('object_center_y', position[1] - profile.getPreferenceFloat('extruder_offset_y%d' % (extruderNr))) profile.setTempOverride('fan_enabled', 'False') profile.setTempOverride('skirt_line_count', '0') profile.setTempOverride('alternative_center', filenames[0]) else: profile.setTempOverride('object_center_x', position[0]) profile.setTempOverride('object_center_y', position[1]) profile.setTempOverride('object_matrix', ','.join(map(str, position[2:11]))) if extruderNr > 0: if profile.getProfileSettingFloat('filament_diameter%d' % (extruderNr + 1)) > 0: profile.setTempOverride('filament_diameter', profile.getProfileSetting('filament_diameter%d' % (extruderNr + 1))) print extruderNr, profile.getPreferenceFloat('extruder_offset_x%d' % (extruderNr)), profile.getPreferenceFloat('extruder_offset_y%d' % (extruderNr)) output.append(export.getOutput(filename)) profile.resetTempOverride() if len(output) == 1: resultFile.write(output[0]) else: stitchMultiExtruder(output, resultFile) resultFile.write(';TYPE:CUSTOM\n') resultFile.write(profile.getAlterationFileContents('end.gcode')) resultFile.close() print "Running plugins" ret = profile.runPostProcessingPlugins(options.output) if ret is not None: print ret print "Finalizing %s" % (os.path.basename(options.output)) if profile.getPreference('submit_slice_information') == 'True': filenames = fixUTF8(args[idx + 1]).split('|') for filename in filenames: m = hashlib.sha512() f = open(filename, "rb") while True: chunk = f.read(1024) if not chunk: break m.update(chunk) f.close() data = { 'processor': platform.processor(), 'machine': platform.machine(), 'platform': platform.platform(), 'profile': profile.getGlobalProfileString(), 'preferences': profile.getGlobalPreferencesString(), 'modelhash': m.hexdigest(), 'version': version.getVersion(), } try: f = urllib2.urlopen("http://platform.ultimaker.com/curastats/", data = urllib.urlencode(data), timeout = 5); f.read() f.close() except: pass
def __init__(self, parent): super(aboutWindow, self).__init__(parent, title=_("About"), style=wx.DEFAULT_DIALOG_STYLE) wx.EVT_CLOSE(self, self.OnClose) p2 = wx.lib.scrolledpanel.ScrolledPanel(self, -1, size=(600, 500), style=wx.SIMPLE_BORDER) p2.SetBackgroundColour('#FFFFFF') s2 = wx.BoxSizer(wx.VERTICAL) p2.SetSizer(s2) p2.SetupScrolling() self.scrolledpanel = p2 p = wx.Panel(self) self.panel = p s = wx.BoxSizer(wx.VERTICAL) self.SetSizer(s) s.Add(self.panel, flag=wx.ALL, border=15) s.Add(self.scrolledpanel, flag=wx.EXPAND | wx.ALL, border=5) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura LulzBot Edition') title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) version_num = version.getVersion() s.Add(wx.StaticText(p, -1, 'Version {}'.format(version_num))) s.Add(wx.StaticText(p, -1, 'Release notes:')) url = "code.alephobjects.com/w/cura/release-notes/" s.Add(wx.HyperlinkCtrl(p, -1, url, url)) s.Add(wx.StaticText(p, -1, 'Source Code:')) url2 = "code.alephobjects.com/diffusion/CURA/" s.Add(wx.HyperlinkCtrl(p, -1, url2, url2)) s.Add(wx.StaticText(p, -1, '')) s.Add(wx.StaticText( p, -1, 'End solution for Open Source Fused Filament Fabrication 3D printing.' ), flag=wx.TOP, border=5) s.Add(wx.StaticText( p, -1, 'Cura is currently developed and maintained by David Braam and Ultimaker.' ), flag=wx.TOP, border=5) s.Add( wx.StaticText( p, -1, 'Cura LulzBot Edition has been modified and maintained by Aleph Objects, Inc.' )) s.Add(wx.StaticText(p, -1, 'for use with LulzBot 3D printers.')) s2.Add(wx.StaticText(p2, -1, 'Cura is built with the following components:'), flag=wx.TOP, border=10) self.addComponent('Cura', 'Graphical user interface', 'AGPLv3', 'https://github.com/daid/Cura') self.addComponent('CuraEngine', 'GCode Generator', 'AGPLv3', 'https://github.com/Ultimaker/CuraEngine') self.addComponent('Clipper', 'Polygon clipping library', 'Boost', 'http://www.angusj.com/delphi/clipper.php') self.addComponent('Python 2.7', 'Framework', 'Python', 'http://python.org/') self.addComponent('wxPython', 'GUI Framework', 'wxWindows', 'http://www.wxpython.org/') self.addComponent('PyOpenGL', '3D Rendering Framework', 'BSD', 'http://pyopengl.sourceforge.net/') self.addComponent('PySerial', 'Serial communication library', 'Python license', 'http://pyserial.sourceforge.net/') self.addComponent('NumPy', 'Support library for faster math', 'BSD', 'http://www.numpy.org/') if platform.system() == "Windows": self.addComponent('VideoCapture', 'Library for WebCam capture on windows', 'LGPLv2.1', 'http://videocapture.sourceforge.net/') #self.addComponent('ffmpeg', 'Support for making timelaps video files', 'GPL', 'http://www.ffmpeg.org/') self.addComponent( 'comtypes', 'Library to help with windows taskbar features on Windows 7', 'MIT', 'http://starship.python.net/crew/theller/comtypes/') self.addComponent('EjectMedia', 'Utility to safe-remove SD cards', 'Freeware', 'http://www.uwe-sieber.de/english.html') self.addComponent('Pymclevel', 'Python library for reading Minecraft levels.', 'ISC', 'https://github.com/mcedit/pymclevel') s2.Add(wx.StaticText(p2, -1, "")) s2.Add(wx.StaticText(p2, -1, "Cura utilizes graphics from:")) self.addComponent( '3d-printer', 'by Toke Frello', 'CC BY 3.0 US', 'https://thenounproject.com/term/3d-printer/170216/') self.addComponent('Check Mark', 'by Stefan Parnarov', 'CC BY 3.0', 'https://thenounproject.com/term/check-mark/63794/') s2.Add(wx.StaticText( p2, -1, "Copyright (C) 2014 Aleph Objects, Inc. - Released under terms of the AGPLv3 License" ), flag=wx.TOP, border=10) s2.Add( wx.StaticText( p2, -1, "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License" )) #Translations done by: #Dutch: Charlotte Jansen #German: Gregor Luetolf, Lars Potter #Polish: Piotr Paczynski #French: Jeremie Francois #Spanish: Jose Gemez self.Fit()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura-BCN3D ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in this version:')) s.Add( wx.StaticText(p, -1, '* Added settings for BCN3D Technologies printers')) s.Add( wx.StaticText( p, -1, '* Changed some parts of the interface to give a better user experience' )) s.Add( wx.StaticText( p, -1, '* BCN3D Sigma is automatically set to double extrusion')) self.hasBCN3DSigma = None self.hasBCN3DPlus = None self.hasBCN3DR = None self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'BCN3DSigma': self.hasBCN3DSigma = n if profile.getMachineSetting('machine_type', n) == 'BCN3DPlus': self.hasBCN3DPlus = n if profile.getMachineSetting('machine_type', n) == 'BCN3DR': self.hasBCN3DR = n if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasBCN3DSigma is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your BCN3D Sigma:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnBCN3DSigmaFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasBCN3DPlus is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your BCN3D Plus:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnBCN3DPlusFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasBCN3DR is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your BCN3D R:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnBCN3DRFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2: ')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP | wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def afterSplashCallback(self): #These imports take most of the time and thus should be done after showing the splashscreen import webbrowser from Cura.gui import mainWindow from Cura.gui import configWizard from Cura.gui import newVersionDialog from Cura.util import profile from Cura.util import resources from Cura.util import version resources.setupLocalization(profile.getPreference('language')) # it's important to set up localization at very beginning to install _ #If we do not have preferences yet, try to load it from a previous Cura install if profile.getMachineSetting('machine_type') == 'unknown': try: otherCuraInstalls = profile.getAlternativeBasePaths() for path in otherCuraInstalls[::-1]: try: print 'Loading old settings from %s' % (path) profile.loadPreferences(os.path.join(path, 'preferences.ini')) profile.loadProfile(os.path.join(path, 'current_profile.ini')) break except: import traceback print traceback.print_exc() except: import traceback print traceback.print_exc() #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown': #Check if we need to copy our examples exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'BCN3DDraudi_support.stl')) self.loadFiles = [exampleFile] if self.splash is not None: self.splash.Show(False) self.splash = None configWizard.ConfigWizard() #if profile.getPreference('check_for_updates') == 'True': # if self.haveInternet() == True: # newVersion = version.checkForNewVersion() # if newVersion is not None: # if self.splash is not None: # self.splash.Show(False) # if wx.MessageBox(_("A new version of Cura-BCN3D is available, would you like to download?"), _("New version available"), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES: # webbrowser.open(newVersion) # return if profile.getMachineSetting('machine_name') == '': return self.mainWindow = mainWindow.mainWindow() if self.splash is not None: self.splash.Show(False) self.splash = None self.SetTopWindow(self.mainWindow) self.mainWindow.Show() self.mainWindow.OnDropFiles(self.loadFiles) self.new_version_dialog = None if profile.getPreference('last_run_version') != version.getVersion(False): profile.putPreference('last_run_version', version.getVersion(False)) self.new_version_dialog = newVersionDialog.newVersionDialog().Show() setFullScreenCapable(self.mainWindow) if sys.platform.startswith('darwin'): wx.CallAfter(self.StupidMacOSWorkaround)
def __init__(self, parent): super(aboutWindow, self).__init__(parent, title=_("About"), style = wx.DEFAULT_DIALOG_STYLE) wx.EVT_CLOSE(self, self.OnClose) p2 = wx.lib.scrolledpanel.ScrolledPanel(self,-1, size=(600, 500), style=wx.SIMPLE_BORDER) p2.SetBackgroundColour('#FFFFFF') s2 = wx.BoxSizer(wx.VERTICAL) p2.SetSizer(s2) p2.SetupScrolling() self.scrolledpanel = p2 p = wx.Panel(self) self.panel = p s = wx.BoxSizer(wx.VERTICAL) self.SetSizer(s) s.Add(self.panel, flag=wx.ALL, border=15) s.Add(self.scrolledpanel, flag=wx.EXPAND|wx.ALL, border=5) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura LulzBot Edition') title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) version_num = version.getVersion() s.Add(wx.StaticText(p, -1, 'Version {}'.format(version_num))) s.Add(wx.StaticText(p, -1, 'Release notes:')) url = "code.alephobjects.com/w/cura/release-notes/" s.Add(wx.HyperlinkCtrl(p, -1, url, url)) s.Add(wx.StaticText(p, -1, 'Source Code:')) url2 = "code.alephobjects.com/diffusion/CURA/" s.Add(wx.HyperlinkCtrl(p, -1, url2, url2)) s.Add(wx.StaticText(p, -1, '')) s.Add(wx.StaticText(p, -1, 'End solution for Open Source Fused Filament Fabrication 3D printing.'), flag=wx.TOP, border=5) s.Add(wx.StaticText(p, -1, 'Cura is currently developed and maintained by David Braam and Ultimaker.'), flag=wx.TOP, border=5) s.Add(wx.StaticText(p, -1, 'Cura LulzBot Edition has been modified and maintained by Aleph Objects, Inc.')) s.Add(wx.StaticText(p, -1, 'for use with LulzBot 3D printers.')) s2.Add(wx.StaticText(p2, -1, 'Cura is built with the following components:'), flag=wx.TOP, border=10) self.addComponent('Cura', 'Graphical user interface', 'AGPLv3', 'https://github.com/daid/Cura') self.addComponent('CuraEngine', 'GCode Generator', 'AGPLv3', 'https://github.com/Ultimaker/CuraEngine') self.addComponent('Clipper', 'Polygon clipping library', 'Boost', 'http://www.angusj.com/delphi/clipper.php') self.addComponent('Python 2.7', 'Framework', 'Python', 'http://python.org/') self.addComponent('wxPython', 'GUI Framework', 'wxWindows', 'http://www.wxpython.org/') self.addComponent('PyOpenGL', '3D Rendering Framework', 'BSD', 'http://pyopengl.sourceforge.net/') self.addComponent('PySerial', 'Serial communication library', 'Python license', 'http://pyserial.sourceforge.net/') self.addComponent('NumPy', 'Support library for faster math', 'BSD', 'http://www.numpy.org/') if platform.system() == "Windows": self.addComponent('VideoCapture', 'Library for WebCam capture on windows', 'LGPLv2.1', 'http://videocapture.sourceforge.net/') #self.addComponent('ffmpeg', 'Support for making timelaps video files', 'GPL', 'http://www.ffmpeg.org/') self.addComponent('comtypes', 'Library to help with windows taskbar features on Windows 7', 'MIT', 'http://starship.python.net/crew/theller/comtypes/') self.addComponent('EjectMedia', 'Utility to safe-remove SD cards', 'Freeware', 'http://www.uwe-sieber.de/english.html') self.addComponent('Pymclevel', 'Python library for reading Minecraft levels.', 'ISC', 'https://github.com/mcedit/pymclevel') s2.Add(wx.StaticText(p2, -1, "")) s2.Add(wx.StaticText(p2, -1, "Cura utilizes graphics from:")) self.addComponent('3d-printer', 'by Toke Frello', 'CC BY 3.0 US', 'https://thenounproject.com/term/3d-printer/170216/') self.addComponent('Check Mark', 'by Stefan Parnarov', 'CC BY 3.0', 'https://thenounproject.com/term/check-mark/63794/') s2.Add(wx.StaticText(p2, -1, "Copyright (C) 2014 Aleph Objects, Inc. - Released under terms of the AGPLv3 License"), flag=wx.TOP, border=10) s2.Add(wx.StaticText(p2, -1, "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License")) #Translations done by: #Dutch: Charlotte Jansen #German: Gregor Luetolf, Lars Potter #Polish: Piotr Paczynski #French: Jeremie Francois #Spanish: Jose Gemez self.Fit()
def __init__(self): super(mainWindow, self).__init__(None, title='Cura-BCN3D-' + version.getVersion() + '-beta2') wx.EVT_CLOSE(self, self.OnClose) # allow dropping any file, restrict later self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles)) # TODO: wxWidgets 2.9.4 has a bug when NSView does not register for dragged types when wx drop target is set. It was fixed in 2.9.5 if sys.platform.startswith('darwin'): try: import objc nswindow = objc.objc_object( c_void_p=self.MacGetTopLevelWindowRef()) view = nswindow.contentView() view.registerForDraggedTypes_([u'NSFilenamesPboardType']) except: pass self.normalModeOnlyItems = [] mruFile = os.path.join(profile.getBasePath(), 'mru_filelist.ini') self.config = wx.FileConfig(appName="Cura", localFilename=mruFile, style=wx.CONFIG_USE_LOCAL_FILE) self.ID_MRU_MODEL1, self.ID_MRU_MODEL2, self.ID_MRU_MODEL3, self.ID_MRU_MODEL4, self.ID_MRU_MODEL5, self.ID_MRU_MODEL6, self.ID_MRU_MODEL7, self.ID_MRU_MODEL8, self.ID_MRU_MODEL9, self.ID_MRU_MODEL10 = [ wx.NewId() for line in xrange(10) ] self.modelFileHistory = wx.FileHistory(10, self.ID_MRU_MODEL1) self.config.SetPath("/ModelMRU") self.modelFileHistory.Load(self.config) self.ID_MRU_PROFILE1, self.ID_MRU_PROFILE2, self.ID_MRU_PROFILE3, self.ID_MRU_PROFILE4, self.ID_MRU_PROFILE5, self.ID_MRU_PROFILE6, self.ID_MRU_PROFILE7, self.ID_MRU_PROFILE8, self.ID_MRU_PROFILE9, self.ID_MRU_PROFILE10 = [ wx.NewId() for line in xrange(10) ] self.profileFileHistory = wx.FileHistory(10, self.ID_MRU_PROFILE1) self.config.SetPath("/ProfileMRU") self.profileFileHistory.Load(self.config) #Now we create the different menu options, the first one is the options displayed by the 'File' button self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() i = self.fileMenu.Append(-1, _("Load model file...\tCTRL+L")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showLoadModel(), i) i = self.fileMenu.Append(-1, _("Load Draudi file...\tCTRL+D")) self.Bind(wx.EVT_MENU, self.OnLoadDraudiModel, i) i = self.fileMenu.Append(-1, _("Save model...\tCTRL+S")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveModel(), i) i = self.fileMenu.Append(-1, _("Reload platform\tF5")) self.Bind(wx.EVT_MENU, lambda e: self.scene.reloadScene(e), i) i = self.fileMenu.Append(-1, _("Clear platform\tCTRL+Q")) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnDeleteAll(e), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Print...\tCTRL+P")) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnPrintButton(1), i) i = self.fileMenu.Append(-1, _("Save GCode...\tCTRL+G")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveGCode(), i) i = self.fileMenu.Append(-1, _("Show slice engine log...")) self.Bind(wx.EVT_MENU, lambda e: self.scene._showEngineLog(), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Open Profile...\tCTRL+C")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnLoadConfigurations(), i) i = self.fileMenu.Append(-1, _("Save Profile...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) if version.isDevVersion(): i = self.fileMenu.Append(-1, "Save difference from default...") self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnSaveDifferences, i) i = self.fileMenu.Append(-1, _("Load Profile from GCode...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Preferences...\tCTRL+,")) self.Bind(wx.EVT_MENU, self.OnPreferences, i) i = self.fileMenu.Append(-1, _("Machine settings...")) self.Bind(wx.EVT_MENU, self.OnMachineSettings, i) self.fileMenu.AppendSeparator() # Model MRU list modelHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), '&' + _("Recent Model Files"), modelHistoryMenu) self.modelFileHistory.UseMenu(modelHistoryMenu) self.modelFileHistory.AddFilesToMenu() self.Bind(wx.EVT_MENU_RANGE, self.OnModelMRU, id=self.ID_MRU_MODEL1, id2=self.ID_MRU_MODEL10) # Profle MRU list profileHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), _("Recent Profile Files"), profileHistoryMenu) 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")) self.Bind(wx.EVT_MENU, self.OnQuit, i) #Here we set the name of the menubar, which in this case is 'File' self.menubar.Append(self.fileMenu, '&' + _("File")) #The next menu option is 'Tools' toolsMenu = wx.Menu() #At BCN3D we do not recommend printing one at a time and we have set a message to come up #in case a user does choose that option. 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) #We name this menu option self.menubar.Append(toolsMenu, _("Tools")) #Machine menu for machine configuration/tooling self.machineMenu = wx.Menu() self.updateMachineMenu() self.menubar.Append(self.machineMenu, _("Machine")) #we switch between panels expertMenu = wx.Menu() i = expertMenu.Append(-1, _("Switch to quickprint..."), kind=wx.ITEM_RADIO) self.switchToQuickprintMenuItem = i self.Bind(wx.EVT_MENU, self.OnSimpleSwitch, i) i = expertMenu.Append(-1, _("Switch to full settings..."), kind=wx.ITEM_RADIO) self.switchToNormalMenuItem = i self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) expertMenu.AppendSeparator() #Open a series of settings that you are not normally able to see i = expertMenu.Append(-1, _("Open expert settings...\tCTRL+E")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) expertMenu.AppendSeparator() self.bedLevelWizardMenuItem = expertMenu.Append( -1, _("Run bed leveling wizard...")) self.Bind(wx.EVT_MENU, self.OnBedLevelWizard, self.bedLevelWizardMenuItem) self.headOffsetWizardMenuItem = expertMenu.Append( -1, _("Run head offset wizard...")) self.Bind(wx.EVT_MENU, self.OnHeadOffsetWizard, self.headOffsetWizardMenuItem) #give the menu bar a name, in this case 'Expert' self.menubar.Append(expertMenu, _("Expert")) helpMenu = wx.Menu() i = helpMenu.Append(-1, _("Online documentation...")) self.Bind( wx.EVT_MENU, lambda e: webbrowser.open( 'http://www.bcn3dtechnologies.com/es/forum'), i) if sys.platform.startswith('win'): i = helpMenu.Append(-1, _("Report a problem...")) self.Bind( wx.EVT_MENU, lambda e: webbrowser.open( 'https://github.com/BCN3D/BCN3D-Cura-Windows/issues'), i) elif sys.platform.startswith('darwin'): i = helpMenu.Append(-1, _("Report a problem...")) self.Bind( wx.EVT_MENU, lambda e: webbrowser.open( 'https://github.com/BCN3D/BCN3D-Cura-Mac/issues'), i) i = helpMenu.Append(-1, _("Check for update...")) self.Bind(wx.EVT_MENU, self.OnCheckForUpdate, i) i = helpMenu.Append(-1, _("About Cura...")) self.Bind(wx.EVT_MENU, self.OnAbout, i) self.menubar.Append(helpMenu, _("Help")) self.SetMenuBar(self.menubar) self.splitter = wx.SplitterWindow(self, style=wx.SP_3D | wx.SP_LIVE_UPDATE) self.leftPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.rightPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.splitter.Bind(wx.EVT_SPLITTER_DCLICK, lambda evt: evt.Veto()) #Preview window self.scene = sceneView.SceneView(self.rightPane) ##Gui components## #We want two different simple modes, one for BCN3D users and the default cura one for other machines #Currently working on this, will be available soon #machine_type = profile.getMachineSetting('machine_type') #if machine_type == 'BCN3DSigma': # self.simpleSettingsPanel = simpleModeSigma(self.leftPane, self.scene.sceneUpdated) #else: #call to the different panels self.simpleSettingsPanel = simpleMode.simpleModePanel( self.leftPane, self.scene.sceneUpdated) self.normalSettingsPanel = normalSettingsPanel(self.leftPane, self.scene.sceneUpdated) #Simple panel will be fix while you can change the size for advanced panel self.leftSizer = wx.BoxSizer(wx.VERTICAL) self.leftSizer.Add(self.simpleSettingsPanel, 1) self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND) self.leftPane.SetSizer(self.leftSizer) #Main sizer, to position the preview window, buttons and tab control sizer = wx.BoxSizer() self.rightPane.SetSizer(sizer) sizer.Add(self.scene, 1, flag=wx.EXPAND) # Main window sizer sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) sizer.Add(self.splitter, 1, wx.EXPAND) sizer.Layout() self.sizer = sizer self.updateProfileToAllControls() self.SetBackgroundColour( self.normalSettingsPanel.GetBackgroundColour()) self.simpleSettingsPanel.Show(False) self.normalSettingsPanel.Show(False) # Set default window size & position self.SetSize((wx.Display().GetClientArea().GetWidth() / 2, wx.Display().GetClientArea().GetHeight() / 2)) self.Centre() #Timer set; used to check if profile is on the clipboard self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.onTimer) #self.timer.Start(1000) self.lastTriedClipboard = profile.getProfileString() # Restore the window position, size & state from the preferences file try: if profile.getPreference('window_maximized') == 'True': self.Maximize(True) else: posx = int(profile.getPreference('window_pos_x')) posy = int(profile.getPreference('window_pos_y')) width = int(profile.getPreference('window_width')) height = int(profile.getPreference('window_height')) if posx > 0 or posy > 0: self.SetPosition((posx, posy)) if width > 0 and height > 0: self.SetSize((width, height)) self.normalSashPos = int( profile.getPreference('window_normal_sash')) except: self.normalSashPos = 0 self.Maximize(True) if self.normalSashPos < self.normalSettingsPanel.printPanel.GetBestSize( )[0] + 5: self.normalSashPos = self.normalSettingsPanel.printPanel.GetBestSize( )[0] + 5 self.splitter.SplitVertically(self.leftPane, self.rightPane, self.normalSashPos) if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.Centre() if wx.Display.GetFromPoint( (self.GetPositionTuple()[0] + self.GetSizeTuple()[1], self.GetPositionTuple()[1] + self.GetSizeTuple()[1])) < 0: self.Centre() if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.SetSize((800, 600)) self.Centre() self.updateSliceMode() self.scene.SetFocus() self.dialogframe = None if Publisher is not None: Publisher().subscribe(self.onPluginUpdate, "pluginupdate") pluginCount = self.normalSettingsPanel.pluginPanel.GetActivePluginCount( ) if pluginCount == 1: self.scene.notification.message( "Warning: 1 plugin from the previous session is still active.") if pluginCount > 1: self.scene.notification.message( "Warning: %i plugins from the previous session are still active." % pluginCount)
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in this version:')) s.Add( wx.StaticText( p, -1, _('* Added feature to configure the first layer to use wider print lines, for better adhesion to the printer bed.' ))) s.Add( wx.StaticText(p, -1, _('* Added all Printrbot printer variations.'))) s.Add(wx.StaticText(p, -1, 'New in version 14.06.1:')) s.Add(wx.StaticText(p, -1, _('* Updated drivers for Windows 8.1.'))) s.Add( wx.StaticText( p, -1, _('* Added better raft support with surface layers and an air-gap. Special thanks to Gregoire Passault.' ))) s.Add( wx.StaticText( p, -1, _('* Improved outer surface quality on high detail prints.'))) s.Add( wx.StaticText( p, -1, _('* Fixed bug with multiple machines and different start/end GCode.' ))) s.Add( wx.StaticText( p, -1, _('* Added initial support for BitsFromBytes machines.'))) s.Add( wx.StaticText( p, -1, _('* Improved the Pronterface UI with buttons to set temperature and extrusion buttons.' ))) s.Add(wx.StaticText(p, -1, _('* Improved bridging detection.'))) self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText( p, -1, _('New firmware for your Ultimaker2: (14.07.0)'))) s.Add( wx.StaticText( p, -1, _('* Added feature in the maintenance menu to just load filament' ))) s.Add( wx.StaticText( p, -1, _('* Fixed grinding problem at the start of a print'))) s.Add( wx.StaticText( p, -1, _('* Fixed properly retracting when a print is finished'))) s.Add(wx.StaticText(p, -1, _('Firmware update: (14.06.2)'))) s.Add( wx.StaticText( p, -1, _('* Fixed a problem with the bed leveling. (Special thanks to stevegt for figuring this out)' ))) s.Add( wx.StaticText( p, -1, _('* Improved the start of the print, first moves the bed up before moving to the print.' ))) s.Add( wx.StaticText( p, -1, _('* Improved the start of the print, initial filament push is slower so it does not slip.' ))) s.Add( wx.StaticText( p, -1, _('* Made sure the head does not bump into the front of the casing at first startup.' ))) s.Add( wx.StaticText(p, -1, _('* Fixed support for the PauseAtZ plugin.'))) s.Add( wx.StaticText( p, -1, _('* Added lifetime runtime stats. Allows you to see how long the printer has been running.' ))) button = wx.Button(p, -1, _('Install now')) self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP | wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in this version:')) s.Add(wx.StaticText(p, -1, '* Fixed saving to SD card on MacOS and linux')) s.Add(wx.StaticText(p, -1, '* Fixed Cura not starting up for some Windows users')) s.Add(wx.StaticText(p, -1, '* Fixed UM2 problem where material was not retracted at the end of the print')) s.Add(wx.StaticText(p, -1, '* Fixed UM2 problem where material was not pushed forward after changing material during a pause')) s.Add(wx.StaticText(p, -1, 'New in 15.01:')) s.Add(wx.StaticText(p, -1, '* Improved handling of large 3D models')) s.Add(wx.StaticText(p, -1, '* Added top/bottom speed setting')) s.Add(wx.StaticText(p, -1, '* Improved quickprint profiles (thanks to Paul Candler)')) s.Add(wx.StaticText(p, -1, '* Added single layer view (thanks to pmsimard)')) s.Add(wx.StaticText(p, -1, '* Added option to replicate local folder structure to SD card (thanks to pmsimard')) s.Add(wx.StaticText(p, -1, '* Added UM2go support')) s.Add(wx.StaticText(p, -1, '* Added UM2extended support')) s.Add(wx.StaticText(p, -1, '* Improved UM2 platform rendering, to show where the actual bed clips are located')) s.Add(wx.StaticText(p, -1, '* Fixed problems with PauseAtHeight plugin (thanks to pmsimard)')) s.Add(wx.StaticText(p, -1, '* Finally fixed the filament and print time tags in the gcode')) s.Add(wx.StaticText(p, -1, '* Fixed plugins with UltiGCode')) s.Add(wx.StaticText(p, -1, '* New TweakAtZ 4.0 from Dim3nsioneer')) s.Add(wx.StaticText(p, -1, '* Improved support for Mach3 and LinuxCNC based printers')) s.Add(wx.StaticText(p, -1, '* Added flow in cubic mm on each of the speed settings tooltips')) self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2:')) s.Add(wx.StaticText(p, -1, '* Added option to change filament when pausing during a print.')) s.Add(wx.StaticText(p, -1, '* Prevent temperature display jitter (thanks to TinkerGnome)')) s.Add(wx.StaticText(p, -1, '* Fixed problems with filenames containing an umlaut.')) s.Add(wx.StaticText(p, -1, '* Improved pause handling (thanks to ThinkerGnome)')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP|wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def afterSplashCallback(self): #These imports take most of the time and thus should be done after showing the splashscreen import webbrowser from Cura.gui import mainWindow from Cura.gui import configWizard from Cura.gui import newVersionDialog from Cura.util import profile from Cura.util import resources from Cura.util import version resources.setupLocalization(profile.getPreference('language')) # it's important to set up localization at very beginning to install _ """ #If we do not have preferences yet, try to load it from a previous Cura install if profile.getMachineSetting('machine_type') == 'unknown': try: otherCuraInstalls = profile.getAlternativeBasePaths() for path in otherCuraInstalls[::-1]: try: print 'Loading old settings from %s' % (path) profile.loadPreferences(os.path.join(path, 'preferences.ini')) profile.loadProfile(os.path.join(path, 'current_profile.ini')) break except: import traceback print traceback.print_exc() except: import traceback print traceback.print_exc() """ #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown' or profile.getPreference('configured') == 'False': configWizard.ConfigWizard(False) #Check if we need to copy our examples exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'FirstPrintCone.stl')) self.loadFiles = [exampleFile] if profile.getPreference('configured') == 'True': # if self.splash is not None: # self.splash.Show(False) if self.splash is not None: try: self.splash.Show(False) except Exception as e: print e # if self.splash is not None: # print "Splash is none" # try: # from Cura.gui import splashScreen # # self.splash() # self.splash = splashScreen.splashScreen(self.afterSplashCallback) # self.splash(self.afterSplashCallback) # self.splash.Show(False) # except Exception as e: # print e # try: # from Cura.gui import splashScreen # self.splash = splashScreen.splashScreen(self.afterSplashCallback) # self.splash.Show(False) # except Exception as e: # print e try: self.mainWindow = mainWindow.mainWindow() except Exception as e: print e # if self.splash is not None: # self.splash.Show(False) # "print line 179 in app.py" self.SetTopWindow(self.mainWindow) self.mainWindow.Show() self.mainWindow.OnDropFiles(self.loadFiles) if profile.getPreference('last_run_version') != version.getVersion(False): profile.putPreference('last_run_version', version.getVersion(False)) newVersion = newVersionDialog.newVersionDialog() newVersion.Show() if newVersion.ShowModal() == wx.ID_OK: print 'closed' newVersion.Destroy() setFullScreenCapable(self.mainWindow) if sys.platform.startswith('darwin'): wx.CallAfter(self.StupidMacOSWorkaround) # Version check if profile.getPreference('check_for_updates') == 'True': self.newVersionCheck()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Vanilla - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Vanilla.')) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in this version:')) s.Add(wx.StaticText(p, -1, '* Adaptation of Cura.\n ')) self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2:')) s.Add( wx.StaticText( p, -1, '* Detect when the endstops are not working properly.\n Which prevents the bed from damaging the nozzle.' )) s.Add( wx.StaticText( p, -1, '* Added the ability to import/export material profiles to the SD card.' )) s.Add( wx.StaticText(p, -1, '* Improved hotend temperature stability.')) s.Add(wx.StaticText(p, -1, '* Added UPET material profile.')) s.Add( wx.StaticText( p, -1, '* Minor improvements to the time estimate code.')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP | wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def __init__(self): super(mainWindow, self).__init__(None, title='Cura - ' + version.getVersion()) wx.EVT_CLOSE(self, self.OnClose) # allow dropping any file, restrict later self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles)) # TODO: wxWidgets 2.9.4 has a bug when NSView does not register for dragged types when wx drop target is set. It was fixed in 2.9.5 if sys.platform.startswith('darwin'): try: import objc nswindow = objc.objc_object( c_void_p=self.MacGetTopLevelWindowRef()) view = nswindow.contentView() view.registerForDraggedTypes_([u'NSFilenamesPboardType']) except: pass self.normalModeOnlyItems = [] mruFile = os.path.join(profile.getBasePath(), 'mru_filelist.ini') self.config = wx.FileConfig(appName="Cura", localFilename=mruFile, style=wx.CONFIG_USE_LOCAL_FILE) self.ID_MRU_MODEL1, self.ID_MRU_MODEL2, self.ID_MRU_MODEL3, self.ID_MRU_MODEL4, self.ID_MRU_MODEL5, self.ID_MRU_MODEL6, self.ID_MRU_MODEL7, self.ID_MRU_MODEL8, self.ID_MRU_MODEL9, self.ID_MRU_MODEL10 = [ wx.NewId() for line in xrange(10) ] self.modelFileHistory = wx.FileHistory(10, self.ID_MRU_MODEL1) self.config.SetPath("/ModelMRU") self.modelFileHistory.Load(self.config) self.ID_MRU_PROFILE1, self.ID_MRU_PROFILE2, self.ID_MRU_PROFILE3, self.ID_MRU_PROFILE4, self.ID_MRU_PROFILE5, self.ID_MRU_PROFILE6, self.ID_MRU_PROFILE7, self.ID_MRU_PROFILE8, self.ID_MRU_PROFILE9, self.ID_MRU_PROFILE10 = [ wx.NewId() for line in xrange(10) ] self.profileFileHistory = wx.FileHistory(10, self.ID_MRU_PROFILE1) self.config.SetPath("/ProfileMRU") self.profileFileHistory.Load(self.config) self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() i = self.fileMenu.Append(-1, _("Load model file...\tCTRL+L")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showLoadModel(), i) i = self.fileMenu.Append(-1, _("Save model...\tCTRL+S")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveModel(), i) i = self.fileMenu.Append(-1, _("Reload platform\tF5")) self.Bind(wx.EVT_MENU, lambda e: self.scene.reloadScene(e), i) i = self.fileMenu.Append(-1, _("Clear platform")) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnDeleteAll(e), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Print...\tCTRL+P")) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnPrintButton(1), i) i = self.fileMenu.Append(-1, _("Save GCode...")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveGCode(), i) i = self.fileMenu.Append(-1, _("Show slice engine log...")) self.Bind(wx.EVT_MENU, lambda e: self.scene._showEngineLog(), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Open Profile...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) i = self.fileMenu.Append(-1, _("Save Profile...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) i = self.fileMenu.Append(-1, _("Load Profile from GCode...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Reset Profile to default")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnResetProfile, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Preferences...\tCTRL+,")) self.Bind(wx.EVT_MENU, self.OnPreferences, i) i = self.fileMenu.Append(-1, _("Machine settings...")) self.Bind(wx.EVT_MENU, self.OnMachineSettings, i) self.fileMenu.AppendSeparator() # Model MRU list modelHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), '&' + _("Recent Model Files"), modelHistoryMenu) self.modelFileHistory.UseMenu(modelHistoryMenu) self.modelFileHistory.AddFilesToMenu() self.Bind(wx.EVT_MENU_RANGE, self.OnModelMRU, id=self.ID_MRU_MODEL1, id2=self.ID_MRU_MODEL10) # Profle MRU list profileHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), _("Recent Profile Files"), profileHistoryMenu) 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")) self.Bind(wx.EVT_MENU, self.OnQuit, i) self.menubar.Append(self.fileMenu, '&' + _("File")) toolsMenu = wx.Menu() #i = toolsMenu.Append(-1, 'Batch run...') #self.Bind(wx.EVT_MENU, self.OnBatchRun, i) #self.normalModeOnlyItems.append(i) if minecraftImport.hasMinecraft(): i = toolsMenu.Append(-1, _("Minecraft map import...")) self.Bind(wx.EVT_MENU, self.OnMinecraftImport, i) if version.isDevVersion(): i = toolsMenu.Append(-1, _("PID Debugger...")) self.Bind(wx.EVT_MENU, self.OnPIDDebugger, i) 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 self.machineMenu = wx.Menu() self.updateMachineMenu() self.menubar.Append(self.machineMenu, _("Machine")) expertMenu = wx.Menu() i = expertMenu.Append(-1, _("Switch to quickprint..."), kind=wx.ITEM_RADIO) self.switchToQuickprintMenuItem = i self.Bind(wx.EVT_MENU, self.OnSimpleSwitch, i) i = expertMenu.Append(-1, _("Switch to full settings..."), kind=wx.ITEM_RADIO) self.switchToNormalMenuItem = i self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, _("Open expert settings...\tCTRL+E")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, _("Run first run wizard...")) 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) self.headOffsetWizardMenuItem = expertMenu.Append( -1, _("Run head offset wizard...")) self.Bind(wx.EVT_MENU, self.OnHeadOffsetWizard, self.headOffsetWizardMenuItem) self.menubar.Append(expertMenu, _("Expert")) helpMenu = wx.Menu() i = helpMenu.Append(-1, _("Online documentation...")) self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('http://daid.github.com/Cura'), i) i = helpMenu.Append(-1, _("Report a problem...")) self.Bind( wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i) i = helpMenu.Append(-1, _("Check for update...")) self.Bind(wx.EVT_MENU, self.OnCheckForUpdate, i) if profile.getPreference('use_youmagine') == 'True': i = helpMenu.Append(-1, _("Open YouMagine website...")) self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://www.youmagine.com/'), i) i = helpMenu.Append(-1, _("About Cura...")) self.Bind(wx.EVT_MENU, self.OnAbout, i) self.menubar.Append(helpMenu, _("Help")) self.SetMenuBar(self.menubar) self.splitter = wx.SplitterWindow(self, style=wx.SP_3D | wx.SP_LIVE_UPDATE) self.leftPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.rightPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.splitter.Bind(wx.EVT_SPLITTER_DCLICK, lambda evt: evt.Veto()) ##Gui components## self.simpleSettingsPanel = simpleMode.simpleModePanel( self.leftPane, lambda: self.scene.sceneUpdated()) self.normalSettingsPanel = normalSettingsPanel( self.leftPane, lambda: self.scene.sceneUpdated()) self.leftSizer = wx.BoxSizer(wx.VERTICAL) self.leftSizer.Add(self.simpleSettingsPanel, 1) self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND) self.leftPane.SetSizer(self.leftSizer) #Preview window self.scene = sceneView.SceneView(self.rightPane) #Main sizer, to position the preview window, buttons and tab control sizer = wx.BoxSizer() self.rightPane.SetSizer(sizer) sizer.Add(self.scene, 1, flag=wx.EXPAND) # Main window sizer sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) sizer.Add(self.splitter, 1, wx.EXPAND) sizer.Layout() self.sizer = sizer self.updateProfileToAllControls() self.SetBackgroundColour( self.normalSettingsPanel.GetBackgroundColour()) self.simpleSettingsPanel.Show(False) self.normalSettingsPanel.Show(False) # Set default window size & position self.SetSize((wx.Display().GetClientArea().GetWidth() / 2, wx.Display().GetClientArea().GetHeight() / 2)) self.Centre() #Timer set; used to check if profile is on the clipboard self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.onTimer) self.timer.Start(1000) self.lastTriedClipboard = profile.getProfileString() # Restore the window position, size & state from the preferences file try: if profile.getPreference('window_maximized') == 'True': self.Maximize(True) else: posx = int(profile.getPreference('window_pos_x')) posy = int(profile.getPreference('window_pos_y')) width = int(profile.getPreference('window_width')) height = int(profile.getPreference('window_height')) if posx > 0 or posy > 0: self.SetPosition((posx, posy)) if width > 0 and height > 0: self.SetSize((width, height)) self.normalSashPos = int( profile.getPreference('window_normal_sash')) except: self.normalSashPos = 0 self.Maximize(True) if self.normalSashPos < self.normalSettingsPanel.printPanel.GetBestSize( )[0] + 5: self.normalSashPos = self.normalSettingsPanel.printPanel.GetBestSize( )[0] + 5 self.splitter.SplitVertically(self.leftPane, self.rightPane, self.normalSashPos) if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.Centre() if wx.Display.GetFromPoint( (self.GetPositionTuple()[0] + self.GetSizeTuple()[1], self.GetPositionTuple()[1] + self.GetSizeTuple()[1])) < 0: self.Centre() if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.SetSize((800, 600)) self.Centre() self.updateSliceMode() self.scene.SetFocus()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in version 15.04.4:')) s.Add( wx.StaticText( p, -1, '* Added Ultimaker 2+ and Ultimaker 2 Extended+ machines')) s.Add( wx.StaticText( p, -1, '* Added quick print profiles for Ultimaker 2+ and Ultimaker 2 Extended+' )) s.Add( wx.StaticText( p, -1, '* Added feature where quickprint profiles can be per nozzle size and material' )) self.has_machine = {} for n in xrange(0, profile.getMachineCount()): self.has_machine[profile.getMachineSetting('machine_type', n)] = n if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if 'ultimaker' in self.has_machine and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind( wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall( self.has_machine['ultimaker']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2' in self.has_machine and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker 2:')) s.Add( wx.StaticText( p, -1, '* Added option to change filament when pausing during a print.' )) s.Add( wx.StaticText( p, -1, '* Prevent temperature display jitter (thanks to TinkerGnome)' )) s.Add( wx.StaticText( p, -1, '* Fixed problems with filenames containing an umlaut.')) s.Add( wx.StaticText( p, -1, '* Improved pause handling (thanks to ThinkerGnome)')) button = wx.Button(p, -1, 'Install now') self.Bind( wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall( self.has_machine['ultimaker2']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2+' in self.has_machine and True: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker 2+:')) s.Add(wx.StaticText(p, -1, '* Fixed temperature stability.')) s.Add( wx.StaticText( p, -1, '* Fixed print starting problems when a material warning was ignored' )) button = wx.Button(p, -1, 'Install now') self.Bind( wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall( self.has_machine['ultimaker2+']), button) s.Add(button, flag=wx.TOP, border=5) if 'ultimaker2+extended' in self.has_machine and True: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText(p, -1, 'New firmware for your Ultimaker2+Extended:')) s.Add(wx.StaticText(p, -1, '* Fixed temperature stability.')) s.Add( wx.StaticText( p, -1, '* Fixed print starting problems when a material warning was ignored' )) button = wx.Button(p, -1, 'Install now') self.Bind( wx.EVT_BUTTON, lambda e: self.OnFirmwareInstall( self.has_machine['ultimaker2+extended']), button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP | wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura-BCN3D ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in this version:')) s.Add(wx.StaticText(p, -1, '* Added settings for BCN3D Technologies printers')) s.Add(wx.StaticText(p, -1, '* Changed some parts of the interface to give a better user experience')) s.Add(wx.StaticText(p, -1, '* BCN3D Sigma is automatically set to double extrusion')) self.hasBCN3DSigma = None self.hasBCN3DPlus = None self.hasBCN3DR = None self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'BCN3DSigma': self.hasBCN3DSigma = n if profile.getMachineSetting('machine_type', n) == 'BCN3DPlus': self.hasBCN3DPlus = n if profile.getMachineSetting('machine_type', n) == 'BCN3DR': self.hasBCN3DR = n if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasBCN3DSigma is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your BCN3D Sigma:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnBCN3DSigmaFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasBCN3DPlus is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your BCN3D Plus:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnBCN3DPlusFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasBCN3DR is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your BCN3D R:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnBCN3DRFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2: ')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP|wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def afterSplashCallback(self): #These imports take most of the time and thus should be done after showing the splashscreen import webbrowser from Cura.gui import mainWindow from Cura.gui import configWizard from Cura.gui import newVersionDialog from Cura.util import profile from Cura.util import resources from Cura.util import version resources.setupLocalization( profile.getPreference('language') ) # it's important to set up localization at very beginning to install _ #If we do not have preferences yet, try to load it from a previous Cura install # Don't look for old versions ''' if profile.getMachineSetting('machine_type') == 'unknown': try: otherCuraInstalls = profile.getAlternativeBasePaths() for path in otherCuraInstalls[::-1]: try: print 'Loading old settings from %s' % (path) profile.loadPreferences(os.path.join(path, 'preferences.ini')) profile.loadProfile(os.path.join(path, 'current_profile.ini')) break except: import traceback print traceback.print_exc() except: import traceback print traceback.print_exc() ''' #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown': #Check if we need to copy our examples exampleFile = os.path.normpath( os.path.join(resources.resourceBasePath, 'example', '3DK-printing-sample.STL')) self.loadFiles = [exampleFile] if self.splash is not None: self.splash.Show(False) configWizard.ConfigWizard() if profile.getPreference('check_for_updates') == 'NOPE': newVersion = version.checkForNewerVersion() if newVersion is not None: if self.splash is not None: self.splash.Show(False) if wx.MessageBox( _("A new version of Cura is available, would you like to download?" ), _("New version available"), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES: webbrowser.open(newVersion) return if profile.getMachineSetting('machine_name') == '': return self.mainWindow = mainWindow.mainWindow() if self.splash is not None: self.splash.Show(False) self.SetTopWindow(self.mainWindow) self.mainWindow.Show() self.mainWindow.OnDropFiles(self.loadFiles) if profile.getPreference('last_run_version') != version.getVersion( False): profile.putPreference('last_run_version', version.getVersion(False)) newVersionDialog.newVersionDialog().Show() setFullScreenCapable(self.mainWindow) if sys.platform.startswith('darwin'): wx.CallAfter(self.StupidMacOSWorkaround)
def __init__(self): super(mainWindow, self).__init__(None, title='Cura - ' + version.getVersion()) self.extruderCount = int(profile.getPreference('extruder_amount')) wx.EVT_CLOSE(self, self.OnClose) self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.supportedExtensions())) self.normalModeOnlyItems = [] mruFile = os.path.join(profile.getBasePath(), 'mru_filelist.ini') self.config = wx.FileConfig(appName="Cura", localFilename=mruFile, style=wx.CONFIG_USE_LOCAL_FILE) self.ID_MRU_MODEL1, self.ID_MRU_MODEL2, self.ID_MRU_MODEL3, self.ID_MRU_MODEL4, self.ID_MRU_MODEL5, self.ID_MRU_MODEL6, self.ID_MRU_MODEL7, self.ID_MRU_MODEL8, self.ID_MRU_MODEL9, self.ID_MRU_MODEL10 = [wx.NewId() for line in xrange(10)] self.modelFileHistory = wx.FileHistory(10, self.ID_MRU_MODEL1) self.config.SetPath("/ModelMRU") self.modelFileHistory.Load(self.config) self.ID_MRU_PROFILE1, self.ID_MRU_PROFILE2, self.ID_MRU_PROFILE3, self.ID_MRU_PROFILE4, self.ID_MRU_PROFILE5, self.ID_MRU_PROFILE6, self.ID_MRU_PROFILE7, self.ID_MRU_PROFILE8, self.ID_MRU_PROFILE9, self.ID_MRU_PROFILE10 = [wx.NewId() for line in xrange(10)] self.profileFileHistory = wx.FileHistory(10, self.ID_MRU_PROFILE1) self.config.SetPath("/ProfileMRU") self.profileFileHistory.Load(self.config) self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() i = self.fileMenu.Append(-1, 'Load model file...\tCTRL+L') self.Bind(wx.EVT_MENU, lambda e: self._showModelLoadDialog(1), i) i = self.fileMenu.Append(-1, 'Prepare print...\tCTRL+R') self.Bind(wx.EVT_MENU, self.OnSlice, i) i = self.fileMenu.Append(-1, 'Print...\tCTRL+P') self.Bind(wx.EVT_MENU, self.OnPrint, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Open Profile...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) i = self.fileMenu.Append(-1, 'Save Profile...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) i = self.fileMenu.Append(-1, 'Load Profile from GCode...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Reset Profile to default') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnResetProfile, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Preferences...\tCTRL+,') self.Bind(wx.EVT_MENU, self.OnPreferences, i) self.fileMenu.AppendSeparator() # Model MRU list modelHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), "&Recent Model Files", modelHistoryMenu) self.modelFileHistory.UseMenu(modelHistoryMenu) self.modelFileHistory.AddFilesToMenu() self.Bind(wx.EVT_MENU_RANGE, self.OnModelMRU, id=self.ID_MRU_MODEL1, id2=self.ID_MRU_MODEL10) # Profle MRU list profileHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), "&Recent Profile Files", profileHistoryMenu) 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') self.Bind(wx.EVT_MENU, self.OnQuit, i) self.menubar.Append(self.fileMenu, '&File') toolsMenu = wx.Menu() 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...') self.switchToNormalMenuItem = i self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) toolsMenu.AppendSeparator() i = toolsMenu.Append(-1, 'Project planner...') self.Bind(wx.EVT_MENU, self.OnProjectPlanner, i) self.normalModeOnlyItems.append(i) i = toolsMenu.Append(-1, 'Batch run...') self.Bind(wx.EVT_MENU, self.OnBatchRun, i) self.normalModeOnlyItems.append(i) # i = toolsMenu.Append(-1, 'Open SVG (2D) slicer...') # self.Bind(wx.EVT_MENU, self.OnSVGSlicerOpen, i) if minecraftImport.hasMinecraft(): i = toolsMenu.Append(-1, 'Minecraft import...') self.Bind(wx.EVT_MENU, self.OnMinecraftImport, i) self.menubar.Append(toolsMenu, 'Tools') expertMenu = wx.Menu() i = expertMenu.Append(-1, 'Open expert settings...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) expertMenu.AppendSeparator() if firmwareInstall.getDefaultFirmware() is not None: i = expertMenu.Append(-1, 'Install default Marlin firmware') self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware, i) i = expertMenu.Append(-1, 'Install custom firmware') self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, 'Run first run wizard...') self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i) i = expertMenu.Append(-1, 'Run bed leveling wizard...') self.Bind(wx.EVT_MENU, self.OnBedLevelWizard, i) self.menubar.Append(expertMenu, 'Expert') helpMenu = wx.Menu() i = helpMenu.Append(-1, 'Online documentation...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('http://daid.github.com/Cura'), i) i = helpMenu.Append(-1, 'Report a problem...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i) i = helpMenu.Append(-1, 'Check for update...') self.Bind(wx.EVT_MENU, self.OnCheckForUpdate, i) self.menubar.Append(helpMenu, 'Help') self.SetMenuBar(self.menubar) if profile.getPreference('lastFile') != '': self.filelist = profile.getPreference('lastFile').split(';') self.SetTitle('Cura - %s - %s' % (version.getVersion(), self.filelist[-1])) else: self.filelist = [] self.progressPanelList = [] self.splitter = wx.SplitterWindow(self, style = wx.SP_3D | wx.SP_LIVE_UPDATE) self.leftPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.rightPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.splitter.Bind(wx.EVT_SPLITTER_DCLICK, lambda evt: evt.Veto()) ##Gui components## self.simpleSettingsPanel = simpleMode.simpleModePanel(self.leftPane) self.normalSettingsPanel = normalSettingsPanel(self.leftPane) self.leftSizer = wx.BoxSizer(wx.VERTICAL) self.leftSizer.Add(self.simpleSettingsPanel) self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND) self.leftPane.SetSizer(self.leftSizer) #Preview window self.preview3d = preview3d.previewPanel(self.rightPane) #Also bind double clicking the 3D preview to load an STL file. #self.preview3d.glCanvas.Bind(wx.EVT_LEFT_DCLICK, lambda e: self._showModelLoadDialog(1), self.preview3d.glCanvas) #Main sizer, to position the preview window, buttons and tab control sizer = wx.BoxSizer() self.rightPane.SetSizer(sizer) sizer.Add(self.preview3d, 1, flag=wx.EXPAND) # Main window sizer sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) sizer.Add(self.splitter, 1, wx.EXPAND) sizer.Layout() self.sizer = sizer if len(self.filelist) > 0: self.preview3d.loadModelFiles(self.filelist) # Update the Model MRU for idx in xrange(0, len(self.filelist)): self.addToModelMRU(self.filelist[idx]) self.updateProfileToControls() self.SetBackgroundColour(self.normalSettingsPanel.GetBackgroundColour()) self.simpleSettingsPanel.Show(False) self.normalSettingsPanel.Show(False) # Set default window size & position self.SetSize((wx.Display().GetClientArea().GetWidth()/2,wx.Display().GetClientArea().GetHeight()/2)) self.Centre() # Restore the window position, size & state from the preferences file try: if profile.getPreference('window_maximized') == 'True': self.Maximize(True) else: posx = int(profile.getPreference('window_pos_x')) posy = int(profile.getPreference('window_pos_y')) width = int(profile.getPreference('window_width')) height = int(profile.getPreference('window_height')) if posx > 0 or posy > 0: self.SetPosition((posx,posy)) if width > 0 and height > 0: self.SetSize((width,height)) self.normalSashPos = int(profile.getPreference('window_normal_sash')) except: self.normalSashPos = 0 self.Maximize(True) if self.normalSashPos < self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5: self.normalSashPos = self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5 self.splitter.SplitVertically(self.leftPane, self.rightPane, self.normalSashPos) if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.Centre() if wx.Display.GetFromPoint((self.GetPositionTuple()[0] + self.GetSizeTuple()[1], self.GetPositionTuple()[1] + self.GetSizeTuple()[1])) < 0: self.Centre() if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.SetSize((800,600)) self.Centre() self.updateSliceMode() self.Show(True)
def OnLoadProfile(self): if sys.platform.startswith('win'): dir = r"C:\\Program Files (x86)\\Cura-BCN3D-%s-beta2\\resources\\configurations" % version.getVersion( ) #os.chdir(dir) dlg = wx.FileDialog(self, _("Select profile file to load"), dir, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) dlg.SetWildcard("ini files (*.ini)|*.ini") if dlg.ShowModal() == wx.ID_OK: profileFile = dlg.GetPath() profile.loadProfile(profileFile) self.updateProfileToAllControls() # Update the Profile MRU self.addToProfileMRU(profileFile) dlg.Destroy() if sys.platform.startswith('darwin'): dir = '/Applications/Cura/Cura-BCN3D.app/Contents/Resources/configurations' os.chdir(dir) dlg = wx.FileDialog(self, _("Select profile file to load"), dir, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) dlg.SetWildcard("ini files (*.ini)|*.ini") if dlg.ShowModal() == wx.ID_OK: profileFile = dlg.GetPath() profile.loadProfile(profileFile) self.updateProfileToAllControls() # Update the Profile MRU self.addToProfileMRU(profileFile) dlg.Destroy()
def main(): parser = OptionParser( usage= "usage: %prog [options] <X,Y> <filename>[, <X,Y> <filename>][, ...]") parser.add_option("-p", "--profile", action="store", type="string", dest="profile", help="Encoded profile to use for the print") parser.add_option("-o", "--output", action="store", type="string", dest="output", help="Output filename") (options, args) = parser.parse_args() if options.output is None: print 'Missing output filename' sys.exit(1) if options.profile is not None: profile.loadGlobalProfileFromString(options.profile) options.output = fixUTF8(options.output) clearZ = 0 resultFile = open(options.output, "w") for idx in xrange(0, len(args), 2): position = map(float, args[idx].split(',')) if len(position) < 9 + 2: position = position[0:2] position += [1, 0, 0] position += [0, 1, 0] position += [0, 0, 1] filenames = fixUTF8(args[idx + 1]).split('|') profile.setTempOverride('object_center_x', position[0]) profile.setTempOverride('object_center_y', position[1]) if idx == 0: resultFile.write(';TYPE:CUSTOM\n') resultFile.write( profile.getAlterationFileContents( 'start.gcode', len(filenames)).replace( '?filename?', ' '.join(filenames).encode('ascii', 'replace'))) else: resultFile.write(';TYPE:CUSTOM\n') n = output[-1].rfind('Z') + 1 zString = output[-1][n:n + 20] zString = zString[0:zString.find(' ')] clearZ = max(clearZ, float(zString) + 10) profile.setTempOverride('clear_z', clearZ) print position print profile.getAlterationFileContents('nextobject.gcode') resultFile.write( profile.getAlterationFileContents('nextobject.gcode').replace( '?filename?', ' '.join(filenames).encode('ascii', 'replace'))) output = [] for filename in filenames: extruderNr = filenames.index(filename) profile.resetTempOverride() if extruderNr > 0: profile.setTempOverride( 'object_center_x', position[0] - profile.getPreferenceFloat('extruder_offset_x%d' % (extruderNr))) profile.setTempOverride( 'object_center_y', position[1] - profile.getPreferenceFloat('extruder_offset_y%d' % (extruderNr))) profile.setTempOverride('fan_enabled', 'False') profile.setTempOverride('skirt_line_count', '0') profile.setTempOverride('alternative_center', filenames[0]) else: profile.setTempOverride('object_center_x', position[0]) profile.setTempOverride('object_center_y', position[1]) profile.setTempOverride('object_matrix', ','.join(map(str, position[2:11]))) if extruderNr > 0: if profile.getProfileSettingFloat('filament_diameter%d' % (extruderNr + 1)) > 0: profile.setTempOverride( 'filament_diameter', profile.getProfileSetting('filament_diameter%d' % (extruderNr + 1))) print extruderNr, profile.getPreferenceFloat( 'extruder_offset_x%d' % (extruderNr)), profile.getPreferenceFloat( 'extruder_offset_y%d' % (extruderNr)) output.append(export.getOutput(filename)) profile.resetTempOverride() if len(output) == 1: resultFile.write(output[0]) else: stitchMultiExtruder(output, resultFile) resultFile.write(';TYPE:CUSTOM\n') resultFile.write(profile.getAlterationFileContents('end.gcode')) resultFile.close() print "Running plugins" ret = profile.runPostProcessingPlugins(options.output) if ret is not None: print ret print "Finalizing %s" % (os.path.basename(options.output)) if profile.getPreference('submit_slice_information') == 'True': filenames = fixUTF8(args[idx + 1]).split('|') for filename in filenames: m = hashlib.sha512() f = open(filename, "rb") while True: chunk = f.read(1024) if not chunk: break m.update(chunk) f.close() data = { 'processor': platform.processor(), 'machine': platform.machine(), 'platform': platform.platform(), 'profile': profile.getGlobalProfileString(), 'preferences': profile.getGlobalPreferencesString(), 'modelhash': m.hexdigest(), 'version': version.getVersion(), } try: f = urllib2.urlopen("http://platform.ultimaker.com/curastats/", data=urllib.urlencode(data), timeout=5) f.read() f.close() except: pass
def __init__(self): super(mainWindow, self).__init__(None, title='Cura - ' + version.getVersion()) wx.EVT_CLOSE(self, self.OnClose) # allow dropping any file, restrict later self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles)) # TODO: wxWidgets 2.9.4 has a bug when NSView does not register for dragged types when wx drop target is set. It was fixed in 2.9.5 if sys.platform.startswith('darwin'): try: import objc nswindow = objc.objc_object(c_void_p=self.MacGetTopLevelWindowRef()) view = nswindow.contentView() view.registerForDraggedTypes_([u'NSFilenamesPboardType']) except: pass self.normalModeOnlyItems = [] mruFile = os.path.join(profile.getBasePath(), 'mru_filelist.ini') self.config = wx.FileConfig(appName="Cura", localFilename=mruFile, style=wx.CONFIG_USE_LOCAL_FILE) self.ID_MRU_MODEL1, self.ID_MRU_MODEL2, self.ID_MRU_MODEL3, self.ID_MRU_MODEL4, self.ID_MRU_MODEL5, self.ID_MRU_MODEL6, self.ID_MRU_MODEL7, self.ID_MRU_MODEL8, self.ID_MRU_MODEL9, self.ID_MRU_MODEL10 = [wx.NewId() for line in xrange(10)] self.modelFileHistory = wx.FileHistory(10, self.ID_MRU_MODEL1) self.config.SetPath("/ModelMRU") self.modelFileHistory.Load(self.config) self.ID_MRU_PROFILE1, self.ID_MRU_PROFILE2, self.ID_MRU_PROFILE3, self.ID_MRU_PROFILE4, self.ID_MRU_PROFILE5, self.ID_MRU_PROFILE6, self.ID_MRU_PROFILE7, self.ID_MRU_PROFILE8, self.ID_MRU_PROFILE9, self.ID_MRU_PROFILE10 = [wx.NewId() for line in xrange(10)] self.profileFileHistory = wx.FileHistory(10, self.ID_MRU_PROFILE1) self.config.SetPath("/ProfileMRU") self.profileFileHistory.Load(self.config) self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() i = self.fileMenu.Append(-1, _("Load model file...\tCTRL+L")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showLoadModel(), i) i = self.fileMenu.Append(-1, _("Save model...\tCTRL+S")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveModel(), i) i = self.fileMenu.Append(-1, _("Reload platform\tF5")) self.Bind(wx.EVT_MENU, lambda e: self.scene.reloadScene(e), i) i = self.fileMenu.Append(-1, _("Clear platform")) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnDeleteAll(e), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Print...\tCTRL+P")) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnPrintButton(1), i) i = self.fileMenu.Append(-1, _("Save GCode...")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveGCode(), i) i = self.fileMenu.Append(-1, _("Show slice engine log...")) self.Bind(wx.EVT_MENU, lambda e: self.scene._showEngineLog(), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Open Profile...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) i = self.fileMenu.Append(-1, _("Save Profile...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) if version.isDevVersion(): i = self.fileMenu.Append(-1, "Save difference from default...") self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnSaveDifferences, i) i = self.fileMenu.Append(-1, _("Load Profile from GCode...")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Reset Profile to default")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnResetProfile, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, _("Preferences...\tCTRL+,")) self.Bind(wx.EVT_MENU, self.OnPreferences, i) i = self.fileMenu.Append(-1, _("Machine settings...")) self.Bind(wx.EVT_MENU, self.OnMachineSettings, i) self.fileMenu.AppendSeparator() # Model MRU list modelHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), '&' + _("Recent Model Files"), modelHistoryMenu) self.modelFileHistory.UseMenu(modelHistoryMenu) self.modelFileHistory.AddFilesToMenu() self.Bind(wx.EVT_MENU_RANGE, self.OnModelMRU, id=self.ID_MRU_MODEL1, id2=self.ID_MRU_MODEL10) # Profle MRU list profileHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), _("Recent Profile Files"), profileHistoryMenu) 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")) self.Bind(wx.EVT_MENU, self.OnQuit, i) self.menubar.Append(self.fileMenu, '&' + _("File")) toolsMenu = wx.Menu() #i = toolsMenu.Append(-1, 'Batch run...') #self.Bind(wx.EVT_MENU, self.OnBatchRun, i) #self.normalModeOnlyItems.append(i) if minecraftImport.hasMinecraft(): i = toolsMenu.Append(-1, _("Minecraft map import...")) self.Bind(wx.EVT_MENU, self.OnMinecraftImport, i) if version.isDevVersion(): i = toolsMenu.Append(-1, _("PID Debugger...")) self.Bind(wx.EVT_MENU, self.OnPIDDebugger, i) i = toolsMenu.Append(-1, _("Auto Firmware Update...")) self.Bind(wx.EVT_MENU, self.OnAutoFirmwareUpdate, i) #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 self.machineMenu = wx.Menu() self.updateMachineMenu() self.menubar.Append(self.machineMenu, _("Machine")) expertMenu = wx.Menu() i = expertMenu.Append(-1, _("Switch to quickprint..."), kind=wx.ITEM_RADIO) self.switchToQuickprintMenuItem = i self.Bind(wx.EVT_MENU, self.OnSimpleSwitch, i) i = expertMenu.Append(-1, _("Switch to full settings..."), kind=wx.ITEM_RADIO) self.switchToNormalMenuItem = i self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, _("Open expert settings...\tCTRL+E")) self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) # expertMenu.AppendSeparator() # self.bedLevelWizardMenuItem = expertMenu.Append(-1, _("Run bed leveling wizard...")) # self.Bind(wx.EVT_MENU, self.OnBedLevelWizard, self.bedLevelWizardMenuItem) # self.headOffsetWizardMenuItem = expertMenu.Append(-1, _("Run head offset wizard...")) # self.Bind(wx.EVT_MENU, self.OnHeadOffsetWizard, self.headOffsetWizardMenuItem) self.menubar.Append(expertMenu, _("Expert")) helpMenu = wx.Menu() i = helpMenu.Append(-1, _("Online documentation...")) self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('http://creatablelabs.com/support'), i) i = helpMenu.Append(-1, _("Report a problem...")) self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/AteamVentures/Creatable_D2/issues'), i) # i = helpMenu.Append(-1, _("Check for update...")) # self.Bind(wx.EVT_MENU, self.OnCheckForUpdate, i) # i = helpMenu.Append(-1, _("Open YouMagine website...")) # self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://www.youmagine.com/'), i) i = helpMenu.Append(-1, _("About Cura...")) self.Bind(wx.EVT_MENU, self.OnAbout, i) self.menubar.Append(helpMenu, _("Help")) self.SetMenuBar(self.menubar) self.splitter = wx.SplitterWindow(self, style = wx.SP_3D | wx.SP_LIVE_UPDATE) self.leftPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.rightPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.splitter.Bind(wx.EVT_SPLITTER_DCLICK, lambda evt: evt.Veto()) #Preview window self.scene = sceneView.SceneView(self.rightPane) ##Gui components## self.simpleSettingsPanel = simpleMode.simpleModePanel(self.leftPane, self.scene.sceneUpdated) self.normalSettingsPanel = normalSettingsPanel(self.leftPane, self.scene.sceneUpdated) self.leftSizer = wx.BoxSizer(wx.VERTICAL) self.leftSizer.Add(self.simpleSettingsPanel, 1) self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND) self.leftPane.SetSizer(self.leftSizer) #Main sizer, to position the preview window, buttons and tab control sizer = wx.BoxSizer() self.rightPane.SetSizer(sizer) sizer.Add(self.scene, 1, flag=wx.EXPAND) # Main window sizer sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) sizer.Add(self.splitter, 1, wx.EXPAND) sizer.Layout() self.sizer = sizer self.updateProfileToAllControls() self.SetBackgroundColour(self.normalSettingsPanel.GetBackgroundColour()) self.simpleSettingsPanel.Show(False) self.normalSettingsPanel.Show(False) # Set default window size & position self.SetSize((wx.Display().GetClientArea().GetWidth()/2,wx.Display().GetClientArea().GetHeight()/2)) self.Centre() #Timer set; used to check if profile is on the clipboard self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.onTimer) #self.timer.Start(1000) self.lastTriedClipboard = profile.getProfileString() # Restore the window position, size & state from the preferences file try: if profile.getPreference('window_maximized') == 'True': self.Maximize(True) else: posx = int(profile.getPreference('window_pos_x')) posy = int(profile.getPreference('window_pos_y')) width = int(profile.getPreference('window_width')) height = int(profile.getPreference('window_height')) if posx > 0 or posy > 0: self.SetPosition((posx,posy)) if width > 0 and height > 0: self.SetSize((width,height)) self.normalSashPos = int(profile.getPreference('window_normal_sash')) except: self.normalSashPos = 0 self.Maximize(True) if self.normalSashPos < self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5: self.normalSashPos = self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5 self.splitter.SplitVertically(self.leftPane, self.rightPane, self.normalSashPos) if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.Centre() if wx.Display.GetFromPoint((self.GetPositionTuple()[0] + self.GetSizeTuple()[1], self.GetPositionTuple()[1] + self.GetSizeTuple()[1])) < 0: self.Centre() if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.SetSize((800,600)) self.Centre() self.updateSliceMode() self.scene.SetFocus() self.dialogframe = None if Publisher is not None: Publisher().subscribe(self.onPluginUpdate, "pluginupdate") pluginCount = self.normalSettingsPanel.pluginPanel.GetActivePluginCount() if pluginCount == 1: self.scene.notification.message("Warning: 1 plugin from the previous session is still active.") if pluginCount > 1: self.scene.notification.message("Warning: %i plugins from the previous session are still active." % pluginCount)
def _loadModels(self, filelist): self.filelist = filelist self.SetTitle(filelist[-1] + ' - Cura - ' + version.getVersion()) profile.putPreference('lastFile', ';'.join(self.filelist)) self.preview3d.loadModelFiles(self.filelist, True) self.preview3d.setViewMode("Normal")
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in this version:')) s.Add(wx.StaticText(p, -1, '* Fixed a problem which was introduced in 14.09.\n There are extreme amounts of head movements generated.')) s.Add(wx.StaticText(p, -1, '* Speed up GCode generation for large models by as much as 40%')) s.Add(wx.StaticText(p, -1, '* Fixed problems with placement of multiple objects on the build platform')) s.Add(wx.StaticText(p, -1, '* Prevent installing firmware for Ultimaker Original+ on an Ultimaker Original')) s.Add(wx.StaticText(p, -1, '* Fixed generating big GCode files (more then 200MB) on Windows')) s.Add(wx.StaticText(p, -1, '* French translation updates (Thanks to Jeremie Francois)')) s.Add(wx.StaticText(p, -1, '* Fixed a problem where "everywhere" support did not work when german was used as language.')) s.Add(wx.StaticText(p, -1, '* Changed the handling of the heated bed, now always heats\n the bed first instead of bed and nozzle at the same time.\n This to prevent the nozzle from leaking empty.')) s.Add(wx.StaticText(p, -1, '* Fixed the "uninstall old Cura versions" option in the windows installer.')) s.Add(wx.StaticText(p, -1, '* Improved the search for old installations, so old settings are copied over.')) s.Add(wx.StaticText(p, -1, '* Fixed a bug where double clicking a file on windows did not load the file in Cura.')) s.Add(wx.StaticText(p, -1, '* Made sure the firmware versions for Ultimaker printers always match the Cura release number.')) s.Add(wx.StaticText(p, -1, '* Added a quick access button for expert settings of a certain setting.')) s.Add(wx.StaticText(p, -1, '* Added some more raft settings to dial in the raft better.')) s.Add(wx.StaticText(p, -1, '* Fixed the tooltip of support material. Now it actually explains the angles properly.')) s.Add(wx.StaticText(p, -1, '* Fixed a bug which caused the USB printing window to stop working (Thanks to SpaxGuy)')) s.Add(wx.StaticText(p, -1, '* Fix a bug where Cura would stop generating GCode')) s.Add(wx.StaticText(p, -1, '* Added latest offerings of Printrbot')) self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None: s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2:')) s.Add(wx.StaticText(p, -1, '* Detect when the endstops are not working properly.\n Which prevents the bed from damaging the nozzle.')) s.Add(wx.StaticText(p, -1, '* Added the ability to import/export material profiles to the SD card.')) s.Add(wx.StaticText(p, -1, '* Improved hotend temperature stability.')) s.Add(wx.StaticText(p, -1, '* Added UPET material profile.')) s.Add(wx.StaticText(p, -1, '* Minor improvements to the time estimate code.')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP|wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the New Version!", style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) # Fonts titleFont = wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.NORMAL) headerFont = wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.NORMAL) textFont = wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.NORMAL) # Title text title = wx.StaticText(p, -1, 'Cura Type A - ' + version.getVersion()) title.SetFont(titleFont) versionForked = wx.StaticText(p, -1, 'Based On Daid/Ultimaker\'s Cura v15.02.') versionForked.SetFont(headerFont) s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5) s.Add(versionForked) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=5) # New in this version newHere = wx.StaticText(p, -1, "New Features and Enhancements") newHere.SetFont(titleFont) degree_sign = u'\N{DEGREE SIGN}' s.Add(newHere, flag=wx.TOP, border=10) featuresAndEnhancements = [ wx.StaticText(p, -1, "* Absolute Dimensions\n\t- Specifying infill by millimeter rather than percentage"), wx.StaticText(p, -1, "* 3D Cubic Structure\n\t- Delivering axis-independent interior structure"), wx.StaticText(p, -1, "* New Concentric Infill pattern introduced"), wx.StaticText(p, -1, "Infill Visualizer\n\t - Toggles the display of infill in-place"), wx.StaticText(p, -1, "* Expert Mode side panel now displays:\n\t- Extrusion Width, Number of Shells, Infill and Flow Percentage"), wx.StaticText(p, -1, "* Cmd/Ctrl-P now brings up the \"Send to Printer\" dialog"), wx.StaticText(p, -1, "* Tag added to GCode files including which profile was used to generate the GCode"), wx.StaticText(p, -1, "* User Notification for available Software Updates is now included"), ] for item in featuresAndEnhancements: item.SetFont(textFont) s.Add(item, flag=wx.BOTTOM | wx.EXPAND, border=10) # Bug fixes issuesAddressed = wx.StaticText(p, -1, "Issues Addressed") issuesAddressed.SetFont(titleFont) degree_sign = u'\N{DEGREE SIGN}' s.Add(issuesAddressed, flag=wx.TOP, border=10) issues = wx.StaticText(p, -1, "* Custom start/end GCode no longer ignored under some conditions") issues.SetFont(textFont) s.Add(issues, flag=wx.BOTTOM, border=20) newMaterialProfiles = wx.StaticText(p, -1, "New Material Profiles") newMaterialProfiles.SetFont(titleFont) s.Add(newMaterialProfiles, flag=wx.BOTTOM) materials = wx.StaticText(p, -1, "* Over 75 total") materials.SetFont(textFont) s.Add(materials, flag=wx.BOTTOM, border=10) hyperlink = hl.HyperLinkCtrl(p, -1, "* Complete list here", URL='https://docs.google.com/document/d/1jeOaJq3sqIv2bwnXVx3CSOUpI3yewPhzjAgBPw7mYaA') hyperlink.SetFont(textFont) s.Add(hyperlink) s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10) button = wx.Button(p, -1, 'OK') button.Bind(wx.EVT_BUTTON, self.OnOk) s.Add(button, flag=wx.TOP|wx.ALIGN_CENTRE | wx.ALL, border=5) self.Fit() self.Centre()
def afterSplashCallback(self): #These imports take most of the time and thus should be done after showing the splashscreen import webbrowser from Cura.gui import mainWindow from Cura.gui import configWizard from Cura.gui import newVersionDialog from Cura.util import profile from Cura.util import resources from Cura.util import version resources.setupLocalization( profile.getPreference('language') ) # it's important to set up localization at very beginning to install _ try: from distutils.version import LooseVersion if LooseVersion(wx.__version__) < LooseVersion('3.0'): wx.MessageBox( _("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s." ) % wx.__version__, _("WxPython version is too old"), wx.OK | wx.ICON_ERROR) return except: # distutils not found.. it can happen! # Only check the first 3 characters of the version string instead if float(wx.__version__[0:3]) < 3.0: wx.MessageBox( _("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s." ) % wx.__version__, _("WxPython version is too old"), wx.OK | wx.ICON_ERROR) return #If we do not have preferences yet, try to load it from a previous Cura install if profile.getMachineSetting('machine_type') == 'unknown': try: otherCuraInstalls = profile.getAlternativeBasePaths() for path in otherCuraInstalls[::-1]: try: print 'Loading old settings from %s' % (path) profile.loadPreferences( os.path.join(path, 'preferences.ini')) profile.loadProfile( os.path.join(path, 'current_profile.ini')) break except: import traceback print traceback.print_exc() except: import traceback print traceback.print_exc() #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown': #Check if we need to copy our examples exampleFile = os.path.normpath( os.path.join(resources.resourceBasePath, 'example', 'Rocktopus.stl')) self.loadFiles = [exampleFile] self.destroySplashScreen() configWizard.ConfigWizard() if profile.getPreference('check_for_updates') == 'True': newVersion = version.checkForNewerVersion() if newVersion is not None: self.destroySplashScreen() if wx.MessageBox( _("A new version of Cura is available, would you like to download?" ), _("New version available"), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES: webbrowser.open(newVersion) return if profile.getMachineSetting('machine_name') == '': return if profile.getPreference('last_run_version') != version.getVersion( False): profile.performVersionUpgrade() # Must happen before the main window is created, in case there are changes # that would affect it (such as machine name changes) if version.isDevVersion(): profile.performVersionUpgrade() self.mainWindow = mainWindow.mainWindow() self.destroySplashScreen() self.SetTopWindow(self.mainWindow) self.mainWindow.Show() self.mainWindow.OnDropFiles(self.loadFiles) setFullScreenCapable(self.mainWindow) if profile.getPreference('last_run_version') != version.getVersion( False): profile.putPreference('last_run_version', version.getVersion(False)) newVersionDialog.newVersionDialog().Show() # Must come after creating the main window #if version.isDevVersion(): #import wx.lib.inspection # Show the WX widget inspection tool #wx.lib.inspection.InspectionTool().Show() if sys.platform.startswith('darwin'): wx.CallAfter(self.StupidMacOSWorkaround)
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in this version:')) s.Add( wx.StaticText( p, -1, '* Fixed a rare bug that caused the CuraEngine to crash on some models.' )) s.Add( wx.StaticText( p, -1, '* Added support for multiple Doodle3D boxes on the same network.' )) s.Add( wx.StaticText( p, -1, '* Made it possible to switch between "all at once" and "one at a time printing"' )) s.Add(wx.StaticText(p, -1, '* Improved USB communication stability.')) s.Add( wx.StaticText( p, -1, '* Improved USB auto-detection for none-Ultimaker printers.')) s.Add( wx.StaticText( p, -1, '* Set retraction enabled by default and in the quickprint profiles.' )) s.Add( wx.StaticText( p, -1, '* Fixed a bug that caused loading of really small objects to fail.' )) s.Add( wx.StaticText( p, -1, '* Made camera keyboard controls accessible in the GCode view, use shift+up/down for layer changes now.' )) self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2:')) s.Add( wx.StaticText( p, -1, '* Fixed the bug where aborting a print caused massive retraction.' )) s.Add( wx.StaticText( p, -1, '* Fixed a bug where going into move-material when the printer was still moving caused a bed-crash.' )) s.Add( wx.StaticText( p, -1, '* Added bed temperature when cooling down the printer.')) s.Add( wx.StaticText(p, -1, '* Allow abort if bed-leveling is selected.')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP | wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()
def __init__(self): super(mainWindow, self).__init__(None, title='Cura - ' + version.getVersion()) self.extruderCount = int(profile.getPreference('extruder_amount')) wx.EVT_CLOSE(self, self.OnClose) self.SetDropTarget( dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.supportedExtensions())) self.normalModeOnlyItems = [] mruFile = os.path.join(profile.getBasePath(), 'mru_filelist.ini') self.config = wx.FileConfig(appName="Cura", localFilename=mruFile, style=wx.CONFIG_USE_LOCAL_FILE) self.ID_MRU_MODEL1, self.ID_MRU_MODEL2, self.ID_MRU_MODEL3, self.ID_MRU_MODEL4, self.ID_MRU_MODEL5, self.ID_MRU_MODEL6, self.ID_MRU_MODEL7, self.ID_MRU_MODEL8, self.ID_MRU_MODEL9, self.ID_MRU_MODEL10 = [ wx.NewId() for line in xrange(10) ] self.modelFileHistory = wx.FileHistory(10, self.ID_MRU_MODEL1) self.config.SetPath("/ModelMRU") self.modelFileHistory.Load(self.config) self.ID_MRU_PROFILE1, self.ID_MRU_PROFILE2, self.ID_MRU_PROFILE3, self.ID_MRU_PROFILE4, self.ID_MRU_PROFILE5, self.ID_MRU_PROFILE6, self.ID_MRU_PROFILE7, self.ID_MRU_PROFILE8, self.ID_MRU_PROFILE9, self.ID_MRU_PROFILE10 = [ wx.NewId() for line in xrange(10) ] self.profileFileHistory = wx.FileHistory(10, self.ID_MRU_PROFILE1) self.config.SetPath("/ProfileMRU") self.profileFileHistory.Load(self.config) self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() i = self.fileMenu.Append(-1, 'Load model file...\tCTRL+L') self.Bind(wx.EVT_MENU, lambda e: self._showModelLoadDialog(1), i) i = self.fileMenu.Append(-1, 'Prepare print...\tCTRL+R') self.Bind(wx.EVT_MENU, self.OnSlice, i) i = self.fileMenu.Append(-1, 'Print...\tCTRL+P') self.Bind(wx.EVT_MENU, self.OnPrint, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Open Profile...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) i = self.fileMenu.Append(-1, 'Save Profile...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) i = self.fileMenu.Append(-1, 'Load Profile from GCode...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Reset Profile to default') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnResetProfile, i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Preferences...\tCTRL+,') self.Bind(wx.EVT_MENU, self.OnPreferences, i) self.fileMenu.AppendSeparator() # Model MRU list modelHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), "&Recent Model Files", modelHistoryMenu) self.modelFileHistory.UseMenu(modelHistoryMenu) self.modelFileHistory.AddFilesToMenu() self.Bind(wx.EVT_MENU_RANGE, self.OnModelMRU, id=self.ID_MRU_MODEL1, id2=self.ID_MRU_MODEL10) # Profle MRU list profileHistoryMenu = wx.Menu() self.fileMenu.AppendMenu(wx.NewId(), "&Recent Profile Files", profileHistoryMenu) 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') self.Bind(wx.EVT_MENU, self.OnQuit, i) self.menubar.Append(self.fileMenu, '&File') toolsMenu = wx.Menu() 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...') self.switchToNormalMenuItem = i self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) toolsMenu.AppendSeparator() i = toolsMenu.Append(-1, 'Project planner...') self.Bind(wx.EVT_MENU, self.OnProjectPlanner, i) self.normalModeOnlyItems.append(i) i = toolsMenu.Append(-1, 'Batch run...') self.Bind(wx.EVT_MENU, self.OnBatchRun, i) self.normalModeOnlyItems.append(i) # i = toolsMenu.Append(-1, 'Open SVG (2D) slicer...') # self.Bind(wx.EVT_MENU, self.OnSVGSlicerOpen, i) if minecraftImport.hasMinecraft(): i = toolsMenu.Append(-1, 'Minecraft import...') self.Bind(wx.EVT_MENU, self.OnMinecraftImport, i) self.menubar.Append(toolsMenu, 'Tools') expertMenu = wx.Menu() i = expertMenu.Append(-1, 'Open expert settings...') self.normalModeOnlyItems.append(i) self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) expertMenu.AppendSeparator() if firmwareInstall.getDefaultFirmware() is not None: i = expertMenu.Append(-1, 'Install default Marlin firmware') self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware, i) i = expertMenu.Append(-1, 'Install custom firmware') self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, 'Run first run wizard...') self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i) i = expertMenu.Append(-1, 'Run bed leveling wizard...') self.Bind(wx.EVT_MENU, self.OnBedLevelWizard, i) self.menubar.Append(expertMenu, 'Expert') helpMenu = wx.Menu() i = helpMenu.Append(-1, 'Online documentation...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('http://daid.github.com/Cura'), i) i = helpMenu.Append(-1, 'Report a problem...') self.Bind( wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i) i = helpMenu.Append(-1, 'Check for update...') self.Bind(wx.EVT_MENU, self.OnCheckForUpdate, i) self.menubar.Append(helpMenu, 'Help') self.SetMenuBar(self.menubar) if profile.getPreference('lastFile') != '': self.filelist = profile.getPreference('lastFile').split(';') self.SetTitle('Cura - %s - %s' % (version.getVersion(), self.filelist[-1])) else: self.filelist = [] self.progressPanelList = [] self.splitter = wx.SplitterWindow(self, style=wx.SP_3D | wx.SP_LIVE_UPDATE) self.leftPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.rightPane = wx.Panel(self.splitter, style=wx.BORDER_NONE) self.splitter.Bind(wx.EVT_SPLITTER_DCLICK, lambda evt: evt.Veto()) ##Gui components## self.simpleSettingsPanel = simpleMode.simpleModePanel(self.leftPane) self.normalSettingsPanel = normalSettingsPanel(self.leftPane) self.leftSizer = wx.BoxSizer(wx.VERTICAL) self.leftSizer.Add(self.simpleSettingsPanel) self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND) self.leftPane.SetSizer(self.leftSizer) #Preview window self.preview3d = preview3d.previewPanel(self.rightPane) #Also bind double clicking the 3D preview to load an STL file. #self.preview3d.glCanvas.Bind(wx.EVT_LEFT_DCLICK, lambda e: self._showModelLoadDialog(1), self.preview3d.glCanvas) #Main sizer, to position the preview window, buttons and tab control sizer = wx.BoxSizer() self.rightPane.SetSizer(sizer) sizer.Add(self.preview3d, 1, flag=wx.EXPAND) # Main window sizer sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) sizer.Add(self.splitter, 1, wx.EXPAND) sizer.Layout() self.sizer = sizer if len(self.filelist) > 0: self.preview3d.loadModelFiles(self.filelist) # Update the Model MRU for idx in xrange(0, len(self.filelist)): self.addToModelMRU(self.filelist[idx]) self.updateProfileToControls() self.SetBackgroundColour( self.normalSettingsPanel.GetBackgroundColour()) self.simpleSettingsPanel.Show(False) self.normalSettingsPanel.Show(False) # Set default window size & position self.SetSize((wx.Display().GetClientArea().GetWidth() / 2, wx.Display().GetClientArea().GetHeight() / 2)) self.Centre() # Restore the window position, size & state from the preferences file try: if profile.getPreference('window_maximized') == 'True': self.Maximize(True) else: posx = int(profile.getPreference('window_pos_x')) posy = int(profile.getPreference('window_pos_y')) width = int(profile.getPreference('window_width')) height = int(profile.getPreference('window_height')) if posx > 0 or posy > 0: self.SetPosition((posx, posy)) if width > 0 and height > 0: self.SetSize((width, height)) self.normalSashPos = int( profile.getPreference('window_normal_sash')) except: self.normalSashPos = 0 self.Maximize(True) if self.normalSashPos < self.normalSettingsPanel.printPanel.GetBestSize( )[0] + 5: self.normalSashPos = self.normalSettingsPanel.printPanel.GetBestSize( )[0] + 5 self.splitter.SplitVertically(self.leftPane, self.rightPane, self.normalSashPos) if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.Centre() if wx.Display.GetFromPoint( (self.GetPositionTuple()[0] + self.GetSizeTuple()[1], self.GetPositionTuple()[1] + self.GetSizeTuple()[1])) < 0: self.Centre() if wx.Display.GetFromPoint(self.GetPosition()) < 0: self.SetSize((800, 600)) self.Centre() self.updateSliceMode() self.Show(True)
def afterSplashCallback(self): #These imports take most of the time and thus should be done after showing the splashscreen import webbrowser from Cura.gui import mainWindow from Cura.gui import configWizard from Cura.gui import newVersionDialog from Cura.util import profile from Cura.util import resources from Cura.util import version resources.setupLocalization(profile.getPreference('language')) # it's important to set up localization at very beginning to install _ #If we do not have preferences yet, try to load it from a previous Cura install if profile.getMachineSetting('machine_type') == 'unknown': try: otherCuraInstalls = profile.getAlternativeBasePaths() otherCuraInstalls.sort() if len(otherCuraInstalls) > 0: profile.loadPreferences(os.path.join(otherCuraInstalls[-1], 'preferences.ini')) profile.loadProfile(os.path.join(otherCuraInstalls[-1], 'current_profile.ini')) except: import traceback print traceback.print_exc() #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown': if platform.system() == "Windows": exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'UltimakerRobot_support.stl')) else: #Check if we need to copy our examples exampleFile = os.path.expanduser('~/CuraExamples/UltimakerRobot_support.stl') if not os.path.isfile(exampleFile): try: os.makedirs(os.path.dirname(exampleFile)) except: pass for filename in glob.glob(os.path.normpath(os.path.join(resources.resourceBasePath, 'example', '*.*'))): shutil.copy(filename, os.path.join(os.path.dirname(exampleFile), os.path.basename(filename))) self.loadFiles = [exampleFile] if self.splash is not None: self.splash.Show(False) configWizard.configWizard() if profile.getPreference('check_for_updates') == 'True': newVersion = version.checkForNewerVersion() if newVersion is not None: if self.splash is not None: self.splash.Show(False) if wx.MessageBox(_("A new version of Cura is available, would you like to download?"), _("New version available"), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES: webbrowser.open(newVersion) return if profile.getMachineSetting('machine_name') == '': return self.mainWindow = mainWindow.mainWindow() if self.splash is not None: self.splash.Show(False) self.SetTopWindow(self.mainWindow) self.mainWindow.Show() self.mainWindow.OnDropFiles(self.loadFiles) if profile.getPreference('last_run_version') != version.getVersion(False): profile.putPreference('last_run_version', version.getVersion(False)) #newVersionDialog.newVersionDialog().Show() setFullScreenCapable(self.mainWindow) if sys.platform.startswith('darwin'): wx.CallAfter(self.StupidMacOSWorkaround)
def __init__(self): super(newVersionDialog, self).__init__(None, title="Welcome to the new version!") wx.EVT_CLOSE(self, self.OnClose) p = wx.Panel(self) self.panel = p s = wx.BoxSizer() self.SetSizer(s) s.Add(p, flag=wx.ALL, border=15) s = wx.BoxSizer(wx.VERTICAL) p.SetSizer(s) title = wx.StaticText(p, -1, '3DK - ' + version.getVersion()) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) s.Add(title, flag=wx.ALIGN_CENTRE | wx.EXPAND | wx.BOTTOM, border=5) s.Add(wx.StaticText(p, -1, 'Welcome to the new version of 3DK.')) s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)')) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New in this version:')) s.Add(wx.StaticText(p, -1, '* Auto/Manual Slicing')) s.Add(wx.StaticText(p, -1, '* Prevent reuse of older version settings')) s.Add(wx.StaticText(p, -1, '* Changed machine dimensions')) # s.Add(wx.StaticText(p, -1, '* Online registration for printers, helps with warranty claims')) # s.Add(wx.StaticText(p, -1, '* Fixed problems with placement of multiple objects on the build platform')) # s.Add(wx.StaticText(p, -1, '* Fix a bug where would stop generating GCode')) self.hasUltimaker = None self.hasUltimaker2 = None for n in xrange(0, profile.getMachineCount()): if profile.getMachineSetting('machine_type', n) == 'ultimaker': self.hasUltimaker = n if profile.getMachineSetting('machine_type', n) == 'ultimaker2': self.hasUltimaker2 = n if self.hasUltimaker is not None and False: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add( wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:')) s.Add(wx.StaticText(p, -1, '* .')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button) s.Add(button, flag=wx.TOP, border=5) if self.hasUltimaker2 is not None: s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2:')) s.Add( wx.StaticText( p, -1, '* Detect when the endstops are not working properly.\n Which prevents the bed from damaging the nozzle.' )) s.Add( wx.StaticText( p, -1, '* Added the ability to import/export material profiles to the SD card.' )) s.Add( wx.StaticText(p, -1, '* Improved hotend temperature stability.')) s.Add(wx.StaticText(p, -1, '* Added UPET material profile.')) s.Add( wx.StaticText( p, -1, '* Minor improvements to the time estimate code.')) button = wx.Button(p, -1, 'Install now') self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button) s.Add(button, flag=wx.TOP, border=5) s.Add(wx.StaticLine(p), flag=wx.EXPAND | wx.TOP | wx.BOTTOM, border=10) button = wx.Button(p, -1, 'Ok') self.Bind(wx.EVT_BUTTON, self.OnOk, button) s.Add(button, flag=wx.TOP | wx.ALIGN_RIGHT, border=5) self.Fit() self.Centre()