def onLanguageComboChanged(self, event): if profile.getPreference( 'language') is not self.languageCombo.GetValue(): profile.putPreference('language', self.languageCombo.GetValue()) wx.MessageBox( _("You have to restart the application to make the changes effective." ), 'Info', wx.OK | wx.ICON_INFORMATION)
def updateStatus(self, status): if status: self.driver.board.setUnplugCallback( lambda: wx.CallAfter(self.parent.onBoardUnplugged)) self.driver.camera.setUnplugCallback( lambda: wx.CallAfter(self.parent.onCameraUnplugged)) #if profile.getPreference('workbench') != 'Calibration workbench': profile.putPreference('workbench', 'Calibration workbench') self.GetParent().parent.workbenchUpdate(False) self.videoView.play() self.connectButton.Disable() self.autoCheckButton.Enable() self.patternLabel.Enable() self.imageView.Enable() self.skipButton.Enable() self.enableNext = True self.driver.board.setLeftLaserOff() self.driver.board.setRightLaserOff() else: self.videoView.stop() self.gauge.SetValue(0) self.gauge.Show() self.resultLabel.Hide() self.resultLabel.SetLabel("") self.connectButton.Enable() self.skipButton.Disable() self.nextButton.Disable() self.enableNext = False self.autoCheckButton.Disable() self.Layout()
def onButtonPressed(self, event): button = event.GetEventObject() profile.putPreference('workbench', 'Scanning workbench') self.GetParent().GetParent().parent.workbenchUpdate() self.GetParent().GetParent().parent.appendLastFile(button.GetName()) self.GetParent().GetParent().parent.scanningWorkbench.sceneView.loadFile(button.GetName()) self.GetParent().GetParent().Close()
def onScanningVideoSceneClicked(self, event): checkedVideo = self.menuScanningVideo.IsChecked() checkedScene = self.menuScanningScene.IsChecked() profile.putPreference('view_scanning_video', checkedVideo) profile.putPreference('view_scanning_scene', checkedScene) self.scanningWorkbench.splitterWindow.Unsplit() if checkedVideo: self.scanningWorkbench.videoView.Show() self.scanningWorkbench.splitterWindow.SplitVertically(self.scanningWorkbench.videoView, self.scanningWorkbench.scenePanel) if checkedScene: self.scanningWorkbench.scenePanel.Show() else: self.scanningWorkbench.scenePanel.Hide() self.scanningWorkbench.splitterWindow.Unsplit() else: self.scanningWorkbench.videoView.Hide() if checkedScene: self.scanningWorkbench.scenePanel.Show() self.scanningWorkbench.splitterWindow.SplitVertically(self.scanningWorkbench.scenePanel, self.scanningWorkbench.videoView) self.scanningWorkbench.splitterWindow.Unsplit() else: self.scanningWorkbench.scenePanel.Hide() self.scanningWorkbench.splitterWindow.Unsplit() self.scanningWorkbench.splitterWindow.Layout() self.scanningWorkbench.Layout() self.Layout()
def updateStatus(self, status): if status: self.driver.board.setUnplugCallback(lambda: wx.CallAfter(self.parent.onBoardUnplugged)) self.driver.camera.setUnplugCallback(lambda: wx.CallAfter(self.parent.onCameraUnplugged)) #if profile.getPreference('workbench') != 'Calibration workbench': profile.putPreference('workbench', 'Calibration workbench') self.GetParent().parent.workbenchUpdate(False) self.videoView.play() self.connectButton.Disable() self.autoCheckButton.Enable() self.patternLabel.Enable() self.imageView.Enable() self.skipButton.Enable() self.enableNext = True self.driver.board.setLeftLaserOff() self.driver.board.setRightLaserOff() else: self.videoView.stop() self.gauge.SetValue(0) self.gauge.Show() self.resultLabel.Hide() self.resultLabel.SetLabel("") self.connectButton.Enable() self.skipButton.Disable() self.nextButton.Disable() self.enableNext = False self.autoCheckButton.Disable() self.Layout()
def appendLastFile(self, lastFile): if lastFile in self.lastFiles: self.lastFiles.remove(lastFile) self.lastFiles.append(lastFile) if len(self.lastFiles) > 4: self.lastFiles = self.lastFiles[1:5] profile.putPreference('last_file', lastFile) profile.putPreference('last_files', self.lastFiles)
def onMenuViewClicked(self, key, checked, panel): profile.putPreference(key, checked) if checked: panel.Show() else: panel.Hide() panel.GetParent().Layout() panel.Layout() self.Layout()
def onComboBoxWorkbenchSelected(self, event): """ """ if _(profile.getPreference( 'workbench')) != event.GetEventObject().GetValue(): profile.putPreference( 'workbench', self.workbenchDict[event.GetEventObject().GetValue()]) profile.saveProfile( os.path.join(profile.getBasePath(), 'current-profile.ini')) self.workbenchUpdate()
def onComboBoxWorkbenchSelected(self, event): """ """ currentWorkbench = profile.getPreference('workbench') for key in self.workbenchList: if self.workbenchList[key] == str( event.GetEventObject().GetValue()): if key is not None: profile.putPreference('workbench', key) if key != currentWorkbench: profile.saveProfile( os.path.join(profile.getBasePath(), 'current-profile.ini')) self.workbenchUpdate()
def onExit(self): self.driver.board.setLeftLaserOff() self.driver.board.setRightLaserOff() profile.putPreference('workbench', self.currentWorkbench) dlg = wx.MessageDialog(self, _("Do you really want to exit?"), _("Exit wizard"), wx.OK | wx.CANCEL |wx.ICON_INFORMATION) result = dlg.ShowModal() == wx.ID_OK dlg.Destroy() if result: self.connectionPage.videoView.stop() self.calibrationPage.videoView.stop() self.scanningPage.videoView.stop() self.parent.workbenchUpdate() self.Destroy()
def onExit(self): self.driver.board.setLeftLaserOff() self.driver.board.setRightLaserOff() profile.putPreference('workbench', self.currentWorkbench) dlg = wx.MessageDialog(self, _("Do you really want to exit?"), _("Exit wizard"), wx.OK | wx.CANCEL | wx.ICON_INFORMATION) result = dlg.ShowModal() == wx.ID_OK dlg.Destroy() if result: self.connectionPage.videoView.stop() self.calibrationPage.videoView.stop() self.scanningPage.videoView.stop() self.parent.workbenchUpdate() self.Destroy()
def updateStatus(self, status): if status: if profile.getPreference('workbench') != 'calibration': profile.putPreference('workbench', 'calibration') self.GetParent().parent.workbenchUpdate(False) self.videoView.play() self.calibrateButton.Enable() self.driver.board.setLeftLaserOff() self.driver.board.setRightLaserOff() else: self.videoView.stop() self.gauge.SetValue(0) self.gauge.Show() self.prevButton.Enable() self.calibrateButton.Disable() self.cancelButton.Disable()
def onScanningPageNextClicked(self): self.driver.board.setLeftLaserOff() self.driver.board.setRightLaserOff() profile.saveProfile(os.path.join(profile.getBasePath(), 'current-profile.ini')) dlg = wx.MessageDialog(self, _("You have finished the wizard.\nPress Play button to start scanning."), _("Ready to scan!"), wx.OK | wx.ICON_INFORMATION) result = dlg.ShowModal() == wx.ID_OK dlg.Destroy() if result: self.connectionPage.videoView.stop() self.calibrationPage.videoView.stop() self.scanningPage.videoView.stop() profile.putPreference('workbench', 'Scanning workbench') self.parent.updatePCGProfile() self.parent.updateCalibrationProfile() self.parent.workbenchUpdate() self.Destroy()
def updateStatus(self, status): if status: profile.putPreference('workbench', 'scanning') self.GetParent().parent.workbenchUpdate(False) self.videoView.play() value = profile.getProfileSetting('use_laser') if value == _("Use Left Laser"): self.driver.board.setLeftLaserOn() self.driver.board.setRightLaserOff() elif value == _("Use Right Laser"): self.driver.board.setLeftLaserOff() self.driver.board.setRightLaserOn() elif value == _("Use Both Laser"): self.driver.board.setLeftLaserOn() self.driver.board.setRightLaserOn() else: self.videoView.stop()
def updateStatus(self, status): if status: profile.putPreference('workbench', 'Scanning workbench') self.GetParent().parent.workbenchUpdate(False) self.videoView.play() value = profile.getProfileSetting('use_laser') if value == 'Left': self.driver.board.setLeftLaserOn() self.driver.board.setRightLaserOff() elif value == 'Right': self.driver.board.setLeftLaserOff() self.driver.board.setRightLaserOn() elif value == 'Both': self.driver.board.setLeftLaserOn() self.driver.board.setRightLaserOn() else: self.videoView.stop()
def updateStatus(self, status): if status: if profile.getPreference('workbench') != 'Calibration workbench': profile.putPreference('workbench', 'Calibration workbench') self.GetParent().parent.workbenchUpdate(False) self.videoView.play() self.calibrateButton.Enable() self.skipButton.Enable() self.driver.board.setLeftLaserOff() self.driver.board.setRightLaserOff() else: self.videoView.stop() self.gauge.SetValue(0) self.gauge.Show() self.prevButton.Enable() self.skipButton.Disable() self.nextButton.Disable() self.calibrateButton.Disable() self.cancelButton.Disable()
def onScanningPageNextClicked(self): self.driver.board.setLeftLaserOff() self.driver.board.setRightLaserOff() profile.saveProfile( os.path.join(profile.getBasePath(), 'current-profile.ini')) dlg = wx.MessageDialog( self, _("You have finished the wizard.\nPress Play button to start scanning." ), _("Ready to scan!"), wx.OK | wx.ICON_INFORMATION) result = dlg.ShowModal() == wx.ID_OK dlg.Destroy() if result: self.connectionPage.videoView.stop() self.calibrationPage.videoView.stop() self.scanningPage.videoView.stop() profile.putPreference('workbench', 'Scanning workbench') self.parent.updatePCGProfile() self.parent.updateCalibrationProfile() self.parent.workbenchUpdate() self.Destroy()
def onAdvancedCalibration(self, event): profile.putPreference('workbench', 'Calibration workbench') self.GetParent().GetParent().parent.workbenchUpdate() self.GetParent().GetParent().Close()
def onAdvancedControl(self, event): profile.putPreference('workbench', 'Control workbench') self.GetParent().GetParent().parent.workbenchUpdate() self.GetParent().GetParent().Close()
def onScan(self, event): profile.putPreference('workbench', 'Scanning workbench') self.GetParent().GetParent().parent.workbenchUpdate() self.GetParent().GetParent().Close()
def onLanguageComboChanged(self, event): if profile.getPreference('language') is not self.languageCombo.GetValue(): profile.putPreference('language', self.languageCombo.GetValue()) wx.MessageBox(_("You have to restart the application to make the changes effective."), 'Info', wx.OK | wx.ICON_INFORMATION)
def onCheckBoxChanged(self, event): profile.putPreference('show_welcome', not event.Checked())
def onAdvancedCalibration(self, event): profile.putPreference('workbench', 'calibration') self.GetParent().GetParent().parent.workbenchUpdate() self.GetParent().GetParent().Close()
def onAdvancedControl(self, event): profile.putPreference('workbench', 'control') self.GetParent().GetParent().parent.workbenchUpdate() self.GetParent().GetParent().Close()
def onModeChanged(self, event): profile.putPreference('basic_mode', self.menuBasicMode.IsChecked()) self.controlWorkbench.updateProfileToAllControls() self.calibrationWorkbench.updateProfileToAllControls() self.scanningWorkbench.updateProfileToAllControls() self.Layout()
def onScan(self, event): profile.putPreference('workbench', 'scanning') self.GetParent().GetParent().parent.workbenchUpdate() self.GetParent().GetParent().Close()
def onComboBoxWorkbenchSelected(self, event): """ """ if _(profile.getPreference('workbench')) != event.GetEventObject().GetValue(): profile.putPreference('workbench', self.workbenchDict[event.GetEventObject().GetValue()]) profile.saveProfile(os.path.join(profile.getBasePath(), 'current-profile.ini')) self.workbenchUpdate()