Changeset 1886 for trunk/python
- Timestamp:
- 08/21/10 22:05:59 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/notationwindow.py
r1885 r1886 28 28 def print_text(self): 29 29 """ 30 Print a note on a canvas specified with the Notation window. 31 Called when 'print' button selected on the window. 30 32 """ 31 33 anchor = self.anchors[self._get_anchval()] … … 246 248 """ 247 249 Cancel deleting the selected note. 248 Fired when 'Cancel' button selected on confirmation dialog250 Called when 'cancel' button selected on confirmation dialog. 249 251 """ 250 252 asaplog.push( "Cancel deleting: '"+self.seltext['textobj'].get_text()+"'" ) … … 262 264 class NotationWindowTkAgg(NotationWindowCommon): 263 265 """ 264 Backend based 266 Backend based class to create widgets to add, modify, or delete 267 note on the plot. 268 269 Note: 270 Press LEFT-mouse button on the plot to ADD a note on the canvas. 271 A notation window will be loaded for specifying note string and 272 anchor. The note will be anchored on a position in whether figure- 273 (0-1 relative in a figure), panel- (0-1 relative in a plot axes), 274 or data-coordinate (data value in a plot axes). 275 Press RIGHT-mouse button on a note to MODIFY/DELETE it. A cascade 276 menu will be displayed and you can select an operation. 265 277 """ 266 278 def __init__(self,master=None): … … 273 285 ### Notation window widget 274 286 def _create_textwindow(self,master=None): 287 """Create notation window widget and iconfy it""" 275 288 twin = Tk.Toplevel(padx=3,pady=3) 276 twin.title(" Annotation")289 twin.title("Notation") 277 290 twin.resizable(width=True,height=True) 278 291 self.textbox = self._NotationBox(parent=twin) … … 318 331 319 332 def _enable_radio(self): 333 """Enable 'panel' and 'data' radio button""" 320 334 self.rAxis.config(state=Tk.NORMAL) 321 335 self.rData.config(state=Tk.NORMAL) … … 324 338 325 339 def _reset_radio(self): 340 """Disable 'panel' and 'data' radio button""" 326 341 self.rAxis.config(state=Tk.DISABLED) 327 342 self.rData.config(state=Tk.DISABLED) … … 330 345 331 346 def _select_radio(self,selection): 347 """Select a specified radio button""" 332 348 if not selection in self.anchors: 333 349 return … … 340 356 341 357 def _get_anchval(self): 358 """Returns a integer of a selected radio button""" 342 359 return self.anchval.get() 343 360 344 361 def _get_note(self): 362 """Returns a note string specified in the text box""" 345 363 return self.textbox.get("1.0",Tk.END) 346 364 347 365 def _clear_textbox(self): 366 """Clear the text box""" 348 367 self.textbox.delete("1.0",Tk.END) 349 368 350 369 def _set_note(self,note=None): 370 """Set a note string to the text box""" 351 371 self._clear_textbox() 352 372 if len(note) >0: … … 368 388 369 389 def _cancel_text(self): 390 """ 391 Cancel adding/modifying a note and close notaion window. 392 called when 'cancel' is selected. 393 """ 370 394 self.close_textwindow() 371 395 372 396 def _print_text(self): 397 """ 398 Add/Modify a note. Called when 'print' is selected on the 399 notation window. 400 """ 373 401 self.print_text() 374 402 self.close_textwindow() … … 424 452 ### Modify/Delete menu widget 425 453 def _create_modmenu(self,master=None): 454 """Create modify/delete menu widget""" 426 455 if master: 427 456 self.parent = master … … 482 511 ### dialog to confirm deleting note 483 512 def _delnote_dialog(self): 513 """Load dialog to confirm deletion of the text""" 484 514 remind = "Delete text?\n '"+self.seltext['textobj'].get_text()+"'" 485 515 answer = tkMessageBox.askokcancel(parent=self.parent,title="Delete?", … … 493 523 ### helper functions 494 524 def _disppix2screen(self,xpixd,ypixd): 495 # calculate a pixel position form Upper-left of the SCREEN 496 # from a pixel from Lower-left of the CANVAS (e.g., event.x/y) 525 """ 526 helper function to calculate a pixel position form Upper-left 527 corner of the SCREEN from a pixel position (xpixd, ypixd) 528 from Lower-left of the CANVAS (which, e.g., event.x/y returns) 529 530 Returns: 531 (x, y): pixel position from Upper-left corner of the SCREEN. 532 """ 497 533 xpixs = self.parent.winfo_rootx() + xpixd 498 534 ypixs = self.parent.winfo_rooty() + self.parent.winfo_height() \
Note:
See TracChangeset
for help on using the changeset viewer.