from __future__ import absolute_import
import __init__
-import wx, os, platform, types, webbrowser
+import wx, os, platform, types, webbrowser, shutil, glob
from gui import configBase
from gui import expertConfig
def main():
#app = wx.App(False)
if profile.getPreference('machine_type') == 'unknown':
+ if platform.system() == "Darwin":
+ #Check if we need to copy our examples
+ exampleFile = os.path.expanduser('~/CuraExamples/UltimakerRobot_support.stl')
+ if not os.path.isfile(examplePath):
+ try:
+ os.makedirs(os.path.dirname(examplePath))
+ except:
+ pass
+ for filename in glob.glob(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'example'))):
+ shutil.copy(filename, os.path.join(os.path.dirname(examplePath), os.basename(filename)))
+ profile.putPreference('lastFile', exampleFile)
configWizard.configWizard()
if profile.getPreference('startMode') == 'Simple':
simpleMode.simpleModeWindow()
validators.warningAbove(c, lambda : (float(profile.getProfileSetting('nozzle_size')) * 3.0 / 4.0), "A bottom layer of more then %.2fmm (3/4 nozzle size) usually give bad results and is not recommended.")
c = configBase.SettingRow(right, "Enable 'skin'", 'enable_skin', False, 'Skin prints the outer lines of the prints twice, each time with half the thickness. This gives the illusion of a higher print quality.')
+ #Effects page
+ self.effectList = profile.getEffectsList()
+ if len(self.effectList) > 0:
+ self.effectPanel = wx.Panel(nb)
+ sizer = wx.GridBagSizer(2, 2)
+ self.effectPanel.SetSizer(sizer)
+
+ effectStringList = []
+ for effect in self.effectList:
+ effectStringList.append(effect['name'])
+
+ self.listbox = wx.ListBox(self.effectPanel, -1, choices=effectStringList)
+ title = wx.StaticText(self.effectPanel, -1, "Effects:")
+ title.SetFont(wx.Font(wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
+ addButton = wx.Button(self.effectPanel, -1, '>', style=wx.BU_EXACTFIT)
+ remButton = wx.Button(self.effectPanel, -1, '<', style=wx.BU_EXACTFIT)
+ sizer.Add(self.listbox, (1,0), span=(2,1), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM)
+ sizer.Add(title, (0,0), border=10, flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.TOP)
+ sizer.Add(addButton, (1,1), border=5, flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_BOTTOM)
+ sizer.Add(remButton, (2,1), border=5, flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_TOP)
+
+ sizer.AddGrowableCol(2)
+ sizer.AddGrowableRow(1)
+ sizer.AddGrowableRow(2)
+ nb.AddPage(self.effectPanel, "Effects")
+
+ #Alteration page
self.alterationPanel = alterationPanel.alterationPanel(nb)
nb.AddPage(self.alterationPanel, "Start/End-GCode")
# load and slice buttons.
- loadButton = wx.Button(self, -1, 'Load Model')
- sliceButton = wx.Button(self, -1, 'Prepare print')
- printButton = wx.Button(self, -1, 'Print')
+ 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)
self.SetBackgroundColour(nb.GetBackgroundColour())
+ self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CTRL, ord('L'), loadButton.GetId()),
+ (wx.ACCEL_CTRL, ord('R'), sliceButton.GetId()),
+ (wx.ACCEL_CTRL, ord('P'), printButton.GetId())
+ ]))
+
self.Fit()
if wx.Display().GetClientArea().GetWidth() < self.GetSize().GetWidth():
f = self.GetSize().GetWidth() - wx.Display().GetClientArea().GetWidth()
self.printTypeHigh = wx.RadioButton(printTypePanel, -1, 'High quality print')
self.printTypeJoris = wx.RadioButton(printTypePanel, -1, 'Thin walled cup or vase')
- printMaterialPanel = wx.Panel(configPanel)
+ 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'))
sizer.Add(boxsizer, (2,0), flag=wx.EXPAND)
# load and slice buttons.
- loadButton = wx.Button(self, -1, 'Load Model')
- sliceButton = wx.Button(self, -1, 'Prepare print')
- printButton = wx.Button(self, -1, 'Print')
+ 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)
self.printTypeNormal.SetValue(True)
self.printMaterialPLA.SetValue(True)
+ self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CTRL, ord('L'), loadButton.GetId()),
+ (wx.ACCEL_CTRL, ord('R'), sliceButton.GetId()),
+ (wx.ACCEL_CTRL, ord('P'), printButton.GetId())
+ ]))
+
self.Fit()
self.preview3d.Fit()
self.SetMinSize(self.GetSize())
else:\r
alterationContents = ''\r
return unicode(prefix + re.sub("(.)\{([^\}]*)\}", replaceTagMatch, alterationContents).rstrip() + '\n' + postfix).strip().encode('utf-8')\r
+\r
+def getEffectBasePath():\r
+ return os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'post_process'))\r
+\r
+def getEffectsList():\r
+ ret = []\r
+ for filename in glob.glob(os.path.join(getEffectBasePath(), '*.py')):\r
+ filename = os.path.basename(filename)\r
+ if filename.startswith('_'):\r
+ continue\r
+ with open(os.path.join(getEffectBasePath(), filename), "r") as f:\r
+ item = {'name': None, 'info': None, 'params': []}\r
+ for line in f:\r
+ line = line.strip()\r
+ if not line.startswith('#'):\r
+ break\r
+ line = line[1:].split(':', 1)\r
+ if len(line) != 2:\r
+ continue\r
+ if line[0].upper() == 'NAME':\r
+ item['name'] = line[1].strip()\r
+ elif line[0].upper() == 'INFO':\r
+ item['info'] = line[1].strip()\r
+ elif line[0].upper() == 'PARAM':\r
+ m = re.match('([a-zA-Z]*)\(([a-zA-Z_]*)\) +(.*)', line[1].strip())\r
+ if m != None:\r
+ item['params'].append({'name': m.group(1), 'type': m.group(2), 'description': m.group(3)})\r
+ else:\r
+ print "Unknown item in effect meta data: %s %s" % (line[0], line[1])\r
+ if item['name'] != None:\r
+ ret.append(item)\r
+ return ret\r
+\r
+def runPostProcessingEffects(filename):\r
+ pass\r
+ #print "runPostProcessingEffects: %s" % (filename)\r
+ \r
+ #pythonFile = os.path.join(getEffectBasePath(), 'embedImage.py')\r
+ #execfile(pythonFile, {'filename': filename})\r