home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / gedit-2 / plugins / pythonconsole / __init__.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  2.2 KB  |  53 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import gtk
  5. import gedit
  6. from console import PythonConsole
  7. from config import PythonConsoleConfigDialog
  8.  
  9. class PythonConsolePlugin(gedit.Plugin):
  10.     
  11.     def __init__(self):
  12.         gedit.Plugin.__init__(self)
  13.         self.dlg = None
  14.  
  15.     
  16.     def activate(self, window):
  17.         console = PythonConsole(namespace = {
  18.             '__builtins__': __builtins__,
  19.             'gedit': gedit,
  20.             'window': window })
  21.         console.eval('print "You can access the main window through \'window\' :\\n%s" % window', False)
  22.         bottom = window.get_bottom_panel()
  23.         image = gtk.Image()
  24.         image.set_from_icon_name('gnome-mime-text-x-python', gtk.ICON_SIZE_MENU)
  25.         bottom.add_item(console, _('Python Console'), image)
  26.         window.set_data('PythonConsolePluginInfo', console)
  27.  
  28.     
  29.     def deactivate(self, window):
  30.         console = window.get_data('PythonConsolePluginInfo')
  31.         console.stop()
  32.         window.set_data('PythonConsolePluginInfo', None)
  33.         bottom = window.get_bottom_panel()
  34.         bottom.remove_item(console)
  35.  
  36.     
  37.     def is_configurable(self):
  38.         return True
  39.  
  40.     
  41.     def create_configure_dialog(self):
  42.         if not self.dlg:
  43.             self.dlg = PythonConsoleConfigDialog(self.get_data_dir())
  44.         
  45.         dialog = self.dlg.dialog()
  46.         window = gedit.app_get_default().get_active_window()
  47.         if window:
  48.             dialog.set_transient_for(window)
  49.         
  50.         return dialog
  51.  
  52.  
  53.