Beispiel #1
0
    def __init__(self, parent):
        super(Wizard, self).__init__(parent,
                                     title="",
                                     size=(640 + 120, 480 + 40))

        self.parent = parent

        self.driver = Driver.Instance()

        self.currentWorkbench = profile.getPreference('workbench')

        self.connectionPage = ConnectionPage(
            self,
            buttonPrevCallback=self.onConnectionPagePrevClicked,
            buttonNextCallback=self.onConnectionPageNextClicked)
        self.calibrationPage = CalibrationPage(
            self,
            buttonPrevCallback=self.onCalibrationPagePrevClicked,
            buttonNextCallback=self.onCalibrationPageNextClicked)
        self.scanningPage = ScanningPage(
            self,
            buttonPrevCallback=self.onScanningPagePrevClicked,
            buttonNextCallback=self.onScanningPageNextClicked)

        pages = [self.connectionPage, self.calibrationPage, self.scanningPage]

        self.connectionPage.intialize(pages)
        self.calibrationPage.intialize(pages)
        self.scanningPage.intialize(pages)

        self.connectionPage.Show()
        self.calibrationPage.Hide()
        self.scanningPage.Hide()

        self.driver.board.setUnplugCallback(
            lambda: wx.CallAfter(self.onBoardUnplugged))
        self.driver.camera.setUnplugCallback(
            lambda: wx.CallAfter(self.onCameraUnplugged))

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(self.connectionPage, 1, wx.ALL | wx.EXPAND, 0)
        hbox.Add(self.calibrationPage, 1, wx.ALL | wx.EXPAND, 0)
        hbox.Add(self.scanningPage, 1, wx.ALL | wx.EXPAND, 0)

        self.SetSizer(hbox)

        self.Bind(wx.EVT_CLOSE, lambda e: self.onExit())

        self.Centre()
        self.ShowModal()
Beispiel #2
0
    def __init__(self, parent):
        super(Wizard, self).__init__(parent, title="", size=(640+120,480+40))

        self.parent = parent

        self.driver = Driver.Instance()

        self.currentWorkbench = profile.getPreference('workbench')
 
        self.connectionPage = ConnectionPage(self, buttonPrevCallback=self.onConnectionPagePrevClicked, buttonNextCallback=self.onConnectionPageNextClicked)
        self.calibrationPage = CalibrationPage(self, buttonPrevCallback=self.onCalibrationPagePrevClicked, buttonNextCallback=self.onCalibrationPageNextClicked)
        self.scanningPage = ScanningPage(self, buttonPrevCallback=self.onScanningPagePrevClicked, buttonNextCallback=self.onScanningPageNextClicked)

        pages = [self.connectionPage, self.calibrationPage, self.scanningPage]

        self.connectionPage.intialize(pages)
        self.calibrationPage.intialize(pages)
        self.scanningPage.intialize(pages)

        self.connectionPage.Show()
        self.calibrationPage.Hide()
        self.scanningPage.Hide()

        self.driver.board.setUnplugCallback(lambda: wx.CallAfter(self.onBoardUnplugged))
        self.driver.camera.setUnplugCallback(lambda: wx.CallAfter(self.onCameraUnplugged))

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(self.connectionPage, 1, wx.ALL|wx.EXPAND, 0)
        hbox.Add(self.calibrationPage, 1, wx.ALL|wx.EXPAND, 0)
        hbox.Add(self.scanningPage, 1, wx.ALL|wx.EXPAND, 0)

        self.SetSizer(hbox)

        self.Bind(wx.EVT_CLOSE, lambda e: self.onExit())

        self.Centre()
        self.ShowModal()
Beispiel #3
0
class Wizard(wx.Dialog):
    def __init__(self, parent):
        super(Wizard, self).__init__(parent,
                                     title="",
                                     size=(640 + 120, 480 + 40))

        self.parent = parent

        self.driver = Driver.Instance()

        self.currentWorkbench = profile.getPreference('workbench')

        self.connectionPage = ConnectionPage(
            self,
            buttonPrevCallback=self.onConnectionPagePrevClicked,
            buttonNextCallback=self.onConnectionPageNextClicked)
        self.calibrationPage = CalibrationPage(
            self,
            buttonPrevCallback=self.onCalibrationPagePrevClicked,
            buttonNextCallback=self.onCalibrationPageNextClicked)
        self.scanningPage = ScanningPage(
            self,
            buttonPrevCallback=self.onScanningPagePrevClicked,
            buttonNextCallback=self.onScanningPageNextClicked)

        pages = [self.connectionPage, self.calibrationPage, self.scanningPage]

        self.connectionPage.intialize(pages)
        self.calibrationPage.intialize(pages)
        self.scanningPage.intialize(pages)

        self.connectionPage.Show()
        self.calibrationPage.Hide()
        self.scanningPage.Hide()

        self.driver.board.setUnplugCallback(
            lambda: wx.CallAfter(self.onBoardUnplugged))
        self.driver.camera.setUnplugCallback(
            lambda: wx.CallAfter(self.onCameraUnplugged))

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(self.connectionPage, 1, wx.ALL | wx.EXPAND, 0)
        hbox.Add(self.calibrationPage, 1, wx.ALL | wx.EXPAND, 0)
        hbox.Add(self.scanningPage, 1, wx.ALL | wx.EXPAND, 0)

        self.SetSizer(hbox)

        self.Bind(wx.EVT_CLOSE, lambda e: self.onExit())

        self.Centre()
        self.ShowModal()

    def onBoardUnplugged(self):
        self.onUnplugged()
        self.parent.onBoardUnplugged()
        self.connectionPage.updateStatus(False)
        self.calibrationPage.updateStatus(False)

    def onCameraUnplugged(self):
        self.onUnplugged()
        self.parent.onCameraUnplugged()
        self.connectionPage.updateStatus(False)
        self.calibrationPage.updateStatus(False)

    def onUnplugged(self):
        if hasattr(self.connectionPage, 'waitCursor'):
            del self.connectionPage.waitCursor
        if hasattr(self.calibrationPage, 'waitCursor'):
            del self.calibrationPage.waitCursor
        self.connectionPage.onUnplugged()
        self.calibrationPage.onUnplugged()
        self.connectionPage.Show()
        self.calibrationPage.Hide()
        self.scanningPage.Hide()

    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 onConnectionPagePrevClicked(self):
        self.onExit()

    def onCalibrationPagePrevClicked(self):
        self.calibrationPage.Hide()
        self.connectionPage.Show()
        self.Layout()

    def onScanningPagePrevClicked(self):
        self.scanningPage.Hide()
        self.calibrationPage.Show()
        self.Layout()

    def onConnectionPageNextClicked(self):
        self.connectionPage.Hide()
        self.calibrationPage.Show()
        self.Layout()

    def onCalibrationPageNextClicked(self):
        self.calibrationPage.Hide()
        self.scanningPage.Show()
        self.Layout()

    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')
            self.parent.updatePCGProfile()
            self.parent.updateCalibrationProfile()
            self.parent.workbenchUpdate()
            self.driver.camera.setExposure(
                profile.getProfileSettingInteger('exposure_scanning'))
            self.Destroy()
Beispiel #4
0
class Wizard(wx.Dialog):
    def __init__(self, parent):
        super(Wizard, self).__init__(parent, title="", size=(640+120,480+40))

        self.parent = parent

        self.driver = Driver.Instance()

        self.currentWorkbench = profile.getPreference('workbench')
 
        self.connectionPage = ConnectionPage(self, buttonPrevCallback=self.onConnectionPagePrevClicked, buttonNextCallback=self.onConnectionPageNextClicked)
        self.calibrationPage = CalibrationPage(self, buttonPrevCallback=self.onCalibrationPagePrevClicked, buttonNextCallback=self.onCalibrationPageNextClicked)
        self.scanningPage = ScanningPage(self, buttonPrevCallback=self.onScanningPagePrevClicked, buttonNextCallback=self.onScanningPageNextClicked)

        pages = [self.connectionPage, self.calibrationPage, self.scanningPage]

        self.connectionPage.intialize(pages)
        self.calibrationPage.intialize(pages)
        self.scanningPage.intialize(pages)

        self.connectionPage.Show()
        self.calibrationPage.Hide()
        self.scanningPage.Hide()

        self.driver.board.setUnplugCallback(lambda: wx.CallAfter(self.onBoardUnplugged))
        self.driver.camera.setUnplugCallback(lambda: wx.CallAfter(self.onCameraUnplugged))

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(self.connectionPage, 1, wx.ALL|wx.EXPAND, 0)
        hbox.Add(self.calibrationPage, 1, wx.ALL|wx.EXPAND, 0)
        hbox.Add(self.scanningPage, 1, wx.ALL|wx.EXPAND, 0)

        self.SetSizer(hbox)

        self.Bind(wx.EVT_CLOSE, lambda e: self.onExit())

        self.Centre()
        self.ShowModal()

    def onBoardUnplugged(self):
        self.onUnplugged()
        self.parent.onBoardUnplugged()
        self.connectionPage.updateStatus(False)
        self.calibrationPage.updateStatus(False)

    def onCameraUnplugged(self):
        self.onUnplugged()
        self.parent.onCameraUnplugged()
        self.connectionPage.updateStatus(False)
        self.calibrationPage.updateStatus(False)

    def onUnplugged(self):
        if hasattr(self.connectionPage, 'waitCursor'):
            del self.connectionPage.waitCursor
        if hasattr(self.calibrationPage, 'waitCursor'):
            del self.calibrationPage.waitCursor
        self.connectionPage.onUnplugged()
        self.calibrationPage.onUnplugged()
        self.connectionPage.Show()
        self.calibrationPage.Hide()
        self.scanningPage.Hide()

    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.EndModal(wx.ID_OK)
            self.Destroy()

    def onConnectionPagePrevClicked(self):
        self.onExit()

    def onCalibrationPagePrevClicked(self):
        self.calibrationPage.Hide()
        self.connectionPage.Show()
        self.Layout()

    def onScanningPagePrevClicked(self):
        self.scanningPage.Hide()
        self.calibrationPage.Show()
        self.Layout()

    def onConnectionPageNextClicked(self):
        self.connectionPage.Hide()
        self.calibrationPage.Show()
        self.Layout()

    def onCalibrationPageNextClicked(self):
        self.calibrationPage.Hide()
        self.scanningPage.Show()
        self.Layout()

    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.EndModal(wx.ID_OK)
            self.Destroy()