def __init__(self, master, netloc, realmvalue): self.root = tktools.make_toplevel(master, title="Authentication Dialog") self.prompt = Label(self.root, text="Enter user authentication\nfor %s on %s" % (realmvalue, netloc)) self.prompt.pack(side=TOP) self.user_entry, dummy = tktools.make_form_entry(self.root, "User:"******"Password:"******"*") self.passwd_entry.bind('<Return>', self.ok_command) self.ok_button = Button(self.root, text="OK", command=self.ok_command) self.ok_button.pack(side=LEFT) self.cancel_button = Button(self.root, text="Cancel", command=self.cancel_command) self.cancel_button.pack(side=RIGHT) self.user_passwd = None tktools.set_transient(self.root, master) self.root.grab_set()
def create_widgets(self): import tktools x, f, self.bot_frame = tktools.make_double_frame(self._root) self.pat_entry, self.pat_frame = tktools.make_form_entry(f, None, name="entry") self.pat_entry["exportselection"] = 0 self.pat_entry.bind("<Return>", self.return_event) self.pat_entry.focus_set() self.mid_frame = Frame(f) self.mid_frame.pack(fill=X) self.regexp_var = BooleanVar(f) self.case_var = BooleanVar(f) self.backwards_var = BooleanVar(f) self.regexp_checkbutton = Checkbutton(self._root, name="regexp", variable=self.regexp_var) self.regexp_checkbutton.pack(side=LEFT, in_=self.mid_frame) self.case_checkbutton = Checkbutton(self._root, name="casesens", variable=self.case_var) self.case_checkbutton.pack(side=LEFT, expand=1, in_=self.mid_frame) self.backwards_checkbutton = Checkbutton(self._root, name="backwards", variable=self.backwards_var) self.backwards_checkbutton.pack(side=RIGHT, in_=self.mid_frame) # buttons along the bottom self.search_button = Button(self._root, name="search", width=12, command=self.search_command) self.search_button.pack(side=LEFT, in_=self.bot_frame) self.search_close_button = Button(self._root, name="searchclose", command=self.search_close_command) self.search_close_button.pack(side=LEFT, expand=1, padx="1m", in_=self.bot_frame) # Center self.close_button = Button(self._root, name="close", width=12, command=self.close_command) self.close_button.pack(side=RIGHT, in_=self.bot_frame) self._root.protocol("WM_DELETE_WINDOW", self.close_command) self._root.bind("<Alt-w>", self.close_event) self._root.bind("<Alt-W>", self.close_event)
def create_widgets(self): import tktools x, f, self.bot_frame = tktools.make_double_frame(self._root) self.pat_entry, self.pat_frame = \ tktools.make_form_entry(f, None, name="entry") self.pat_entry['exportselection'] = 0 self.pat_entry.bind('<Return>', self.return_event) self.pat_entry.focus_set() self.mid_frame = Frame(f) self.mid_frame.pack(fill=X) self.regexp_var = BooleanVar(f) self.case_var = BooleanVar(f) self.backwards_var = BooleanVar(f) self.regexp_checkbutton = Checkbutton(self._root, name="regexp", variable=self.regexp_var) self.regexp_checkbutton.pack(side=LEFT, in_=self.mid_frame) self.case_checkbutton = Checkbutton(self._root, name="casesens", variable=self.case_var) self.case_checkbutton.pack(side=LEFT, expand=1, in_=self.mid_frame) self.backwards_checkbutton = Checkbutton(self._root, name="backwards", variable=self.backwards_var) self.backwards_checkbutton.pack(side=RIGHT, in_=self.mid_frame) # buttons along the bottom self.search_button = Button(self._root, name="search", width=12, command=self.search_command) self.search_button.pack(side=LEFT, in_=self.bot_frame) self.search_close_button = Button(self._root, name="searchclose", command=self.search_close_command) self.search_close_button.pack(side=LEFT, expand=1, padx='1m', in_=self.bot_frame) # Center self.close_button = Button(self._root, name="close", width=12, command=self.close_command) self.close_button.pack(side=RIGHT, in_=self.bot_frame) self._root.protocol('WM_DELETE_WINDOW', self.close_command) self._root.bind("<Alt-w>", self.close_event) self._root.bind("<Alt-W>", self.close_event)
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): 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()