def test_view_file(self): test_dir = os.path.dirname(__file__) testfile = os.path.join(test_dir, 'test_textview.py') view = tv.view_file(root, 'Title', testfile, modal=False) self.assertIsInstance(view, tv.TextViewer) self.assertIn('Test', view.textView.get('1.0', '1.end')) view.Ok() # Mock messagebox will be used and view_file will not return anything testfile = os.path.join(test_dir, '../notthere.py') view = tv.view_file(root, 'Title', testfile, modal=False) self.assertIsNone(view)
def test_view_file(self): test_dir = os.path.dirname(__file__) testfile = os.path.join(test_dir, "test_textview.py") view = tv.view_file(self.root, "Title", testfile, modal=False) self.assertIsInstance(view, tv.TextViewer) self.assertIn("Test", view.textView.get("1.0", "1.end")) view.Ok() # Mock messagebox will be used and view_file will not return anything testfile = os.path.join(test_dir, "../notthere.py") view = tv.view_file(self.root, "Title", testfile, modal=False) self.assertIsNone(view)
def display_file_text(self, title, filename, encoding=None): fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), filename) textView.view_file(self, title, fn, encoding)
def help_dialog(event=None): from idlelib import textView fn = path.join(path.abspath(path.dirname(__file__)), 'help.txt') textView.view_file(root, 'Help', fn)
def show(help_label=help_label, help_file=help_file): view_file(self.root, help_label, os.path.join(demo_dir, help_file))
def showAboutTurtle(): view_file(demo.root, "About the new turtle module.", os.path.join(demo_dir, "about_turtle.txt"))
def showAboutDemo(): view_file(demo.root, "About turtleDemo", "about_turtledemo.txt")
def showAboutDemo(): view_file(demo.root, "About turtleDemo", os.path.join(demo_dir, "about_turtledemo.txt"))
def help_dialog(self, event=None): fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'help.txt') textView.view_file(self.top, 'Help', fn)
def showAboutTurtle(): view_file(demo.root, "About the new turtle module.", "about_turtle.txt")
def showDemoHelp(): view_file(demo.root, "Help on turtleDemo", os.path.join(demo_dir, "demohelp.txt"))
def showDemoHelp(): view_file(demo.root, "Help on turtleDemo", "demohelp.txt")