/[fenfire]/fenfire/org/fenfire/fenpdf/importpdf.py
ViewVC logotype

Diff of /fenfire/org/fenfire/fenpdf/importpdf.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by tjl, Mon Aug 18 20:07:19 2003 UTC revision 1.4 by tjl, Tue Aug 26 10:06:38 2003 UTC
# Line 11  def p(*s): Line 11  def p(*s):
11    
12  def importPDF_select(fen, treetime):  def importPDF_select(fen, treetime):
13      """Show a file selection dialog and import a file.      """Show a file selection dialog and import a file.
14    
15        Returns a sequence of ScrollBlock objects imported.
16      """      """
17            
18      file = selectFile("Select PS/PDF file to import, or directory for all files in it")      file = selectFile("Select PS/PDF file to import, or directory for all files in it")
# Line 19  def importPDF_select(fen, treetime): Line 21  def importPDF_select(fen, treetime):
21    
22      lastFile = None      lastFile = None
23      if file.isDirectory():      if file.isDirectory():
24            blocks = []
25          for f in file.listFiles():          for f in file.listFiles():
26              try:              try:
27                  if f.isDirectory(): continue                  if f.isDirectory(): continue
28                  importPDF(fen, treetime, f)                  blocks.append(
29                        importPDF(fen, treetime, f)
30                    )
31              except exception:              except exception:
32                  print "EXCEPTION LOADING",f,":",sys.exc_info()                  print "EXCEPTION LOADING",f,":",sys.exc_info()
33            blocks = [b for b in blocks if b != None ]
34            return blocks
35      else:      else:
36          return importPDF(fen, treetime, file)          return [importPDF(fen, treetime, file)]
37    
38  def selectFile(string):  def selectFile(string):
39      """Select a file using an AWT dialog, with the given prompt.      """Select a file using an AWT dialog, with the given prompt.
# Line 64  def importPDF(fen, treetime, file): Line 71  def importPDF(fen, treetime, file):
71      # XXX JPEG?!?      # XXX JPEG?!?
72      elif type.startswith('\xff\xd8\xff\xe0'): p('JPEG not yet supported!'); scrollBlock = None      elif type.startswith('\xff\xd8\xff\xe0'): p('JPEG not yet supported!'); scrollBlock = None
73    
74        if scrollBlock == None: return
75    
76      if treetime != None:      if treetime != None:
77          try:          try:
78              treetime.addLatest(fen.graph,              treetime.addLatest(fen.graph,

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26