Fixed windows tooltip bug

Fixed SerialExeception import bug
Possibly fixed MacOS layout bug`
This commit is contained in:
Daid 2012-03-09 15:47:39 +01:00
parent 2cba5e4183
commit 51766df22f
4 changed files with 18 additions and 21 deletions

View File

@ -1,6 +1,7 @@
import os, struct, sys, time
from serial import Serial
from serial import SerialException
import ispBase, intelHex
@ -15,7 +16,7 @@ class Stk500v2(ispBase.IspBase):
self.close()
try:
self.serial = Serial(port, speed, timeout=1)
except Serial.SerialException as e:
except SerialException as e:
raise ispBase.IspError("Failed to open serial port")
self.seq = 1

View File

@ -50,16 +50,8 @@ class configWindowBase(wx.Frame):
return leftConfigPanel, rightConfigPanel, configPanel
def OnPopupDisplay(self, setting):
x, y = setting.ctrl.ClientToScreenXY(0, 0)
sx, sy = setting.ctrl.GetSizeTuple()
#if platform.system() == "Windows":
# for some reason, under windows, the popup is relative to the main window... in some cases. (Wierd ass bug)
# wx, wy = self.ClientToScreenXY(0, 0)
# x -= wx
# y -= wy
self.popup.setting = setting
self.UpdatePopup(setting)
self.popup.SetPosition((x, y+sy))
self.popup.Show(True)
def OnPopupHide(self, e):
@ -73,6 +65,14 @@ class configWindowBase(wx.Frame):
self.popup.text.SetLabel(setting.helpText)
self.popup.text.Wrap(350)
self.popup.Fit()
x, y = setting.ctrl.ClientToScreenXY(0, 0)
sx, sy = setting.ctrl.GetSizeTuple()
#if platform.system() == "Windows":
# for some reason, under windows, the popup is relative to the main window... in some cases. (Wierd ass bug)
# wx, wy = self.ClientToScreenXY(0, 0)
# x -= wx
# y -= wy
self.popup.SetPosition((x, y+sy))
def updateProfileToControls(self):
"Update the configuration wx controls to show the new configuration settings"
@ -88,8 +88,8 @@ class TitleRow():
sizer = panel.GetSizer()
self.title = wx.StaticText(panel, -1, name)
self.title.SetFont(wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
sizer.Add(self.title, (sizer.GetRows(),sizer.GetCols()), (1,3), flag=wx.EXPAND)
sizer.Add(wx.StaticLine(panel), (sizer.GetRows()+1,sizer.GetCols()), (1,3), flag=wx.EXPAND)
sizer.Add(self.title, (sizer.GetRows(),0), (1,3), flag=wx.EXPAND)
sizer.Add(wx.StaticLine(panel), (sizer.GetRows()+1,0), (1,3), flag=wx.EXPAND)
sizer.SetRows(sizer.GetRows() + 2)
class SettingRow():
@ -97,7 +97,7 @@ class SettingRow():
"Add a setting to the configuration panel"
sizer = panel.GetSizer()
x = sizer.GetRows()
y = sizer.GetCols()
y = 0
self.validators = []
self.validationMsg = ''
@ -169,6 +169,7 @@ class SettingRow():
self.ctrl.SetValue(value)
#Settings notify works as a validator, but instead of validating anything, it calls another function, which can use the value.
# A bit hacky, bit it works.
class settingNotify():
def __init__(self, setting, func):
self.setting = setting
@ -183,4 +184,3 @@ class settingNotify():
except ValueError:
self.func()
return validators.SUCCESS, ''

View File

@ -110,9 +110,9 @@ class FirmwareUpgradePage(InfoPage):
self.AddText('The firmware shipping with new Ultimakers works, but upgrades\nhave been made to make better prints, and make calibration easier.')
self.AddHiddenSeperator()
self.AddText('SkeinPyPy requires these new features and thus\nyour firmware will most likely need to be upgraded.\nYou will get the chance to do so now.')
b1, b2 = self.AddDualButton('Upgrade firmware', 'Skip upgrade')
b1.Bind(wx.EVT_BUTTON, self.OnUpgradeClick)
b2.Bind(wx.EVT_BUTTON, self.OnSkipClick)
upgradeButton, skipUpgradeButton = self.AddDualButton('Upgrade to Marlin firmware', 'Skip upgrade')
upgradeButton.Bind(wx.EVT_BUTTON, self.OnUpgradeClick)
skipUpgradeButton.Bind(wx.EVT_BUTTON, self.OnSkipClick)
self.AddHiddenSeperator()
self.AddText('Do not upgrade to this firmware if:')
self.AddText('* You have an older machine based on ATMega1280')

View File

@ -117,9 +117,6 @@ class mainWindow(configBase.configWindowBase):
c = configBase.SettingRow(left, "Machine center Y (mm)", 'machine_center_y', '100', 'The center of your machine, your print will be placed at this location')
validators.validInt(c, 10)
configBase.settingNotify(c, self.preview3d.updateCenterY)
#self.AddSetting(left, "Width (mm)", settings.IntSpin().getFromValue(10, "machine_width", None, 1000, 205))
#self.AddSetting(left, "Depth (mm)", settings.IntSpin().getFromValue(10, "machine_depth", None, 1000, 205))
#self.AddSetting(left, "Height (mm)", settings.IntSpin().getFromValue(10, "machine_height", None, 1000, 200))
configBase.TitleRow(left, "Machine nozzle")
c = configBase.SettingRow(left, "Nozzle size (mm)", 'nozzle_size', '0.4', 'The nozzle size is very important, this is used to calculate the line width of the infill, and used to calculate the amount of outside wall lines and thickness for the wall thickness you entered in the print settings.')
@ -147,7 +144,6 @@ class mainWindow(configBase.configWindowBase):
validators.validFloat(c, 0.0)
configBase.TitleRow(right, "Cool")
#c = SettingRow(right, "Cool type", self.plugins['cool'].preferencesDict['Cool_Type'])
c = configBase.SettingRow(right, "Minimal layer time (sec)", 'cool_min_layer_time', '10', 'Minimum time spend in a layer, gives the layer time to cool down before the next layer is put on top. If the layer will be placed down too fast the printer will slow down to make sure it has spend atleast this amount of seconds printing this layer.')
validators.validFloat(c, 0.0)
@ -183,7 +179,7 @@ class mainWindow(configBase.configWindowBase):
sizer.Add(self.preview3d, (0,1), span=(1,3), flag=wx.EXPAND)
sizer.AddGrowableCol(2)
sizer.AddGrowableRow(0)
sizer.Add(loadButton, (1,1))
sizer.Add(loadButton, (1,1), flag=wx.RIGHT, border=5)
sizer.Add(sliceButton, (1,2))
self.sizer = sizer