Ignore:
Timestamp:
Jan 10, 2011 12:40:16 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
d65a00a
Parents:
b5ca223
Message:

make calculator plugin inheriting brom pluginbase

File:
1 edited

Legend:

Unmodified
Added
Removed
  • calculatorview/perspectives/calculator/calculator.py

    r5cc393b8 ra0ac888  
    1212################################################################################ 
    1313 
    14 #import wx 
     14 
     15from sans.guiframe.plugin_base import PluginBase 
    1516import logging 
    1617 
    17 class Plugin: 
     18class Plugin(PluginBase): 
    1819    """ 
    1920    This class defines the interface for a Plugin class 
     
    2122    """ 
    2223    def __init__(self, standalone=True): 
    23         """ 
    24         Abstract class for gui_manager Plugins. 
    25         """ 
    26         ## Plug-in name. It will appear on the application menu. 
    27         self.sub_menu = "Calculator"         
    28         #standalone flag 
    29         self.standalone = standalone 
    30         ## Reference to the parent window. Filled by get_panels() below. 
    31         self.parent = None 
    32          
    33         ## List of panels that you would like to open in AUI windows 
    34         #  for your plug-in. This defines your plug-in "perspective" 
    35         self.perspective = [] 
     24        PluginBase.__init__(self, name="Calculator", standalone=standalone) 
    3625        # Log startup 
    3726        logging.info("Calculator plug-in started")    
    38          
    39     def populate_menu(self, id, owner): 
    40         """ 
    41         Create and return the list of application menu 
    42         items for the plug-in.  
    43          
    44         :param id: deprecated. Un-used. 
    45         :param parent: parent window 
    46          
    47         :return: plug-in menu 
    48          
    49         """ 
    50         return [] 
    51        
    52     def get_panels(self, parent): 
    53         """ 
    54         Create and return the list of wx.Panels for your plug-in. 
    55         Define the plug-in perspective. 
    56          
    57         Panels should inherit from DefaultPanel defined below, 
    58         or should present the same interface. They must define 
    59         "window_caption" and "window_name". 
    60          
    61         :param parent: parent window 
    62          
    63         :return: list of panels 
    64          
    65         """ 
    66         ## Save a reference to the parent 
    67         self.parent = parent 
    68         
    69         return [] 
    70         
    71      
     27   
    7228    def help(self, evt): 
    7329        """ 
     
    8036        frame = HelpWindow(None, -1)     
    8137        frame.Show(True) 
    82         #evt.Skip() 
    83          
    84     def get_context_menu(self, graph=None): 
    85         """ 
    86         This method is optional. 
    87      
    88         When the context menu of a plot is rendered, the  
    89         get_context_menu method will be called to give you a  
    90         chance to add a menu item to the context menu. 
    91          
    92         A ref to a Graph object is passed so that you can 
    93         investigate the plot content and decide whether you 
    94         need to add items to the context menu.   
    95          
    96         This method returns a list of menu items. 
    97         Each item is itself a list defining the text to  
    98         appear in the menu, a tool-tip help text, and a 
    99         call-back method. 
    100              
    101             @param graph: the Graph object to which we attach the context menu 
    102             @return: a list of menu items with call-back function 
    103         """ 
    104         return []     
    105      
    106     def get_perspective(self): 
    107         """ 
    108         Get the list of panel names for this perspective 
    109         """ 
    110         return self.perspective 
    111          
    112      
     38 
    11339    def get_tools(self): 
    11440        """ 
     
    186112        self.parent.set_perspective(self.perspective) 
    187113        event.Skip() 
    188          
    189     def post_init(self): 
    190         """ 
    191         Post initialization call back to close the loose ends 
    192         """ 
    193         pass 
     114 
    194115     
    195116   
Note: See TracChangeset for help on using the changeset viewer.