# Program to show sequence of compressed XBM files # (c) Silas S. Brown 2009. # Just run it to see the first document, # or call the main() function with a document number. # Tested on Windows Mobile with Python CE 2.5 and TkInter. # (We need to use XBM format because others don't always work.) # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Where to find history: # on GitHub at https://github.com/ssb22/scan-reflow # and on GitLab at https://gitlab.com/ssb22/scan-reflow # and on BitBucket https://bitbucket.org/ssb22/scan-reflow # and at https://gitlab.developers.cam.ac.uk/ssb22/scan-reflow # and in China: https://gitee.com/ssb22/scan-reflow def lsbMsb(dat): tot=0 ; mul=0 for d in dat: tot |= (ord(d)<", lambda *args:master.selectDocument(docNo-1)) text.insert(END, "Previous", "p") text.insert(END," ") text.tag_config("n",foreground="blue",underline=1) text.tag_config("m",foreground="blue",underline=1) text.tag_bind("n","", lambda *args:master.selectDocument(docNo+1)) thread.start_new_thread(queue_additions,(master,docNo,text)) return [text,scrollbar] def queue_additions(master,docNo,text): doc = readDoc(docNo,contentsDat,sequenceDat) for i in range(0,len(doc),2): imgdata = BitmapImage(data=zlib.decompress( readDoc(lsbMsb(doc[i:i+2]),imageDat,imageDat))) text.theImages.append(imgdata) # keep reference master.todo.append( lambda i=i,imgdata=imgdata,*args:( text.image_create(END,image=imgdata), text.insert(END," "))) if docNo