def callTemplates(self): gtwin = Toplevel(self.top) self.getTemplates(gtwin) self.top.wait_window(gtwin) # wait til template window gone # if they typed in w/o asterisks.. doc = self.doctemplate.get() if len(doc) > 0: self.docfile = doc if string.find(doc,"*") < 0: tmp = Spiderutils.name2template(doc) self.doctemplate.set(tmp) ser = self.sertemplate.get() if len(ser) > 0: self.serfile = ser if string.find(ser,"*") < 0: tmp = Spiderutils.name2template(ser) self.sertemplate.set(tmp)
def setTemplates(self, parent, which='doc'): filename = askopenfilename(parent=parent, filetypes=self.filetypes) if len(filename) < 1: return tmp = Spiderutils.name2template(filename) if which == 'doc': self.doctemplate.set(tmp) else: self.sertemplate.set(tmp)
found_counter = found_counter + 1 else: print "WARNING readSelections: image", key, filenumber, "not found" print found_counter, "keys found" else: print outfile, 'does not exist' if __name__ == "__main__": argCounter = 0 argCounter = argCounter + 1 if sys.argv[argCounter:]: file_example = sys.argv[argCounter:] nodeTemplate = Spiderutils.name2template(file_example[0]) # print 'file template:', nodeTemplate else: print print "syntax: tree.py node_img001.ext {selectfile.ext max_depth margin_width canvas_width}" print sys.exit() argCounter = argCounter + 1 if sys.argv[argCounter:]: max_depth = int(sys.argv[argCounter]) else: max_depth = 5 print 'max_depth:', max_depth argCounter = argCounter + 1
# This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. import sys from Spider import Spiderutils if sys.argv[1:]: filelist = sys.argv[1:] NodeTemplate = Spiderutils.name2template(filelist[0]) # print 'file template:', NodeTemplate else: print print "syntax: tree.py node_img001.ext {max_depth margin_width canvas_width}" print sys.exit() if sys.argv[2:]: maxDepth = int(sys.argv[2]) else: maxDepth = 6 print 'max_depth:', maxDepth last_node = 2**(maxDepth) - 1 last_file = Spiderutils.template2filename(NodeTemplate, n=last_node)
else : print "WARNING readSelections: image", key, filenumber, "not found" print found_counter, "keys found" else: print outfile, 'does not exist' if __name__ == "__main__": argCounter = 0 argCounter = argCounter + 1 if sys.argv[argCounter:] : file_example = sys.argv[argCounter:] nodeTemplate = Spiderutils.name2template(file_example[0]) # print 'file template:', nodeTemplate else : print print "syntax: tree.py node_img001.ext {selectfile.ext max_depth margin_width canvas_width}" print sys.exit() argCounter = argCounter + 1 if sys.argv[argCounter:] : max_depth = int(sys.argv[argCounter]) else : max_depth = 5 print 'max_depth:', max_depth argCounter = argCounter + 1