def create_configure_dialog(self): if not self.dlg: self.dlg = SMLConsoleConfigDialog(self.get_data_dir()) dialog = self.dlg.dialog() window = gedit.app_get_default().get_active_window() if window: dialog.set_transient_for(window) return dialog # ex:et:ts=4:
class SMLConsolePlugin(gedit.Plugin): def __init__(self): gedit.Plugin.__init__(self) self.dlg = None def activate(self, window): console = SMLConsole(namespace = {'__builtins__' : __builtins__, 'gedit' : gedit, 'window' : window, 'datadir' : self.get_data_dir(), }) #console.eval('print "You can access the main window through ' \ # '\'window\' :\\n%s" % window', False) bottom = window.get_bottom_panel() image = gtk.Image() image.set_from_icon_name(SML_ICON, gtk.ICON_SIZE_MENU) bottom.add_item(console, 'SML Console', image) window.set_data('SMLConsolePluginInfo', console) def deactivate(self, window): console = window.get_data("SMLConsolePluginInfo") console.stop() window.set_data("SMLConsolePluginInfo", None) bottom = window.get_bottom_panel() bottom.remove_item(console) def is_configurable(self): return True def create_configure_dialog(self): if not self.dlg: self.dlg = SMLConsoleConfigDialog(self.get_data_dir()) dialog = self.dlg.dialog() window = gedit.app_get_default().get_active_window() if window: dialog.set_transient_for(window) return dialog # ex:et:ts=4: