Exemple #1
0
    def OnButton2Button(self, event):
        self.ShowMoreToCome(0)
        GetXferFileNameWorks = False
        XferFileName = ''
        try:
            self.Control.Log("self.SS.GetXferFileName()")
            (name, imgType) = self.SS.GetXferFileName()
            XferFileName = name
            GetXferFileNameWorks = True
        except:
            self.Control.Log(
                "** This scanner does not support GetXferFileName - using default TWAIN.TMP"
            )
            self.Control.DisplayException("self.SS.GetXferFileName()")
            (name, imgType) = ("twain.tmp", twain.TWFF_BMP)
            XferFileName = 'twain.tmp'

        if GetXferFileNameWorks:
            dlg = dlgFileXFer.create(self)
            dlg.SetInfo(name, imgType)
            try:
                rv = dlg.ShowModal()
                if rv:
                    self.Control.Log("self.SS.SetXferFileName('%s', %d)" %
                                     (dlg.Name, dlg.imgType))
                    if dlg.Name:
                        self.SS.SetXferFileName(dlg.Name, dlg.imgType)
                        XferFileName = dlg.Name
            except:
                self.Control.DisplayException("self.SS.SetXferFileName")
            dlg.Destroy()

        try:
            self.Control.Log("self.SS.XferImageByFile()")
            self.Control.statusBar1.SetStatusText("7 - Transferring Data", 2)
            more_to_come = self.SS.XferImageByFile()
            self.Control.Log(">> %d" % more_to_come)

            # Display the image, assume Bitmap
            frm = frmViewBmp.create(self)
            frm.SetImageFromFile(XferFileName, self)
            frm.Show(1)
            frm.Raise()
            self.FileViewer = frm

            # Let the user know the operation was successful
            if more_to_come:
                self.Control.statusBar1.SetStatusText("6 - Data Available", 2)
            else:
                self.Control.statusBar1.SetStatusText("4 - Source Open", 2)
                self.Control.statusBar1.SetStatusText("Aquisition Complete", 0)

            if more_to_come:
                self.ShowMoreToCome(1)
            else:
                self.Close(1)

        except:
            self.Control.DisplayException("self.SS.XferImageByFile")
Exemple #2
0
    def OnButton2Button(self, event):
        self.ShowMoreToCome(0)
        GetXferFileNameWorks=False
        XferFileName=''
        try:
            self.Control.Log("self.SS.GetXferFileName()")
            (name, imgType) = self.SS.GetXferFileName()
            XferFileName=name
            GetXferFileNameWorks=True
        except:
            self.Control.Log("** This scanner does not support GetXferFileName - using default TWAIN.TMP")
            self.Control.DisplayException("self.SS.GetXferFileName()")
            (name, imgType) = ("twain.tmp", twain.TWFF_BMP)
            XferFileName='twain.tmp'

        if GetXferFileNameWorks:
            dlg = dlgFileXFer.create(self)
            dlg.SetInfo(name, imgType)
            try:
                rv = dlg.ShowModal()
                if rv:
                    self.Control.Log("self.SS.SetXferFileName('%s', %d)" % (dlg.Name, dlg.imgType))
                    if dlg.Name:
                        self.SS.SetXferFileName(dlg.Name, dlg.imgType)
                        XferFileName=dlg.Name
            except:
                self.Control.DisplayException("self.SS.SetXferFileName")
            dlg.Destroy()

        try:
            self.Control.Log("self.SS.XferImageByFile()")
            self.Control.statusBar1.SetStatusText("7 - Transferring Data", 2)
            more_to_come = self.SS.XferImageByFile()
            self.Control.Log(">> %d"%more_to_come)

            # Display the image, assume Bitmap
            frm=frmViewBmp.create(self)
            frm.SetImageFromFile(XferFileName, self)
            frm.Show(1)
            frm.Raise()
            self.FileViewer = frm
            
            # Let the user know the operation was successful
            if more_to_come:
                self.Control.statusBar1.SetStatusText("6 - Data Available", 2)
            else:
                self.Control.statusBar1.SetStatusText("4 - Source Open", 2)
                self.Control.statusBar1.SetStatusText("Aquisition Complete", 0)

            if more_to_come:
                self.ShowMoreToCome(1)
            else:
                self.Close(1)
            
        except:
            self.Control.DisplayException("self.SS.XferImageByFile")
    def OnButton2Button(self, event):
        self.ShowMoreToCome(0)
        try:
            self.Control.Log("self.SS.GetXferFileName()")
            (name, imgType) = self.SS.GetXferFileName()
        except:
            self.Control.DisplayException("self.SS.GetXferFileName()")
            (name, imgType) = ("", 0)
        dlg = dlgFileXFer.create(self)
        dlg.SetInfo(name, imgType)
        try:
            rv = dlg.ShowModal()
            if rv:
                self.Control.Log("self.SS.SetXferFileName('%s', %d)" %
                    (dlg.Name, dlg.imgType))
                self.SS.SetXferFileName(dlg.Name, dlg.imgType)
        except:
            self.Control.DisplayException("self.SS.SetXferFileName")
        dlg.Destroy()
        if rv:
            try:
                self.Control.Log("self.SS.XferImageByFile()")
                self.Control.statusBar1.SetStatusText("7 - Transferring Data", 2)
                more_to_come = self.SS.XferImageByFile()
                self.Control.Log(">> %d"%more_to_come)
                if more_to_come:
                    self.Control.statusBar1.SetStatusText("6 - Data Available", 2)
                else:
                    self.Control.statusBar1.SetStatusText("5 - Acquisition Requested", 2)

                dlg = wxMessageDialog(self, 
                    "File Transfer [%s] Completed Successfully" % dlg.Name
                    , "self.SS.XferImageByFile", wxOK | wxICON_INFORMATION)
                dlg.ShowModal()
                dlg.Destroy()
                if more_to_come:
                    self.ShowMoreToCome(1)
                else:
                    self.Close(1)
            except:
                self.Control.DisplayException("self.SS.XferImageByFile")