def add_options(dialog, settings, top): from Tkinter import X import tktools htmlfr = tktools.make_group_frame(top, "html", "HTML options:", fill=X) # Image printing controls: dialog.__imgchecked = dialog.new_checkbox( htmlfr, "Print images", settings.imageflag) dialog.__greychecked = dialog.new_checkbox( htmlfr, "Reduce images to greyscale", settings.greyscale) # Anchor-handling selections: dialog.__footnotechecked = dialog.new_checkbox( htmlfr, "Footnotes for anchors", settings.footnoteflag) dialog.__underchecked = dialog.new_checkbox( htmlfr, "Underline anchors", settings.underflag)
def add_options(dialog, settings, top): import Tkinter import tktools textfr = tktools.make_group_frame(top, "textoptions", "Text options:", fill=Tkinter.X) # The titleentry widget is used to set the title for text/plain # documents; the title is printed in the page headers and # possibly on an accounting page if your site uses them. dialog.__titleentry, dummyframe = tktools.make_form_entry(textfr, "Title:") if dialog.title: dialog.__titleentry.insert(Tkinter.END, dialog.title) dialog.add_entry(dialog.__titleentry) Tkinter.Frame(textfr, height=4).pack() dialog.__strip_blanks = dialog.new_checkbox( textfr, "Strip leading blank lines", settings.strip_blanks)
def add_options(dialog, settings, top): from Tkinter import X import tktools htmlfr = tktools.make_group_frame(top, "html", "HTML options:", fill=X) # Image printing controls: dialog.__imgchecked = dialog.new_checkbox(htmlfr, "Print images", settings.imageflag) dialog.__greychecked = dialog.new_checkbox(htmlfr, "Reduce images to greyscale", settings.greyscale) # Anchor-handling selections: dialog.__footnotechecked = dialog.new_checkbox(htmlfr, "Footnotes for anchors", settings.footnoteflag) dialog.__underchecked = dialog.new_checkbox(htmlfr, "Underline anchors", settings.underflag)
def add_options(dialog, settings, top): import Tkinter import tktools textfr = tktools.make_group_frame(top, "textoptions", "Text options:", fill=Tkinter.X) # The titleentry widget is used to set the title for text/plain # documents; the title is printed in the page headers and # possibly on an accounting page if your site uses them. dialog.__titleentry, dummyframe = tktools.make_form_entry(textfr, "Title:") if dialog.title: dialog.__titleentry.insert(Tkinter.END, dialog.title) dialog.add_entry(dialog.__titleentry) Tkinter.Frame(textfr, height=4).pack() dialog.__strip_blanks = dialog.new_checkbox(textfr, "Strip leading blank lines", settings.strip_blanks)
def __init__(self, context, url, title, infp, ctype): import tktools # self.infp = infp self.ctype = ctype self.context = context self.baseurl = context.get_baseurl() self.prefs = context.app.prefs self.settings = printing.settings.get_settings(context.app.prefs) if USER_DATA_DIR not in self.settings.user_data_dirs: self.settings.user_data_dirs.append(USER_DATA_DIR) settings = self.settings # self.title = title self.master = self.context.root self.root = tktools.make_toplevel(self.master, title="Print Dialog", class_="PrintDialog") # do this early in case we're debugging: self.root.protocol('WM_DELETE_WINDOW', self.cancel_command) self.root.bind("<Alt-w>", self.cancel_event) self.root.bind("<Alt-W>", self.cancel_event) self.cursor_widgets = [self.root] fr, top, botframe = tktools.make_double_frame(self.root) # Print to file controls: generalfr = tktools.make_group_frame( top, "general", "General options:", fill=X) self.cmd_entry, dummyframe = tktools.make_form_entry( generalfr, "Print command:") self.cmd_entry.insert(END, settings.printcmd) self.add_entry(self.cmd_entry) self.printtofile = IntVar(self.root) self.printtofile.set(settings.fileflag) fr = Frame(generalfr) fr.pack(fill=X) self.file_check = Checkbutton(fr, text = "Print to file:", command = self.check_command, variable = self.printtofile) self.file_check.pack(side=LEFT) self.file_entry = Entry(fr) self.file_entry.pack(side=RIGHT, fill=X) self.file_entry.insert(END, settings.printfile) self.add_entry(self.file_entry) if self.ctype != "application/postscript": # page orientation Frame(generalfr, height=2).pack() fr = Frame(generalfr) fr.pack(fill=X) self.orientation = StringVar(top) self.orientation.set(string.capitalize(settings.orientation)) opts = printing.paper.paper_rotations.keys() opts.sort() opts = tuple(map(string.capitalize, opts)) Label(fr, text="Orientation: ", width=13, anchor=E).pack(side=LEFT) Frame(fr, width=3).pack(side=LEFT) menu = apply(OptionMenu, (fr, self.orientation) + opts) width = reduce(max, map(len, opts), 6) menu.config(anchor=W, highlightthickness=0, width=width) menu.pack(expand=1, fill=NONE, anchor=W, side=LEFT) Frame(generalfr, height=2).pack() # font size fr = Frame(generalfr) fr.pack(fill=X) Label(fr, text="Font size: ", width=13, anchor=E).pack(side=LEFT) Frame(fr, width=3).pack(side=LEFT) e = self.fontsize = Entry(fr, width=12) e.insert(END, settings.get_fontspec()) e.pack(side=LEFT) self.add_entry(e) self.mod = self.get_type_extension() if self.mod.add_options: Frame(top, height=8).pack() self.mod.add_options(self, settings, top) # Command buttons: ok_button = Button(botframe, text="OK", command=self.ok_command) ok_button.pack(side=LEFT) cancel_button = Button(botframe, text="Cancel", command=self.cancel_command) cancel_button.pack(side=RIGHT) tktools.unify_button_widths(ok_button, cancel_button) tktools.set_transient(self.root, self.master) self.check_command()