Esempio n. 1
0
    def afterLaserCalibration(self, response):
        self.phase = 'platformCalibration'
        ret, result = response

        if ret:
            profile.putProfileSetting('distance_left', result[0][0])
            profile.putProfileSettingNumpy('normal_left', result[0][1])
            profile.putProfileSetting('distance_right', result[1][0])
            profile.putProfileSettingNumpy('normal_right', result[1][1])
            self.platformExtrinsics.setCallbacks(
                None,
                lambda p: wx.CallAfter(self.progressPlatformCalibration, p),
                lambda r: wx.CallAfter(self.afterPlatformCalibration, r))
            self.platformExtrinsics.start()
        else:
            if result == Error.CalibrationError:
                self.resultLabel.SetLabel(
                    _("Error in lasers: please connect the lasers and try again"
                      ))
                dlg = wx.MessageDialog(
                    self, _("Laser Calibration failed. Please try again"),
                    _(result), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                self.skipButton.Enable()
                self.onFinishCalibration()
Esempio n. 2
0
	def onScanTypeComboBoxChanged(self, event):
		value = self.scanTypeDict[event.GetEventObject().GetValue()]
		profile.putProfileSetting('scan_type', value)
		if value == 'Simple Scan':
			self.driver.camera.setExposure(profile.getProfileSettingInteger('laser_exposure_scanning'))
		elif value == 'Texture Scan':
			self.driver.camera.setExposure(profile.getProfileSettingInteger('color_exposure_scanning'))
Esempio n. 3
0
	def onTextBoxChanged(self, event):
		self.undoValues.append(profile.getProfileSetting(self.name))
		value = self.control.GetValue()
		profile.putProfileSetting(self.name, value)
		self._updateEngine(value)
		if self.appendUndoCallback is not None:
			self.appendUndoCallback(self)
		if self.releaseUndoCallback is not None:
			self.releaseUndoCallback()
Esempio n. 4
0
 def onScanTypeComboBoxChanged(self, event):
     value = self.scanTypeDict[event.GetEventObject().GetValue()]
     profile.putProfileSetting('scan_type', value)
     if value == 'Simple Scan':
         self.driver.camera.setExposure(
             profile.getProfileSettingInteger('laser_exposure_scanning'))
     elif value == 'Texture Scan':
         self.driver.camera.setExposure(
             profile.getProfileSettingInteger('color_exposure_scanning'))
Esempio n. 5
0
	def onTextBoxChanged(self, event):
		self.undoValues.append(profile.getProfileSetting(self.name))
		value = self.control.GetValue()
		profile.putProfileSetting(self.name, value)
		self._updateEngine(value)
		if self.appendUndoCallback is not None:
			self.appendUndoCallback(self)
		if self.releaseUndoCallback is not None:
			self.releaseUndoCallback()
Esempio n. 6
0
	def onSliderTracked(self, event):
		if self.flagFirstMove:
			value = profile.getProfileSettingInteger(self.name)
			self.undoValues.append(value)
			if self.appendUndoCallback is not None:
				self.appendUndoCallback(self)
			self.flagFirstMove = False
		value = self.control.GetValue()
		profile.putProfileSetting(self.name, value)
		self._updateEngine(value)
Esempio n. 7
0
    def onComboBoVideoViewsSelect(self, event):
        selectedView = {
            _("Laser"): 'laser',
            _("Gray"): 'gray',
            _("Line"): 'line',
            _("Color"): 'color'
        }.get(self.comboVideoViews.GetValue())

        self.currentScan.setImageType(selectedView)
        profile.putProfileSetting('img_type', selectedView)
Esempio n. 8
0
	def onSliderTracked(self, event):
		if self.flagFirstMove:
			value = profile.getProfileSettingInteger(self.name)
			self.undoValues.append(value)
			if self.appendUndoCallback is not None:
				self.appendUndoCallback(self)
			self.flagFirstMove = False
		value = self.control.GetValue()
		profile.putProfileSetting(self.name, value)
		self._updateEngine(value)
Esempio n. 9
0
 def onResolutionComboBoxChanged(self, event):
     value = event.GetEventObject().GetValue()
     if value == _("High"):
         value = -0.45
     elif value == _("Medium"):
         value = -0.9
     elif value == _("Low"):
         value = -1.8
     profile.putProfileSetting('step_degrees_scanning', value)
     self.pcg.setDegrees(value)
Esempio n. 10
0
 def onColorPicker(self):
     data = wx.ColourData()
     data.SetColour(self.simpleScan.color)
     dialog = wx.ColourDialog(self, data)
     dialog.GetColourData().SetChooseFull(True)
     if dialog.ShowModal() == wx.ID_OK:
         data = dialog.GetColourData()
         color = data.GetColour().Get()
         self.simpleScan.setColor(color)
         profile.putProfileSetting('point_cloud_color', "".join(map(chr, color)).encode('hex'))
     dialog.Destroy()
Esempio n. 11
0
 def onColorPicker(self):
     data = wx.ColourData()
     data.SetColour(self.simpleScan.color)
     dialog = wx.ColourDialog(self, data)
     dialog.GetColourData().SetChooseFull(True)
     if dialog.ShowModal() == wx.ID_OK:
         data = dialog.GetColourData()
         color = data.GetColour().Get()
         self.simpleScan.setColor(color)
         profile.putProfileSetting('point_cloud_color', "".join(map(chr, color)).encode('hex'))
     dialog.Destroy()
Esempio n. 12
0
    def setPatternDistance(self, patternDistance):
        profile.putProfileSetting('pattern_distance', patternDistance)

        patternRows = profile.getProfileSettingInteger('pattern_rows')
        patternColumns = profile.getProfileSettingInteger('pattern_columns')
        squareWidth = profile.getProfileSettingInteger('square_width')

        self.cameraIntrinsics.setPatternParameters(patternRows, patternColumns, squareWidth, patternDistance)
        self.simpleLaserTriangulation.setPatternParameters(patternRows, patternColumns, squareWidth, patternDistance)
        self.laserTriangulation.setPatternParameters(patternRows, patternColumns, squareWidth, patternDistance)
        self.platformExtrinsics.setPatternParameters(patternRows, patternColumns, squareWidth, patternDistance)
Esempio n. 13
0
	def onResolutionComboBoxChanged(self, event):
		value = event.GetEventObject().GetValue()
		if value ==_("High"):
			value = -0.45
		elif value ==_("Medium"):
			value = -0.9
		elif value ==_("Low"):
			value = -1.8

		profile.putProfileSetting('step_degrees_scanning', value)
		self.pcg.setDegrees(value)
Esempio n. 14
0
    def setPatternDistance(self, patternDistance):
        profile.putProfileSetting('pattern_distance', patternDistance)

        patternRows = profile.getProfileSettingInteger('pattern_rows')
        patternColumns = profile.getProfileSettingInteger('pattern_columns')
        squareWidth = profile.getProfileSettingInteger('square_width')

        self.cameraIntrinsics.setPatternParameters(patternRows, patternColumns, squareWidth, patternDistance)
        self.simpleLaserTriangulation.setPatternParameters(patternRows, patternColumns, squareWidth, patternDistance)
        self.laserTriangulation.setPatternParameters(patternRows, patternColumns, squareWidth, patternDistance)
        self.platformExtrinsics.setPatternParameters(patternRows, patternColumns, squareWidth, patternDistance)
Esempio n. 15
0
	def onSlider(self, event):
		value = profile.getProfileSettingInteger(self.name)
		self.undoValues.append(value)

		if self.appendUndoCallback is not None:
			self.appendUndoCallback(self)

		value = self.control.GetValue()
		profile.putProfileSetting(self.name, value)
		self._updateEngine(value)

		if self.releaseUndoCallback is not None:
			self.releaseUndoCallback()
Esempio n. 16
0
	def onSlider(self, event):
		value = profile.getProfileSettingInteger(self.name)
		self.undoValues.append(value)

		if self.appendUndoCallback is not None:
			self.appendUndoCallback(self)

		value = self.control.GetValue()
		profile.putProfileSetting(self.name, value)
		self._updateEngine(value)

		if self.releaseUndoCallback is not None:
			self.releaseUndoCallback()
Esempio n. 17
0
    def onLaserComboBoxChanged(self, event):
        value = self.laserDict[event.GetEventObject().GetValue()]
        profile.putProfileSetting('use_laser', value)
        useLeft = value == 'Left' or value == 'Both'
        useRight = value == 'Right' or value == 'Both'
        if useLeft:
            self.driver.board.setLeftLaserOn()
        else:
            self.driver.board.setLeftLaserOff()

        if useRight:
            self.driver.board.setRightLaserOn()
        else:
            self.driver.board.setRightLaserOff()
        self.pcg.setUseLaser(useLeft, useRight)
Esempio n. 18
0
	def onLaserComboBoxChanged(self, event):
		value = self.laserDict[event.GetEventObject().GetValue()]
		profile.putProfileSetting('use_laser', value)
		useLeft = value == 'Left' or value == 'Both'
		useRight = value == 'Right' or value == 'Both'
		if useLeft:
			self.driver.board.setLeftLaserOn()
		else:
			self.driver.board.setLeftLaserOff()

		if useRight:
			self.driver.board.setRightLaserOn()
		else:
			self.driver.board.setRightLaserOff()
		self.pcg.setUseLaser(useLeft, useRight)
Esempio n. 19
0
    def onLaserComboBoxChanged(self, event):
        value = event.GetEventObject().GetValue()
        profile.putProfileSetting('use_laser', value)
        useLeft = value == _("Use Left Laser") or value == _("Use Both Laser")
        useRight = value == _("Use Right Laser") or value == _(
            "Use Both Laser")
        if useLeft:
            self.driver.board.setLeftLaserOn()
        else:
            self.driver.board.setLeftLaserOff()

        if useRight:
            self.driver.board.setRightLaserOn()
        else:
            self.driver.board.setRightLaserOff()
        self.pcg.setUseLaser(useLeft, useRight)
Esempio n. 20
0
    def onAutoCheckButtonClicked(self, event):
        if profile.getProfileSettingBool('adjust_laser'):
            profile.putProfileSetting('adjust_laser', False)
            dlg = wx.MessageDialog(self, _("It is recomended to adjust line lasers vertically.\nYou need to use the allen wrench.\nDo you want to adjust it now?"), _("Manual laser adjustment"), wx.YES_NO | wx.ICON_QUESTION)
            result = dlg.ShowModal() == wx.ID_YES
            dlg.Destroy()
            if result:
                self.driver.board.setLeftLaserOn()
                self.driver.board.setRightLaserOn()
        else:
            self.beforeAutoCheck()

            #-- Perform auto check
            self.autoCheck.setCallbacks(None,
                                        lambda p: wx.CallAfter(self.progressAutoCheck,p),
                                        lambda r: wx.CallAfter(self.afterAutoCheck,r))
            self.autoCheck.start()
Esempio n. 21
0
    def onAutoCheckButtonClicked(self, event):
        if profile.getProfileSettingBool('adjust_laser'):
            profile.putProfileSetting('adjust_laser', False)
            dlg = wx.MessageDialog(self, _("It is recomended to adjust line lasers vertically.\nYou need to use the allen wrench.\nDo you want to adjust it now?"), _("Manual laser adjustment"), wx.YES_NO | wx.ICON_QUESTION)
            result = dlg.ShowModal() == wx.ID_YES
            dlg.Destroy()
            if result:
                self.driver.board.setLeftLaserOn()
                self.driver.board.setRightLaserOn()
        else:
            self.beforeAutoCheck()

            #-- Perform auto check
            self.autoCheck.setCallbacks(None,
                                        lambda p: wx.CallAfter(self.progressAutoCheck,p),
                                        lambda r: wx.CallAfter(self.afterAutoCheck,r))
            self.autoCheck.start()
Esempio n. 22
0
	def onLuminosityComboBoxChanged(self, event):
		value = event.GetEventObject().GetValue()
		profile.putProfileSetting('luminosity', value)
		if value ==_("Low Luminosity"):
			value = 32
		elif value ==_("Medium Luminosity"):
			value = 16
		elif value ==_("High Luminosity"):
			value = 8
		profile.putProfileSetting('exposure_control', value)
		profile.putProfileSetting('exposure_calibration', value)
		profile.putProfileSetting('exposure_scanning', value)
		self.driver.camera.setExposure(value)
Esempio n. 23
0
	def afterLaserCalibration(self, response):
		self.phase='platformCalibration'
		ret, result = response

		if ret:
			profile.putProfileSetting('distance_left', result[0][0])
			profile.putProfileSettingNumpy('normal_left', result[0][1])
			profile.putProfileSetting('distance_right', result[1][0])
			profile.putProfileSettingNumpy('normal_right', result[1][1])
			self.platformExtrinsics.setCallbacks(None,
												 lambda p: wx.CallAfter(self.progressPlatformCalibration,p),
												 lambda r: wx.CallAfter(self.afterPlatformCalibration,r))
			self.platformExtrinsics.start()
		else:
			if result == Error.CalibrationError:
				self.resultLabel.SetLabel(_("Error in lasers: please connect the lasers and try again"))
				dlg = wx.MessageDialog(self, _("Laser Calibration failed. Please try again"), _(result), wx.OK|wx.ICON_ERROR)
				dlg.ShowModal()
				dlg.Destroy()
				self.skipButton.Enable()
				self.onFinishCalibration()
Esempio n. 24
0
    def setLuminosity(self, luminosity):
        profile.putProfileSetting('luminosity', luminosity)
        
        if luminosity =='Low':
            luminosity = 32
        elif luminosity =='Medium':
            luminosity = 16
        elif luminosity =='High':
            luminosity = 8
        profile.putProfileSetting('exposure_control', luminosity)
        profile.putProfileSetting('exposure_calibration', luminosity)

        self.driver.camera.setExposure(luminosity)
Esempio n. 25
0
    def setLuminosity(self, luminosity):
        profile.putProfileSetting('luminosity', luminosity)

        if luminosity == 'Low':
            luminosity = 32
        elif luminosity == 'Medium':
            luminosity = 16
        elif luminosity == 'High':
            luminosity = 8
        profile.putProfileSetting('exposure_control', luminosity)
        profile.putProfileSetting('exposure_calibration', luminosity)

        self.driver.camera.setExposure(luminosity)
Esempio n. 26
0
	def onSerialNameTextChanged(self, event):
		if len(self.serialNameCombo.GetValue()):
			profile.putProfileSetting('serial_name', self.serialNameCombo.GetValue())
Esempio n. 27
0
	def undo(self):
		if len(self.undoValues) > 0:
			value = self.undoValues.pop()
			profile.putProfileSetting(self.name, value)
			self.update(value)
Esempio n. 28
0
	def onBaudRateTextChanged(self, event):
		if self.baudRateCombo.GetValue() in self.baudRates:
			profile.putProfileSetting('baud_rate', int(self.baudRateCombo.GetValue()))
Esempio n. 29
0
	def onComboBoxChanged(self, event):
		value = self.keyDict[self.control.GetValue()]
		profile.putProfileSetting(self.name, value)
		self._updateEngine(value)
Esempio n. 30
0
    def __init__(self):
        super(MainWindow,
              self).__init__(None,
                             title=_("Horus " + VERSION + " - Beta"),
                             size=self.size)

        self.SetMinSize((600, 450))

        ###-- Initialize Engine
        self.driver = Driver.Instance()
        self.simpleScan = scan.SimpleScan.Instance()
        self.textureScan = scan.TextureScan.Instance()
        self.pcg = scan.PointCloudGenerator.Instance()
        self.cameraIntrinsics = calibration.CameraIntrinsics.Instance()
        self.simpleLaserTriangulation = calibration.SimpleLaserTriangulation.Instance(
        )
        self.laserTriangulation = calibration.LaserTriangulation.Instance()
        self.platformExtrinsics = calibration.PlatformExtrinsics.Instance()

        #-- Serial Name initialization
        serialList = self.serialList()
        currentSerial = profile.getProfileSetting('serial_name')
        if len(serialList) > 0:
            if currentSerial not in serialList:
                profile.putProfileSetting('serial_name', serialList[0])

        #-- Video Id initialization
        videoList = self.videoList()
        currentVideoId = profile.getProfileSetting('camera_id')
        if len(videoList) > 0:
            if currentVideoId not in videoList:
                profile.putProfileSetting('camera_id', videoList[0])

        self.workbenchList = {
            'control': _("Control workbench"),
            'calibration': _("Calibration workbench"),
            'scanning': _("Scanning workbench")
        }

        self.lastFiles = eval(profile.getPreference('last_files'))

        print ">>> Horus " + VERSION + " <<<"

        ###-- Initialize GUI

        ##-- Set Icon
        icon = wx.Icon(resources.getPathForImage("horus.ico"),
                       wx.BITMAP_TYPE_ICO)
        self.SetIcon(icon)

        ##-- Status Bar
        #self.CreateStatusBar()

        ##-- Menu Bar
        self.menuBar = wx.MenuBar()

        #--  Menu File
        self.menuFile = wx.Menu()
        self.menuLaunchWizard = self.menuFile.Append(wx.NewId(),
                                                     _("Launch Wizard"))
        self.menuFile.AppendSeparator()
        self.menuLoadModel = self.menuFile.Append(wx.NewId(), _("Load Model"))
        self.menuSaveModel = self.menuFile.Append(wx.NewId(), _("Save Model"))
        self.menuClearModel = self.menuFile.Append(wx.NewId(),
                                                   _("Clear Model"))
        self.menuFile.AppendSeparator()
        self.menuOpenProfile = self.menuFile.Append(wx.NewId(),
                                                    _("Open Profile"),
                                                    _("Opens Profile .ini"))
        self.menuSaveProfile = self.menuFile.Append(wx.NewId(),
                                                    _("Save Profile"))
        self.menuResetProfile = self.menuFile.Append(wx.NewId(),
                                                     _("Reset Profile"))
        self.menuFile.AppendSeparator()
        menuExit = self.menuFile.Append(wx.ID_EXIT, _("Exit"))
        self.menuBar.Append(self.menuFile, _("File"))

        #-- Menu Edit
        self.menuEdit = wx.Menu()
        self.menuBasicMode = self.menuEdit.AppendRadioItem(
            wx.NewId(), _("Basic Mode"))
        self.menuAdvancedMode = self.menuEdit.AppendRadioItem(
            wx.NewId(), _("Advanced Mode"))
        self.menuEdit.AppendSeparator()
        self.menuPreferences = self.menuEdit.Append(wx.NewId(),
                                                    _("Preferences"))
        self.menuBar.Append(self.menuEdit, _("Edit"))

        #-- Menu View
        menuView = wx.Menu()
        self.menuControl = wx.Menu()
        self.menuControlPanel = self.menuControl.AppendCheckItem(
            wx.NewId(), _("Panel"))
        self.menuControlVideo = self.menuControl.AppendCheckItem(
            wx.NewId(), _("Video"))
        menuView.AppendMenu(wx.NewId(), _("Control"), self.menuControl)
        self.menuCalibration = wx.Menu()
        self.menuCalibrationPanel = self.menuCalibration.AppendCheckItem(
            wx.NewId(), _("Panel"))
        self.menuCalibrationVideo = self.menuCalibration.AppendCheckItem(
            wx.NewId(), _("Video"))
        menuView.AppendMenu(wx.NewId(), _("Calibration"), self.menuCalibration)
        self.menuScanning = wx.Menu()
        self.menuScanningPanel = self.menuScanning.AppendCheckItem(
            wx.NewId(), _("Panel"))
        self.menuScanningVideo = self.menuScanning.AppendCheckItem(
            wx.NewId(), _("Video"))
        self.menuScanningScene = self.menuScanning.AppendCheckItem(
            wx.NewId(), _("Scene"))
        menuView.AppendMenu(wx.NewId(), _("Scanning"), self.menuScanning)
        self.menuBar.Append(menuView, _("View"))

        #-- Menu Help
        menuHelp = wx.Menu()
        menuAbout = menuHelp.Append(wx.ID_ABOUT, _("About"))
        menuWelcome = menuHelp.Append(wx.ID_ANY, _("Welcome"))
        self.menuBar.Append(menuHelp, _("Help"))

        self.SetMenuBar(self.menuBar)

        ##-- Create Workbenchs
        self.controlWorkbench = ControlWorkbench(self)
        self.scanningWorkbench = ScanningWorkbench(self)
        self.calibrationWorkbench = CalibrationWorkbench(self)

        for workbench in [
                self.controlWorkbench, self.calibrationWorkbench,
                self.scanningWorkbench
        ]:
            workbench.combo.Clear()
            workbench.combo.Append(self.workbenchList['control'])
            workbench.combo.Append(self.workbenchList['calibration'])
            workbench.combo.Append(self.workbenchList['scanning'])

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.controlWorkbench, 1, wx.ALL | wx.EXPAND)
        sizer.Add(self.calibrationWorkbench, 1, wx.ALL | wx.EXPAND)
        sizer.Add(self.scanningWorkbench, 1, wx.ALL | wx.EXPAND)
        self.SetSizer(sizer)

        ##-- Events
        self.Bind(wx.EVT_MENU, self.onLaunchWizard, self.menuLaunchWizard)
        self.Bind(wx.EVT_MENU, self.onLoadModel, self.menuLoadModel)
        self.Bind(wx.EVT_MENU, self.onSaveModel, self.menuSaveModel)
        self.Bind(wx.EVT_MENU, self.onClearModel, self.menuClearModel)
        self.Bind(wx.EVT_MENU, self.onOpenProfile, self.menuOpenProfile)
        self.Bind(wx.EVT_MENU, self.onSaveProfile, self.menuSaveProfile)
        self.Bind(wx.EVT_MENU, self.onResetProfile, self.menuResetProfile)
        self.Bind(wx.EVT_MENU, self.onExit, menuExit)

        self.Bind(wx.EVT_MENU, self.onModeChanged, self.menuBasicMode)
        self.Bind(wx.EVT_MENU, self.onModeChanged, self.menuAdvancedMode)
        self.Bind(wx.EVT_MENU, self.onPreferences, self.menuPreferences)

        self.Bind(wx.EVT_MENU, self.onControlPanelClicked,
                  self.menuControlPanel)
        self.Bind(wx.EVT_MENU, self.onControlVideoClicked,
                  self.menuControlVideo)
        self.Bind(wx.EVT_MENU, self.onCalibrationPanelClicked,
                  self.menuCalibrationPanel)
        self.Bind(wx.EVT_MENU, self.onCalibrationVideoClicked,
                  self.menuCalibrationVideo)
        self.Bind(wx.EVT_MENU, self.onScanningPanelClicked,
                  self.menuScanningPanel)
        self.Bind(wx.EVT_MENU, self.onScanningVideoSceneClicked,
                  self.menuScanningVideo)
        self.Bind(wx.EVT_MENU, self.onScanningVideoSceneClicked,
                  self.menuScanningScene)

        self.Bind(wx.EVT_MENU, self.onAbout, menuAbout)
        self.Bind(wx.EVT_MENU, self.onWelcome, menuWelcome)

        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected,
                  self.controlWorkbench.combo)
        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected,
                  self.calibrationWorkbench.combo)
        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected,
                  self.scanningWorkbench.combo)

        self.Bind(wx.EVT_CLOSE, self.onClose)

        self.updateProfileToAllControls()

        x, y, w, h = wx.Display(0).GetGeometry()
        ws, hs = self.size

        self.SetPosition((x + (w - ws) / 2., y + (h - hs) / 2.))

        #self.Center()
        self.Show()
Esempio n. 31
0
 def onBaudRateComboChanged(self, event):
     if self.baudRateCombo.GetValue() in self.baudRates:
         profile.putProfileSetting('baud_rate',
                                   int(self.baudRateCombo.GetValue()))
Esempio n. 32
0
    def __init__(self):
        super(MainWindow, self).__init__(None, title=_("Horus " + version.getVersion()), size=self.size)

        self.SetMinSize((600, 450))

        ###-- Initialize Engine
        self.driver = Driver.Instance()
        self.simpleScan = scan.SimpleScan.Instance()
        self.textureScan = scan.TextureScan.Instance()
        self.pcg = scan.PointCloudGenerator.Instance()
        self.cameraIntrinsics = calibration.CameraIntrinsics.Instance()
        self.simpleLaserTriangulation = calibration.SimpleLaserTriangulation.Instance()
        self.laserTriangulation = calibration.LaserTriangulation.Instance()
        self.platformExtrinsics = calibration.PlatformExtrinsics.Instance()

        #-- Serial Name initialization
        serialList = self.serialList()
        currentSerial = profile.getProfileSetting('serial_name')
        if len(serialList) > 0:
            if currentSerial not in serialList:
                profile.putProfileSetting('serial_name', serialList[0])

        #-- Video Id initialization
        videoList = self.videoList()
        currentVideoId = profile.getProfileSetting('camera_id')
        if len(videoList) > 0:
            if currentVideoId not in videoList:
                profile.putProfileSetting('camera_id', videoList[0])

        self.lastFiles = eval(profile.getPreference('last_files'))

        print ">>> Horus " + version.getVersion() + " <<<"

        ###-- Initialize GUI

        ##-- Set Icon
        icon = wx.Icon(resources.getPathForImage("horus.ico"), wx.BITMAP_TYPE_ICO)
        self.SetIcon(icon)

        ##-- Status Bar
        #self.CreateStatusBar()

        ##-- Menu Bar
        self.menuBar = wx.MenuBar()

        #--  Menu File
        self.menuFile = wx.Menu()
        self.menuLaunchWizard = self.menuFile.Append(wx.NewId(), _("Launch Wizard"))
        self.menuFile.AppendSeparator()
        self.menuLoadModel = self.menuFile.Append(wx.NewId(), _("Load Model"))
        self.menuSaveModel = self.menuFile.Append(wx.NewId(), _("Save Model"))
        self.menuClearModel = self.menuFile.Append(wx.NewId(), _("Clear Model"))
        self.menuFile.AppendSeparator()
        self.menuOpenProfile = self.menuFile.Append(wx.NewId(), _("Open Profile"), _("Opens Profile .ini"))
        self.menuSaveProfile = self.menuFile.Append(wx.NewId(), _("Save Profile"))
        self.menuResetProfile = self.menuFile.Append(wx.NewId(), _("Reset Profile"))
        self.menuFile.AppendSeparator()
        self.menuExit = self.menuFile.Append(wx.ID_EXIT, _("Exit"))
        self.menuBar.Append(self.menuFile, _("File"))

        #-- Menu Edit
        self.menuEdit = wx.Menu()
        # self.menuBasicMode = self.menuEdit.AppendRadioItem(wx.NewId(), _("Basic Mode"))
        # self.menuAdvancedMode = self.menuEdit.AppendRadioItem(wx.NewId(), _("Advanced Mode"))
        # self.menuEdit.AppendSeparator()
        self.menuPreferences = self.menuEdit.Append(wx.NewId(), _("Preferences"))
        self.menuMachineSettings = self.menuEdit.Append(wx.NewId(), _("Machine Settings"))
        self.menuBar.Append(self.menuEdit, _("Edit"))

        #-- Menu View
        self.menuView = wx.Menu()
        self.menuControl = wx.Menu()
        self.menuControlPanel = self.menuControl.AppendCheckItem(wx.NewId(), _("Panel"))
        self.menuControlVideo = self.menuControl.AppendCheckItem(wx.NewId(), _("Video"))
        self.menuView.AppendMenu(wx.NewId(), _("Control"), self.menuControl)
        self.menuCalibration = wx.Menu()
        self.menuCalibrationPanel = self.menuCalibration.AppendCheckItem(wx.NewId(), _("Panel"))
        self.menuCalibrationVideo = self.menuCalibration.AppendCheckItem(wx.NewId(), _("Video"))
        self.menuView.AppendMenu(wx.NewId(), _("Calibration"), self.menuCalibration)
        self.menuScanning = wx.Menu()
        self.menuScanningPanel = self.menuScanning.AppendCheckItem(wx.NewId(), _("Panel"))
        self.menuScanningVideo = self.menuScanning.AppendCheckItem(wx.NewId(), _("Video"))
        self.menuScanningScene = self.menuScanning.AppendCheckItem(wx.NewId(), _("Scene"))
        self.menuView.AppendMenu(wx.NewId(), _("Scanning"), self.menuScanning)
        self.menuBar.Append(self.menuView, _("View"))

        #-- Menu Help
        self.menuHelp = wx.Menu()
        self.menuWelcome = self.menuHelp.Append(wx.ID_ANY, _("Welcome"))
        if profile.getPreferenceBool('check_for_updates'):
            self.menuUpdates = self.menuHelp.Append(wx.ID_ANY, _("Updates"))
        self.menuWiki = self.menuHelp.Append(wx.ID_ANY, _("Wiki"))
        self.menuSources = self.menuHelp.Append(wx.ID_ANY, _("Sources"))
        self.menuIssues = self.menuHelp.Append(wx.ID_ANY, _("Issues"))
        self.menuForum = self.menuHelp.Append(wx.ID_ANY, _("Forum"))
        self.menuAbout = self.menuHelp.Append(wx.ID_ABOUT, _("About"))
        self.menuBar.Append(self.menuHelp, _("Help"))

        self.SetMenuBar(self.menuBar)

        ##-- Create Workbenchs
        self.controlWorkbench = ControlWorkbench(self)
        self.scanningWorkbench = ScanningWorkbench(self)
        self.calibrationWorkbench = CalibrationWorkbench(self)

        _choices = []
        choices = profile.getProfileSettingObject('workbench').getType()
        for i in choices:
            _choices.append(_(i))
        self.workbenchDict = dict(zip(_choices, choices))

        for workbench in [self.controlWorkbench, self.calibrationWorkbench, self.scanningWorkbench]:
            workbench.combo.Clear()
            for i in choices:
                workbench.combo.Append(_(i))

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.controlWorkbench, 1, wx.ALL|wx.EXPAND)
        sizer.Add(self.calibrationWorkbench, 1, wx.ALL|wx.EXPAND)
        sizer.Add(self.scanningWorkbench, 1, wx.ALL|wx.EXPAND)
        self.SetSizer(sizer)

        ##-- Events
        self.Bind(wx.EVT_MENU, self.onLaunchWizard, self.menuLaunchWizard)
        self.Bind(wx.EVT_MENU, self.onLoadModel, self.menuLoadModel)
        self.Bind(wx.EVT_MENU, self.onSaveModel, self.menuSaveModel)
        self.Bind(wx.EVT_MENU, self.onClearModel, self.menuClearModel)
        self.Bind(wx.EVT_MENU, self.onOpenProfile, self.menuOpenProfile)
        self.Bind(wx.EVT_MENU, self.onSaveProfile, self.menuSaveProfile)
        self.Bind(wx.EVT_MENU, self.onResetProfile, self.menuResetProfile)
        self.Bind(wx.EVT_MENU, self.onExit, self.menuExit)

        # self.Bind(wx.EVT_MENU, self.onModeChanged, self.menuBasicMode)
        # self.Bind(wx.EVT_MENU, self.onModeChanged, self.menuAdvancedMode)
        self.Bind(wx.EVT_MENU, self.onPreferences, self.menuPreferences)
        self.Bind(wx.EVT_MENU, self.onMachineSettings, self.menuMachineSettings)

        self.Bind(wx.EVT_MENU, self.onControlPanelClicked, self.menuControlPanel)
        self.Bind(wx.EVT_MENU, self.onControlVideoClicked, self.menuControlVideo)
        self.Bind(wx.EVT_MENU, self.onCalibrationPanelClicked, self.menuCalibrationPanel)
        self.Bind(wx.EVT_MENU, self.onCalibrationVideoClicked, self.menuCalibrationVideo)
        self.Bind(wx.EVT_MENU, self.onScanningPanelClicked, self.menuScanningPanel)
        self.Bind(wx.EVT_MENU, self.onScanningVideoSceneClicked, self.menuScanningVideo)
        self.Bind(wx.EVT_MENU, self.onScanningVideoSceneClicked, self.menuScanningScene)

        self.Bind(wx.EVT_MENU, self.onAbout, self.menuAbout)
        self.Bind(wx.EVT_MENU, self.onWelcome, self.menuWelcome)
        if profile.getPreferenceBool('check_for_updates'):
            self.Bind(wx.EVT_MENU, self.onUpdates, self.menuUpdates)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/bq/horus/wiki'), self.menuWiki)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/bq/horus'), self.menuSources)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/bq/horus/issues'), self.menuIssues)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://groups.google.com/forum/?hl=es#!forum/ciclop-3d-scanner'), self.menuForum)

        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected, self.controlWorkbench.combo)
        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected, self.calibrationWorkbench.combo)
        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected, self.scanningWorkbench.combo)

        self.Bind(wx.EVT_CLOSE, self.onClose)

        self.updateProfileToAllControls()

        x, y, w, h = wx.Display(0).GetGeometry()
        ws, hs = self.size

        self.SetPosition((x+(w-ws)/2., y+(h-hs)/2.))
Esempio n. 33
0
	def onBoardsComboChanged(self, event):
		profile.putProfileSetting('board', self.boardsCombo.GetValue())
Esempio n. 34
0
	def onCameraIdTextChanged(self, event):
		if len(self.cameraIdCombo.GetValue()):
			profile.putProfileSetting('camera_id', self.cameraIdCombo.GetValue())
Esempio n. 35
0
	def onInvertMotor(self, event):
		profile.putProfileSetting('invert_motor', self.invertMotorCheckBox.GetValue())
Esempio n. 36
0
	def undo(self):
		if len(self.undoValues) > 0:
			value = self.undoValues.pop()
			profile.putProfileSetting(self.name, value)
			self.update(value)
Esempio n. 37
0
 def onScanTypeComboBoxChanged(self, event):
     value = event.GetEventObject().GetValue()
     profile.putProfileSetting('scan_type', value)
Esempio n. 38
0
 def onInvertMotor(self, event):
     profile.putProfileSetting('invert_motor',
                               self.invertMotorCheckBox.GetValue())
Esempio n. 39
0
 def onInvertMotor(self, event):
     invert = self.invertMotorCheckBox.GetValue()
     profile.putProfileSetting('invert_motor', invert)
     self.driver.board.setInvertMotor(invert)
Esempio n. 40
0
 def onBoardsComboChanged(self, event):
     profile.putProfileSetting('board', self.boardsCombo.GetValue())
Esempio n. 41
0
 def onSerialNameComboChanged(self, event):
     if len(self.serialNameCombo.GetValue()):
         profile.putProfileSetting('serial_name',
                                   self.serialNameCombo.GetValue())
Esempio n. 42
0
 def onCameraIdComboChanged(self, event):
     if len(self.cameraIdCombo.GetValue()):
         profile.putProfileSetting('camera_id',
                                   self.cameraIdCombo.GetValue())
Esempio n. 43
0
	def onComboBoVideoViewsSelect(self, event):
		value = self.videoViewsDict[self.comboVideoViews.GetValue()]
		self.currentScan.setImageType(value)
		profile.putProfileSetting('img_type', value)
Esempio n. 44
0
 def onComboBoVideoViewsSelect(self, event):
     value = self.videoViewsDict[self.comboVideoViews.GetValue()]
     self.currentScan.setImageType(value)
     profile.putProfileSetting('img_type', value)
Esempio n. 45
0
 def onComboBoxChanged(self, event):
     value = self.keyDict[self.control.GetValue()]
     profile.putProfileSetting(self.name, value)
     self._updateEngine(value)
Esempio n. 46
0
 def onInvertMotor(self, event):
     invert = self.invertMotorCheckBox.GetValue()
     profile.putProfileSetting('invert_motor', invert)
     self.driver.board.setInvertMotor(invert)
Esempio n. 47
0
File: main.py Progetto: rp3d/ciclop
    def __init__(self):
        super(MainWindow, self).__init__(None, title=_("Horus " + VERSION + " - Beta"), size=self.size)

        self.SetMinSize((600, 450))

        ###-- Initialize Engine
        self.driver = Driver.Instance()
        self.simpleScan = scan.SimpleScan.Instance()
        self.textureScan = scan.TextureScan.Instance()
        self.pcg = scan.PointCloudGenerator.Instance()
        self.cameraIntrinsics = calibration.CameraIntrinsics.Instance()
        self.simpleLaserTriangulation = calibration.SimpleLaserTriangulation.Instance()
        self.laserTriangulation = calibration.LaserTriangulation.Instance()
        self.platformExtrinsics = calibration.PlatformExtrinsics.Instance()

        #-- Serial Name initialization
        serialList = self.serialList()
        currentSerial = profile.getProfileSetting('serial_name')
        if len(serialList) > 0:
            if currentSerial not in serialList:
                profile.putProfileSetting('serial_name', serialList[0])

        #-- Video Id initialization
        videoList = self.videoList()
        currentVideoId = profile.getProfileSetting('camera_id')
        if len(videoList) > 0:
            if currentVideoId not in videoList:
                profile.putProfileSetting('camera_id', videoList[0])

        self.lastFiles = eval(profile.getPreference('last_files'))

        print ">>> Horus " + VERSION + " <<<"

        ###-- Initialize GUI

        ##-- Set Icon
        icon = wx.Icon(resources.getPathForImage("horus.ico"), wx.BITMAP_TYPE_ICO)
        self.SetIcon(icon)

        ##-- Status Bar
        #self.CreateStatusBar()

        ##-- Menu Bar
        self.menuBar = wx.MenuBar()

        #--  Menu File
        self.menuFile = wx.Menu()
        self.menuLaunchWizard = self.menuFile.Append(wx.NewId(), _("Launch Wizard"))
        self.menuFile.AppendSeparator()
        self.menuLoadModel = self.menuFile.Append(wx.NewId(), _("Load Model"))
        self.menuSaveModel = self.menuFile.Append(wx.NewId(), _("Save Model"))
        self.menuClearModel = self.menuFile.Append(wx.NewId(), _("Clear Model"))
        self.menuFile.AppendSeparator()
        self.menuOpenProfile = self.menuFile.Append(wx.NewId(), _("Open Profile"), _("Opens Profile .ini"))
        self.menuSaveProfile = self.menuFile.Append(wx.NewId(), _("Save Profile"))
        self.menuResetProfile = self.menuFile.Append(wx.NewId(), _("Reset Profile"))
        self.menuFile.AppendSeparator()
        self.menuExit = self.menuFile.Append(wx.ID_EXIT, _("Exit"))
        self.menuBar.Append(self.menuFile, _("File"))

        #-- Menu Edit
        self.menuEdit = wx.Menu()
        # self.menuBasicMode = self.menuEdit.AppendRadioItem(wx.NewId(), _("Basic Mode"))
        # self.menuAdvancedMode = self.menuEdit.AppendRadioItem(wx.NewId(), _("Advanced Mode"))
        # self.menuEdit.AppendSeparator()
        self.menuPreferences = self.menuEdit.Append(wx.NewId(), _("Preferences"))
        self.menuBar.Append(self.menuEdit, _("Edit"))

        #-- Menu View
        self.menuView = wx.Menu()
        self.menuControl = wx.Menu()
        self.menuControlPanel = self.menuControl.AppendCheckItem(wx.NewId(), _("Panel"))
        self.menuControlVideo = self.menuControl.AppendCheckItem(wx.NewId(), _("Video"))
        self.menuView.AppendMenu(wx.NewId(), _("Control"), self.menuControl)
        self.menuCalibration = wx.Menu()
        self.menuCalibrationPanel = self.menuCalibration.AppendCheckItem(wx.NewId(), _("Panel"))
        self.menuCalibrationVideo = self.menuCalibration.AppendCheckItem(wx.NewId(), _("Video"))
        self.menuView.AppendMenu(wx.NewId(), _("Calibration"), self.menuCalibration)
        self.menuScanning = wx.Menu()
        self.menuScanningPanel = self.menuScanning.AppendCheckItem(wx.NewId(), _("Panel"))
        self.menuScanningVideo = self.menuScanning.AppendCheckItem(wx.NewId(), _("Video"))
        self.menuScanningScene = self.menuScanning.AppendCheckItem(wx.NewId(), _("Scene"))
        self.menuView.AppendMenu(wx.NewId(), _("Scanning"), self.menuScanning)
        self.menuBar.Append(self.menuView, _("View"))

        #-- Menu Help
        self.menuHelp = wx.Menu()
        self.menuWelcome = self.menuHelp.Append(wx.ID_ANY, _("Welcome"))
        self.menuWiki = self.menuHelp.Append(wx.ID_ANY, _("Wiki"))
        self.menuSources = self.menuHelp.Append(wx.ID_ANY, _("Sources"))
        self.menuIssues = self.menuHelp.Append(wx.ID_ANY, _("Issues"))
        self.menuForum = self.menuHelp.Append(wx.ID_ANY, _("Forum"))
        self.menuAbout = self.menuHelp.Append(wx.ID_ABOUT, _("About"))
        self.menuBar.Append(self.menuHelp, _("Help"))

        self.SetMenuBar(self.menuBar)

        ##-- Create Workbenchs
        self.controlWorkbench = ControlWorkbench(self)
        self.scanningWorkbench = ScanningWorkbench(self)
        self.calibrationWorkbench = CalibrationWorkbench(self)

        _choices = []
        choices = profile.getProfileSettingObject('workbench').getType()
        for i in choices:
            _choices.append(_(i))
        self.workbenchDict = dict(zip(_choices, choices))

        for workbench in [self.controlWorkbench, self.calibrationWorkbench, self.scanningWorkbench]:
            workbench.combo.Clear()
            for i in choices:
                workbench.combo.Append(_(i))

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.controlWorkbench, 1, wx.ALL|wx.EXPAND)
        sizer.Add(self.calibrationWorkbench, 1, wx.ALL|wx.EXPAND)
        sizer.Add(self.scanningWorkbench, 1, wx.ALL|wx.EXPAND)
        self.SetSizer(sizer)

        ##-- Events
        self.Bind(wx.EVT_MENU, self.onLaunchWizard, self.menuLaunchWizard)
        self.Bind(wx.EVT_MENU, self.onLoadModel, self.menuLoadModel)
        self.Bind(wx.EVT_MENU, self.onSaveModel, self.menuSaveModel)
        self.Bind(wx.EVT_MENU, self.onClearModel, self.menuClearModel)
        self.Bind(wx.EVT_MENU, self.onOpenProfile, self.menuOpenProfile)
        self.Bind(wx.EVT_MENU, self.onSaveProfile, self.menuSaveProfile)
        self.Bind(wx.EVT_MENU, self.onResetProfile, self.menuResetProfile)
        self.Bind(wx.EVT_MENU, self.onExit, self.menuExit)

        # self.Bind(wx.EVT_MENU, self.onModeChanged, self.menuBasicMode)
        # self.Bind(wx.EVT_MENU, self.onModeChanged, self.menuAdvancedMode)
        self.Bind(wx.EVT_MENU, self.onPreferences, self.menuPreferences)

        self.Bind(wx.EVT_MENU, self.onControlPanelClicked, self.menuControlPanel)
        self.Bind(wx.EVT_MENU, self.onControlVideoClicked, self.menuControlVideo)
        self.Bind(wx.EVT_MENU, self.onCalibrationPanelClicked, self.menuCalibrationPanel)
        self.Bind(wx.EVT_MENU, self.onCalibrationVideoClicked, self.menuCalibrationVideo)
        self.Bind(wx.EVT_MENU, self.onScanningPanelClicked, self.menuScanningPanel)
        self.Bind(wx.EVT_MENU, self.onScanningVideoSceneClicked, self.menuScanningVideo)
        self.Bind(wx.EVT_MENU, self.onScanningVideoSceneClicked, self.menuScanningScene)

        self.Bind(wx.EVT_MENU, self.onAbout, self.menuAbout)
        self.Bind(wx.EVT_MENU, self.onWelcome, self.menuWelcome)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/bq/horus/wiki'), self.menuWiki)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/bq/horus'), self.menuSources)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/bq/horus/issues'), self.menuIssues)
        self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://groups.google.com/forum/?hl=es#!forum/ciclop-3d-scanner'), self.menuForum)

        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected, self.controlWorkbench.combo)
        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected, self.calibrationWorkbench.combo)
        self.Bind(wx.EVT_COMBOBOX, self.onComboBoxWorkbenchSelected, self.scanningWorkbench.combo)

        self.Bind(wx.EVT_CLOSE, self.onClose)

        self.updateProfileToAllControls()

        x, y, w, h = wx.Display(0).GetGeometry()
        ws, hs = self.size

        self.SetPosition((x+(w-ws)/2., y+(h-hs)/2.))

        #self.Center()
        self.Show()