[b5ca223] | 1 | |
---|
| 2 | |
---|
| 3 | ################################################################################ |
---|
| 4 | #This software was developed by the University of Tennessee as part of the |
---|
| 5 | #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
| 6 | #project funded by the US National Science Foundation. |
---|
| 7 | # |
---|
| 8 | #See the license text in license.txt |
---|
| 9 | # |
---|
| 10 | #copyright 2008, University of Tennessee |
---|
| 11 | ################################################################################ |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | class PanelBase: |
---|
| 15 | """ |
---|
| 16 | Defines the API for a panels to work with |
---|
| 17 | the ViewerFrame toolbar and menu bar |
---|
| 18 | """ |
---|
| 19 | ## Internal nickname for the window, used by the AUI manager |
---|
[691643c] | 20 | #window_name = "default" |
---|
[b5ca223] | 21 | ## Name to appear on the window title bar |
---|
[691643c] | 22 | #window_caption = "Welcome panel" |
---|
[b5ca223] | 23 | ## Flag to tell the AUI manager to put this panel in the center pane |
---|
[691643c] | 24 | #CENTER_PANE = True |
---|
[b5ca223] | 25 | |
---|
| 26 | def __init__(self): |
---|
| 27 | """ |
---|
| 28 | Initialize some flag that Viewerframe used |
---|
| 29 | """ |
---|
| 30 | self._print_flag = False |
---|
| 31 | self._undo_flag = False |
---|
| 32 | self._redo_flag = False |
---|
| 33 | self._preview_flag = False |
---|
| 34 | self._bookmark_flag = False |
---|
| 35 | self._zoom_in_flag = False |
---|
| 36 | self._zoom_out_flag = False |
---|
| 37 | self._zoom_flag = False |
---|
| 38 | self._save_flag = False |
---|
| 39 | self._drag_flag = False |
---|
| 40 | self._reset_flag = False |
---|
| 41 | |
---|
| 42 | def set_print_flag(self, flag=True): |
---|
| 43 | """ |
---|
| 44 | The derivative class sets the print flag value to indicate that it can |
---|
| 45 | be printed |
---|
| 46 | """ |
---|
| 47 | self._print_flag = flag |
---|
| 48 | |
---|
| 49 | def get_print_flag(self): |
---|
| 50 | """ |
---|
| 51 | Get the print flag to update appropriately the tool bar |
---|
| 52 | """ |
---|
| 53 | return self._print_flag |
---|
| 54 | |
---|
| 55 | def set_undo_flag(self, flag=True): |
---|
| 56 | """ |
---|
| 57 | The derivative class sets the undo flag value to indicate that the |
---|
| 58 | current action done can be canceled |
---|
| 59 | """ |
---|
| 60 | self._undo_flag = flag |
---|
| 61 | |
---|
| 62 | def get_undo_flag(self): |
---|
| 63 | """ |
---|
| 64 | Get the undo flag to update appropriately the tool bar |
---|
| 65 | """ |
---|
| 66 | return self._undo_flag |
---|
| 67 | |
---|
| 68 | def set_redo_flag(self, flag=True): |
---|
| 69 | """ |
---|
| 70 | The derivative class sets the redo flag value to indicate that the |
---|
| 71 | action done can be recovered |
---|
| 72 | """ |
---|
| 73 | self._redo_flag = flag |
---|
| 74 | |
---|
| 75 | def get_redo_flag(self): |
---|
| 76 | """ |
---|
| 77 | Get the redo flag to update appropriately the tool bar |
---|
| 78 | """ |
---|
| 79 | return self._redo_flag |
---|
| 80 | |
---|
| 81 | def set_zoomed_in_flag(self, flag=True): |
---|
| 82 | """ |
---|
| 83 | The derivative class sets the zoom in flag value to indicate that it |
---|
| 84 | can be zoomed in |
---|
| 85 | """ |
---|
| 86 | self._zoom_in_flag = flag |
---|
| 87 | |
---|
| 88 | def get_zoom_in_flag(self): |
---|
| 89 | """ |
---|
| 90 | Get the zoom in flag to update appropriately the tool bar |
---|
| 91 | """ |
---|
| 92 | return self._zoom_in_flag |
---|
| 93 | |
---|
| 94 | def set_zoomed_out_flag(self, flag=True): |
---|
| 95 | """ |
---|
| 96 | The derivative class sets the zoom out flag value to indicate that it |
---|
| 97 | can be zoomed out |
---|
| 98 | """ |
---|
| 99 | self._zoom_out_flag = flag |
---|
| 100 | |
---|
| 101 | def get_zoom_out_flag(self): |
---|
| 102 | """ |
---|
| 103 | Get the zoom out flag to update appropriately the tool bar |
---|
| 104 | """ |
---|
| 105 | return self._zoom_out_flag |
---|
| 106 | |
---|
| 107 | def set_zoom_flag(self, flag=True): |
---|
| 108 | """ |
---|
| 109 | The derivative class sets the zoom flag value to indicate that it |
---|
| 110 | can be zoomed |
---|
| 111 | """ |
---|
| 112 | self._zoom_flag = flag |
---|
| 113 | |
---|
| 114 | def get_zoom_flag(self): |
---|
| 115 | """ |
---|
| 116 | Get the zoom flag to update appropriately the tool bar |
---|
| 117 | """ |
---|
| 118 | return self._zoom_flag |
---|
| 119 | |
---|
| 120 | def set_bookmark_flag(self, flag=True): |
---|
| 121 | """ |
---|
| 122 | The derivative class sets the bookmark flag value to indicate that it |
---|
| 123 | can be bookmarked |
---|
| 124 | """ |
---|
| 125 | self._bookmark_flag = flag |
---|
| 126 | |
---|
| 127 | def get_bookmark_flag(self): |
---|
| 128 | """ |
---|
| 129 | Get the bookmark flag to update appropriately the tool bar |
---|
| 130 | """ |
---|
| 131 | return self._bookmark_flag |
---|
| 132 | |
---|
| 133 | def set_preview_flag(self, flag=True): |
---|
| 134 | """ |
---|
| 135 | The derivative class sets the preview flag value to indicate that it |
---|
| 136 | can be previewed |
---|
| 137 | """ |
---|
| 138 | self._preview_flag = flag |
---|
| 139 | |
---|
| 140 | def get_preview_flag(self): |
---|
| 141 | """ |
---|
| 142 | Get the preview flag to update appropriately the tool bar |
---|
| 143 | """ |
---|
| 144 | return self._preview_flag |
---|
| 145 | |
---|
| 146 | def set_save_flag(self, flag=True): |
---|
| 147 | """ |
---|
| 148 | The derivative class sets the drag flag value to indicate that it |
---|
| 149 | can be saved |
---|
| 150 | """ |
---|
| 151 | self._save_flag = flag |
---|
| 152 | |
---|
| 153 | def get_save_flag(self): |
---|
| 154 | """ |
---|
| 155 | Get the save flag to update appropriately the tool bar |
---|
| 156 | """ |
---|
| 157 | return self._save_flag |
---|
| 158 | |
---|
| 159 | def set_drag_flag(self, flag=True): |
---|
| 160 | """ |
---|
| 161 | The derivative class sets the drag flag value to indicate that |
---|
| 162 | dragging motion is possible |
---|
| 163 | """ |
---|
| 164 | self._drag_flag = flag |
---|
| 165 | |
---|
| 166 | def get_drag_flag(self): |
---|
| 167 | """ |
---|
| 168 | Get the drag flag to update appropriately the tool bar |
---|
| 169 | """ |
---|
| 170 | return self._drag_flag |
---|
| 171 | |
---|
| 172 | def set_reset_flag(self, flag=True): |
---|
| 173 | """ |
---|
| 174 | The derivative class sets the reset flag value to indicate that it |
---|
| 175 | can be reset |
---|
| 176 | """ |
---|
| 177 | self._reset_flag = flag |
---|
| 178 | |
---|
| 179 | def get_reset_flag(self): |
---|
| 180 | """ |
---|
| 181 | Get the reset flag to update appropriately the tool bar |
---|
| 182 | """ |
---|
| 183 | return self._reset_flag |
---|
| 184 | |
---|
| 185 | def on_reset(self, event): |
---|
| 186 | """ |
---|
| 187 | The derivative class state is restored |
---|
| 188 | """ |
---|
| 189 | def on_drag(self, event): |
---|
| 190 | """ |
---|
| 191 | The derivative class allows dragging motion if implemented |
---|
| 192 | """ |
---|
| 193 | def on_preview(self, event): |
---|
| 194 | """ |
---|
| 195 | Display a printable version of the class derivative |
---|
| 196 | """ |
---|
| 197 | def on_save(self, event): |
---|
| 198 | """ |
---|
| 199 | The state of the derivative class is restored |
---|
| 200 | """ |
---|
| 201 | def on_redo(self, event): |
---|
| 202 | """ |
---|
| 203 | The previous action is restored if possible |
---|
| 204 | """ |
---|
| 205 | def on_undo(self, event): |
---|
| 206 | """ |
---|
| 207 | The current action is canceled |
---|
| 208 | """ |
---|
| 209 | def on_bookmark(self, event): |
---|
| 210 | """ |
---|
| 211 | The derivative class is on bookmark mode if implemented |
---|
| 212 | """ |
---|
| 213 | def on_zoom_in(self, event): |
---|
| 214 | """ |
---|
| 215 | The derivative class is on zoom in mode if implemented |
---|
| 216 | """ |
---|
| 217 | def on_zoom_out(self, event): |
---|
| 218 | """ |
---|
| 219 | The derivative class is on zoom out mode if implemented |
---|
| 220 | """ |
---|
| 221 | def on_zoom(self, event): |
---|
| 222 | """ |
---|
| 223 | The derivative class is on zoom mode (using pane) |
---|
| 224 | if zoom mode is implemented |
---|
| 225 | """ |
---|
| 226 | def on_set_focus(self, event): |
---|
| 227 | """ |
---|
| 228 | The derivative class is on focus if implemented |
---|
| 229 | """ |
---|
| 230 | |
---|
| 231 | |
---|