/usr/lib/python2.7/dist-packages/ginga/GingaPlugin.py is in python-ginga 2.6.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | #
# GingaPlugin.py -- Base classes for plugins in Ginga reference viewer
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
from ginga.misc import Bunch
class PluginError(Exception):
pass
class GlobalPlugin(object):
def __init__(self, fv):
super(GlobalPlugin, self).__init__()
self.fv = fv
self.logger = fv.logger
# Holds GUI widgets
self.w = Bunch.Bunch()
def initialize(self, container):
"""This method will be called with a container widget if the global
plugin was requested to be loaded into a workspace. The plugin should
construct its GUI and pack it into the container.
"""
pass
def start(self):
"""This method is called to start the plugin. It is called after
build_gui().
"""
pass
def stop(self):
"""This method is called to stop the plugin.
"""
pass
def redo(self, channel, image):
"""This method is called when an image is set in a channel.
"""
pass
class LocalPlugin(object):
def __init__(self, fv, fitsimage):
super(LocalPlugin, self).__init__()
self.fv = fv
self.logger = fv.logger
self.fitsimage = fitsimage
# find our channel info
if self.fitsimage is not None:
self.chname = self.fv.get_channel_name(self.fitsimage)
self.channel = self.fv.get_channel(self.chname)
# TO BE DEPRECATED
self.chinfo = self.channel
# Holds GUI widgets
self.w = Bunch.Bunch()
def modes_off(self):
# turn off any mode user may be in
bm = self.fitsimage.get_bindmap()
bm.reset_mode(self.fitsimage)
# def build_gui(self, container):
# """If a plugin defines this method, it will be called with a
# container object in which to build its GUI. It should finish
# by packing into this container. This will be called every
# time the local plugin is activated.
# """
# pass
def start(self):
"""This method is called just after build_gui() when the plugin is
activated.
"""
pass
def stop(self):
"""This method is called when the plugin is deactivated.
"""
pass
def pause(self):
"""This method is called when the plugin is defocused. The plugin
should disable any user input that it responds to.
"""
pass
def resume(self):
"""This method is called when the plugin is focused. The plugin
should enable any user input that it responds to.
"""
pass
def redo(self):
"""This method is called when a new image arrives in the channel
associated with the plugin. It can optionally redo whatever operation
it is doing.
"""
pass
#END
|