self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DDKSHADOW))\r
self.SetMinSize((440,320))\r
\r
- self.glCanvas = PreviewGLCanvas(self)\r
self.objectList = []\r
self.errorList = []\r
self.gcode = None\r
self.loadThread = None\r
self.machineSize = util3d.Vector3(profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height'))\r
self.machineCenter = util3d.Vector3(float(profile.getProfileSetting('machine_center_x')), float(profile.getProfileSetting('machine_center_y')), 0)\r
+\r
+ self.glCanvas = PreviewGLCanvas(self)\r
+ #Create the popup window\r
+ self.warningPopup = wx.PopupWindow(self, flags=wx.BORDER_SIMPLE)\r
+ self.warningPopup.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK))\r
+ self.warningPopup.text = wx.StaticText(self.warningPopup, -1, 'Reset scale, rotation and mirror?')\r
+ self.warningPopup.yesButton = wx.Button(self.warningPopup, -1, 'yes', style=wx.BU_EXACTFIT)\r
+ self.warningPopup.noButton = wx.Button(self.warningPopup, -1, 'no', style=wx.BU_EXACTFIT)\r
+ self.warningPopup.sizer = wx.BoxSizer(wx.HORIZONTAL)\r
+ self.warningPopup.SetSizer(self.warningPopup.sizer)\r
+ self.warningPopup.sizer.Add(self.warningPopup.text, 1, flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)\r
+ self.warningPopup.sizer.Add(self.warningPopup.yesButton, 0, flag=wx.EXPAND|wx.ALL, border=1)\r
+ self.warningPopup.sizer.Add(self.warningPopup.noButton, 0, flag=wx.EXPAND|wx.ALL, border=1)\r
+ self.warningPopup.Fit()\r
+ self.warningPopup.Layout()\r
+ self.warningPopup.timer = wx.Timer(self)\r
+ self.Bind(wx.EVT_TIMER, self.OnHideWarning, self.warningPopup.timer)\r
+ \r
+ self.Bind(wx.EVT_BUTTON, self.OnResetAll, self.warningPopup.yesButton)\r
+ self.Bind(wx.EVT_BUTTON, self.OnHideWarning, self.warningPopup.noButton)\r
+ parent.Bind(wx.EVT_MOVE, self.OnMove)\r
+ parent.Bind(wx.EVT_SIZE, self.OnMove)\r
\r
self.toolbar = toolbarUtil.Toolbar(self)\r
\r
sizer.Add(self.toolbar2, 0, flag=wx.EXPAND|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=1)\r
self.SetSizer(sizer)\r
\r
+ def OnMove(self, e):\r
+ e.Skip()\r
+ x, y = self.glCanvas.ClientToScreenXY(0, 0)\r
+ sx, sy = self.glCanvas.GetClientSizeTuple()\r
+ self.warningPopup.SetPosition((x, y+sy-self.warningPopup.GetSize().height))\r
+ \r
def OnMulXAddClick(self, e):\r
profile.putProfileSetting('model_multiply_x', str(max(1, int(profile.getProfileSetting('model_multiply_x'))+1)))\r
self.glCanvas.Refresh()\r
self.glCanvas.viewMode = mode\r
wx.CallAfter(self.glCanvas.Refresh)\r
\r
- def loadModelFiles(self, filelist):\r
+ def loadModelFiles(self, filelist, showWarning = False):\r
while len(filelist) > len(self.objectList):\r
self.objectList.append(previewObject())\r
for idx in xrange(len(filelist), len(self.objectList)):\r
self.loadThread = threading.Thread(target=self.doFileLoadThread)\r
self.loadThread.daemon = True\r
self.loadThread.start()\r
+ \r
+ if showWarning:\r
+ if profile.getProfileSettingFloat('model_scale') != 1.0 or profile.getProfileSettingFloat('model_rotate_base') != 0 or profile.getProfileSetting('flip_x') != 'False' or profile.getProfileSetting('flip_y') != 'False' or profile.getProfileSetting('flip_z') != 'False' or profile.getProfileSetting('swap_xz') != 'False' or profile.getProfileSetting('swap_yz') != 'False':\r
+ self.warningPopup.Show(True)\r
+ self.warningPopup.timer.Start(5000)\r
\r
def loadReModelFiles(self, filelist):\r
#Only load this again if the filename matches the file we have already loaded (for auto loading GCode after slicing)\r
\r
def loadProgress(self, progress):\r
pass\r
- \r
+\r
+ def OnResetAll(self, e):\r
+ profile.putProfileSetting('model_scale', '1.0')\r
+ profile.putProfileSetting('model_rotate_base', '0')\r
+ profile.putProfileSetting('flip_x', 'False')\r
+ profile.putProfileSetting('flip_y', 'False')\r
+ profile.putProfileSetting('flip_z', 'False')\r
+ profile.putProfileSetting('swap_xz', 'False')\r
+ profile.putProfileSetting('swap_yz', 'False')\r
+ self.updateProfileToControls()\r
+ self.warningPopup.Show(False)\r
+ self.warningPopup.timer.Stop()\r
+\r
+ def OnHideWarning(self, e):\r
+ self.warningPopup.Show(False)\r
+ self.warningPopup.timer.Stop()\r
+\r
def updateToolbar(self):\r
self.gcodeViewButton.Show(self.gcode != None)\r
self.mixedViewButton.Show(self.gcode != None)\r
#Workaround for windows background redraw flicker.\r
pass\r
\r
- def OnSize(self,event):\r
+ def OnSize(self,e):\r
self.Refresh()\r
\r
- def OnPaint(self,event):\r
+ def OnPaint(self,e):\r
dc = wx.PaintDC(self)\r
if not hasOpenGLlibs:\r
dc.Clear()\r