def create_widget(self): widget = self.widget = tktools.make_toplevel(self.frame, class_='Preferences') widget.title(self.title) widget.iconname("Grail Prefs") tktools.install_keybindings(widget) widget.bind('<Return>', self.done_cmd) widget.bind('<Key>', self.poll_modified) widget.bind("<Alt-w>", self.cancel_cmd) widget.bind("<Alt-W>", self.cancel_cmd) widget.bind("<Alt-Control-r>", self.reload_panel_cmd) widget.bind("<Alt-Control-d>", self.toggle_debugging) widget.bind('<ButtonPress>', self.poll_modified) # same as <Button> widget.bind('<ButtonRelease>', self.poll_modified) widget.protocol('WM_DELETE_WINDOW', self.cancel_cmd) width = 80 # Of the settings frame. fr, container, self.dispose_bar = tktools.make_double_frame(widget) # Do this before the panel container, so the buttons are squoze last: self.create_disposition_bar(self.dispose_bar) # Frame for the user to build within: self.framework_widget = container container.pack(side=TOP, fill=BOTH, expand=1, padx='2m', pady='2m') # Do the user's setup: self.CreateLayout(self.name, container) # And now initialize the widget values: self.set_widgets() if self.app.prefs.GetBoolean('preferences', 'panel-debugging'): self.toggle_debugging(enable=1)
def create_widget(self): widget = self.widget = tktools.make_toplevel( self.frame, class_='Preferences') widget.title(self.title) widget.iconname("Grail Prefs") tktools.install_keybindings(widget) widget.bind('<Return>', self.done_cmd) widget.bind('<Key>', self.poll_modified) widget.bind("<Alt-w>", self.cancel_cmd) widget.bind("<Alt-W>", self.cancel_cmd) widget.bind("<Alt-Control-r>", self.reload_panel_cmd) widget.bind("<Alt-Control-d>", self.toggle_debugging) widget.bind('<ButtonPress>', self.poll_modified) # same as <Button> widget.bind('<ButtonRelease>', self.poll_modified) widget.protocol('WM_DELETE_WINDOW', self.cancel_cmd) width=80 # Of the settings frame. fr, container, self.dispose_bar = tktools.make_double_frame(widget) # Do this before the panel container, so the buttons are squoze last: self.create_disposition_bar(self.dispose_bar) # Frame for the user to build within: self.framework_widget = container container.pack(side=TOP, fill=BOTH, expand=1, padx='2m', pady='2m') # Do the user's setup: self.CreateLayout(self.name, container) # And now initialize the widget values: self.set_widgets() if self.app.prefs.GetBoolean('preferences', 'panel-debugging'): self.toggle_debugging(enable=1)
import __main__ __main__.app = app __main__.GRAILVERSION = GRAILVERSION def load_images_vis_prefs(app=app): app.load_images = app.prefs.GetBoolean('browser', 'load-images') try: app.load_images = load_images except NameError: load_images_vis_prefs() prefs.AddGroupCallback('browser', load_images_vis_prefs) import SafeTkinter SafeTkinter._castrate(app.root.tk) tktools.install_keybindings(app.root) # Make everybody who's still using urllib.urlopen go through the cache urllib.urlopen = app.open_url_simple # Add $GRAILDIR/user/ to sys.path subdir = os.path.join(app.graildir, 'user') if subdir not in sys.path: sys.path.insert(0, subdir) # Import user's grail startup file, defined as # $GRAILDIR/user/grailrc.py if it exists. if user_init: try: import grailrc except ImportError, e: # Only catch this is grailrc itself doesn't import,
import __main__ __main__.app = app __main__.GRAILVERSION = GRAILVERSION def load_images_vis_prefs(app=app): app.load_images = app.prefs.GetBoolean('browser', 'load-images') try: app.load_images = load_images except NameError: load_images_vis_prefs() prefs.AddGroupCallback('browser', load_images_vis_prefs) import SafeTkinter SafeTkinter._castrate(app.root.tk) tktools.install_keybindings(app.root) # Make everybody who's still using urllib.urlopen go through the cache urllib.urlopen = app.open_url_simple # Add $GRAILDIR/user/ to sys.path subdir = os.path.join(app.graildir, 'user') if subdir not in sys.path: sys.path.insert(0, subdir) # Import user's grail startup file, defined as # $GRAILDIR/user/grailrc.py if it exists. if user_init: try: import grailrc except ImportError, e: # Only catch this if grailrc itself doesn't import,