home *** CD-ROM | disk | FTP | other *** search
- #
- # Windowsystem dependent part of application class
- #
- import TwitCore
- import xxtwit_mod
- import xxtwit_stack
- #import xxtwit_browser
- import xxtwit_edit
-
- class Twit(TwitCore.Application):
- """The twit main class - Window-dependent part"""
-
- def __init__(self, sessiontype, arg=None):
- self.setstate(sessiontype)
- self.real_quit = 0
-
- # Next create our dialogs
- self.mi_init(sessiontype, arg)
- while 1:
- if self.real_quit:
- break
- if self.initial_cmd:
- self.to_debugger() # Will get to mainloop via debugger
- else:
- self.one_mainloop() # Else do it ourselves.
-
- def switch_to_app(self):
- """Tell windowsystem we are switching to the app"""
- pass
-
- def switch_to_dbg(self):
- """Tell windowsystem we are switching to the debugger"""
- pass
-
-
- def setstate(self, state):
- """Change UI-element state based on self.state"""
- pass
-
- def asknewsession(self):
- """Ask user whether aborting current session is ok"""
- if self.state == 'none':
- return 1
- pass # Ask whether it is ok to abort current session
- return 0
-
- def exit_mainloop(self):
- """Signal UI-mainloop to exit"""
- pass # Quit windowinterface mainloop
- self.real_quit = 0
-
- def one_mainloop(self):
- """Dive into UI mainloop until exit_mainloop() is called"""
- pass
-
- # Open various windows
- def new_module_browser(self, parent):
- """Open a module browser"""
- return mactwit_mod.ModuleBrowser(parent)
-
- def new_stack_browser(self, parent):
- """Open a stack browser/main window"""
- return mactwit_stack.StackBrowser(parent)
-
- def new_var_browser(self, parent, var):
- """Open a variable browser"""
- return mactwit_browser.VarBrowser(parent).open(var)
-
- def edit(self, file, line):
- """Edit a file"""
- return mactwit_edit(file, line)
-
- # Convenience functions
- def SetCursor(self):
- """Set cursor to arrow"""
- pass
-
- def SetWatch(self):
- """Set cursor to watch"""
- pass
-
- def AskString(self, *args):
- """Ask the user for a string"""
- pass
-
- def Message(self, *args):
- """Show the user a message"""
- pass
-
- # Callbacks from menus/buttons
-
- def do_open(self, *args):
- if not self.asknewsession():
- return
- filename = None # Ask for file
- self.runfile(filename)
-
- def do_run(self, *args):
- if not self.asknewsession():
- return
- self.run()
-
- def do_quit(self, *args):
- self.exit_mainloop()
- self.real_quit = 1
- self.quit_bdb() # Tell debugger to quit.
-
- def do_step(self, *args):
- self.run_dialog.click_step()
-
- def do_stepin(self, *args):
- self.run_dialog.click_step_in()
-
- def do_stepout(self, *args):
- self.run_dialog.click_step_out()
-
- def do_continue(self, *args):
- self.run_dialog.click_continue()
-
- def do_kill(self, *args):
- self.run_dialog.click_kill()
-
- def Initialize():
- pass # Do window-system dependent initializations
-