version 1.2, 2003/06/10 18:57:30
|
version 1.3, 2003/06/10 19:45:26
|
Line 21 import anydbm
|
Line 21 import anydbm
|
import sys |
import sys |
import string |
import string |
|
|
dirprefix = "/home/httpd/html/adm/help/" |
dirprefix = "/home/jerf/loncapa/loncom/html/adm/help/tex/" |
|
|
class LatexSplitter: |
class LatexSplitter: |
def __init__(self, master): |
def __init__(self, master): |
Line 52 class LatexSplitter:
|
Line 52 class LatexSplitter:
|
def splitAndSave(self): |
def splitAndSave(self): |
selection = self.text.get("sel.first", "sel.last") |
selection = self.text.get("sel.first", "sel.last") |
topic = string.strip(self.topic.get("1.0", "end")) |
topic = string.strip(self.topic.get("1.0", "end")) |
filename = dirprefix + string.replace(topic, " ", "_") + ".tex" |
labelname = string.replace(topic, " ", "_") |
|
filename = dirprefix + labelname + ".tex" |
|
|
try: |
try: |
f = file(filename, 'w') |
f = file(filename, 'w') |
except: |
except: |
return |
return |
|
f.write("\\label{%s}\n\n" % labelname) |
f.write(selection) |
f.write(selection) |
f.close() |
f.close() |
|
|
Line 65 class LatexSplitter:
|
Line 67 class LatexSplitter:
|
self.text.delete("sel.first", "sel.last") |
self.text.delete("sel.first", "sel.last") |
|
|
f = file("latexSplitterTempResults", 'w') |
f = file("latexSplitterTempResults", 'w') |
f.write("\\label{%s}\n\n" % filename) |
f.write(self.text.get("1.0", END)) |
f.write(self.text.get("1.0", END)) |
|
f.close() |
f.close() |
|
|
root = Tk() |
root = Tk() |