Changeset d68c655 in sasview for guiframe/dummyapp.py
- Timestamp:
- Jan 18, 2010 11:57:10 AM (15 years ago)
- 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:
- e6b9723
- Parents:
- 52070a1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/dummyapp.py
r7bb61da rd68c655 4 4 """ 5 5 import gui_manager 6 7 class TestPlugin(gui_manager.Plugin): 8 9 def populate_menu(self, id, parent): 10 """ 11 Create and return the list of application menu 12 items for the plug-in. 13 14 @param id: deprecated. Un-used. 15 @param parent: parent window 16 @return: plug-in menu 17 """ 18 import wx 19 # Create a menu 20 plug_menu = wx.Menu() 21 22 # Always get event IDs from wx 23 id = wx.NewId() 24 25 # Fill your menu 26 plug_menu.Append(id, '&Do something') 27 def _on_do_something(event): 28 print "Do something" 29 wx.EVT_MENU(self.parent, id, _on_do_something) 30 31 # Returns the menu and a name for it. 32 return [(id, plug_menu, "DummyApp")] 33 34 def get_panels(self, parent): 35 """ 36 Create and return the list of wx.Panels for your plug-in. 37 Define the plug-in perspective. 38 39 Panels should inherit from DefaultPanel defined below, 40 or should present the same interface. They must define 41 "window_caption" and "window_name". 42 43 @param parent: parent window 44 @return: list of panels 45 """ 46 ## Save a reference to the parent 47 self.parent = parent 48 49 # Define a panel 50 defaultpanel = gui_manager.DefaultPanel(self.parent, -1) 51 defaultpanel.window_name = "Test" 52 53 # If needed, add its name to the perspective list 54 self.perspective = [defaultpanel.window_name] 55 56 # Return the list of panels 57 return [defaultpanel] 58 59 def get_tools(self): 60 """ 61 Returns a set of menu entries for tools 62 """ 63 def _test_dialog(event): 64 import wx 65 frame = wx.Dialog(None, -1, 'Test Tool') 66 frame.Show(True) 67 return [["Tool 1", "This is an example tool", _test_dialog], 68 ["Tool 2", "This is another example tool", _test_dialog]] 69 70 def get_context_menu(self, graph=None): 71 """ 72 This method is optional. 73 74 When the context menu of a plot is rendered, the 75 get_context_menu method will be called to give you a 76 chance to add a menu item to the context menu. 77 78 A ref to a Graph object is passed so that you can 79 investigate the plot content and decide whether you 80 need to add items to the context menu. 81 82 This method returns a list of menu items. 83 Each item is itself a list defining the text to 84 appear in the menu, a tool-tip help text, and a 85 call-back method. 86 87 @param graph: the Graph object to which we attach the context menu 88 @return: a list of menu items with call-back function 89 """ 90 return [["Menu text", 91 "Tool-tip help text", 92 self._on_context_do_something]] 6 93 7 94 class SansView(): … … 11 98 Initialization 12 99 """ 13 from gui_manager import ViewApp 14 self.gui = ViewApp(0) 100 self.gui = gui_manager.ViewApp(0) 101 102 fitting_plug = TestPlugin() 103 self.gui.add_perspective(fitting_plug) 15 104 16 105 # Build the GUI
Note: See TracChangeset
for help on using the changeset viewer.