Show More
@@ -339,148 +339,115 b' class MainWindow(QtGui.QMainWindow):' | |||||
339 | # sould wrap every line of the following block into a try/except, |
|
339 | # sould wrap every line of the following block into a try/except, | |
340 | # as we are not sure of instanciating a _frontend which support all |
|
340 | # as we are not sure of instanciating a _frontend which support all | |
341 | # theses actions, but there might be a better way |
|
341 | # theses actions, but there might be a better way | |
342 | try: |
|
342 | self.print_action = QtGui.QAction("&Print", | |
343 | self.print_action = QtGui.QAction("&Print", |
|
343 | self, | |
344 | self, |
|
344 | shortcut="Ctrl+P", | |
345 | shortcut="Ctrl+P", |
|
345 | triggered=self.print_action_active_frontend) | |
346 | triggered=self.print_action_active_frontend) |
|
346 | self.file_menu.addAction(self.print_action) | |
347 | self.file_menu.addAction(self.print_action) |
|
347 | ||
348 | except AttributeError: |
|
348 | self.export_action=QtGui.QAction("E&xport", | |
349 | self.log.error("trying to add unexisting action (print), skipping") |
|
349 | self, | |
350 |
|
350 | shortcut="Ctrl+S", | ||
351 | try: |
|
351 | triggered=self.export_action_active_frontend | |
352 | self.export_action=QtGui.QAction("E&xport", |
|
352 | ) | |
353 | self, |
|
353 | self.file_menu.addAction(self.export_action) | |
354 | shortcut="Ctrl+S", |
|
|||
355 | triggered=self.export_action_active_frontend |
|
|||
356 | ) |
|
|||
357 | self.file_menu.addAction(self.export_action) |
|
|||
358 | except AttributeError: |
|
|||
359 | self.log.error("trying to add unexisting action (Export), skipping") |
|
|||
360 |
|
||||
361 | try: |
|
|||
362 | self.select_all_action = QtGui.QAction("Select &All", |
|
|||
363 | self, |
|
|||
364 | shortcut="Ctrl+A", |
|
|||
365 | triggered=self.select_all_active_frontend |
|
|||
366 | ) |
|
|||
367 | self.file_menu.addAction(self.select_all_action) |
|
|||
368 | except AttributeError: |
|
|||
369 | self.log.error("trying to add unexisting action (select all), skipping") |
|
|||
370 |
|
||||
371 | try: |
|
|||
372 | self.undo_action = QtGui.QAction("&Undo", |
|
|||
373 | self, |
|
|||
374 | shortcut="Ctrl+Z", |
|
|||
375 | statusTip="Undo last action if possible", |
|
|||
376 | triggered=self.undo_active_frontend |
|
|||
377 | ) |
|
|||
378 | self.edit_menu.addAction(self.undo_action) |
|
|||
379 | except AttributeError: |
|
|||
380 | self.log.error("trying to add unexisting action (undo), skipping") |
|
|||
381 |
|
||||
382 | try: |
|
|||
383 | self.redo_action = QtGui.QAction("&Redo", |
|
|||
384 | self, |
|
|||
385 | shortcut="Ctrl+Shift+Z", |
|
|||
386 | statusTip="Redo last action if possible", |
|
|||
387 | triggered=self.redo_active_frontend) |
|
|||
388 | self.edit_menu.addAction(self.redo_action) |
|
|||
389 | except AttributeError: |
|
|||
390 | self.log.error("trying to add unexisting action (redo), skipping") |
|
|||
391 |
|
||||
392 | try: |
|
|||
393 | self.increase_font_size = QtGui.QAction("&Increase Font Size", |
|
|||
394 | self, |
|
|||
395 | shortcut="Ctrl++", |
|
|||
396 | triggered=self.increase_font_size_active_frontend |
|
|||
397 | ) |
|
|||
398 | self.font_menu.addAction(self.increase_font_size) |
|
|||
399 | except AttributeError: |
|
|||
400 | self.log.error("trying to add unexisting action (increase font size), skipping") |
|
|||
401 |
|
||||
402 | try: |
|
|||
403 | self.decrease_font_size = QtGui.QAction("&Decrease Font Size", |
|
|||
404 | self, |
|
|||
405 | shortcut="Ctrl+-", |
|
|||
406 | triggered=self.decrease_font_size_active_frontend |
|
|||
407 | ) |
|
|||
408 | self.font_menu.addAction(self.decrease_font_size) |
|
|||
409 | except AttributeError: |
|
|||
410 | self.log.error("trying to add unexisting action (decrease font size), skipping") |
|
|||
411 |
|
||||
412 | try: |
|
|||
413 | self.reset_font_size = QtGui.QAction("&Reset Font Size", |
|
|||
414 | self, |
|
|||
415 | shortcut="Ctrl+0", |
|
|||
416 | triggered=self.reset_font_size_active_frontend |
|
|||
417 | ) |
|
|||
418 | self.font_menu.addAction(self.reset_font_size) |
|
|||
419 | except AttributeError: |
|
|||
420 | self.log.error("trying to add unexisting action (reset font size), skipping") |
|
|||
421 |
|
||||
422 | try: |
|
|||
423 | self.reset_action = QtGui.QAction("&Reset", |
|
|||
424 | self, |
|
|||
425 | statusTip="Clear all varible from workspace", |
|
|||
426 | triggered=self.reset_magic_active_frontend) |
|
|||
427 | self.magic_menu.addAction(self.reset_action) |
|
|||
428 | except AttributeError: |
|
|||
429 | self.log.error("trying to add unexisting action (reset), skipping") |
|
|||
430 |
|
||||
431 | try: |
|
|||
432 | self.history_action = QtGui.QAction("&History", |
|
|||
433 | self, |
|
|||
434 | statusTip="show command history", |
|
|||
435 | triggered=self.history_magic_active_frontend) |
|
|||
436 | self.magic_menu.addAction(self.history_action) |
|
|||
437 | except AttributeError: |
|
|||
438 | self.log.error("trying to add unexisting action (history), skipping") |
|
|||
439 |
|
354 | |||
440 | try: |
|
355 | self.select_all_action = QtGui.QAction("Select &All", | |
441 | self.save_action = QtGui.QAction("E&xport History ", |
|
356 | self, | |
442 | self, |
|
357 | shortcut="Ctrl+A", | |
443 | statusTip="Export History as Python File", |
|
358 | triggered=self.select_all_active_frontend | |
444 | triggered=self.save_magic_active_frontend) |
|
359 | ) | |
445 |
|
|
360 | self.file_menu.addAction(self.select_all_action) | |
446 | except AttributeError: |
|
|||
447 | self.log.error("trying to add unexisting action (save), skipping") |
|
|||
448 |
|
361 | |||
449 | try: |
|
362 | self.undo_action = QtGui.QAction("&Undo", | |
450 | self.clear_action = QtGui.QAction("&Clear", |
|
363 | self, | |
451 | self, |
|
364 | shortcut="Ctrl+Z", | |
452 |
|
|
365 | statusTip="Undo last action if possible", | |
453 |
|
|
366 | triggered=self.undo_active_frontend | |
454 | self.magic_menu.addAction(self.clear_action) |
|
367 | ) | |
455 | except AttributeError: |
|
368 | self.edit_menu.addAction(self.undo_action) | |
456 | self.log.error("trying to add unexisting action, skipping") |
|
369 | ||
|
370 | self.redo_action = QtGui.QAction("&Redo", | |||
|
371 | self, | |||
|
372 | shortcut="Ctrl+Shift+Z", | |||
|
373 | statusTip="Redo last action if possible", | |||
|
374 | triggered=self.redo_active_frontend) | |||
|
375 | self.edit_menu.addAction(self.redo_action) | |||
|
376 | ||||
|
377 | self.increase_font_size = QtGui.QAction("&Increase Font Size", | |||
|
378 | self, | |||
|
379 | shortcut="Ctrl++", | |||
|
380 | triggered=self.increase_font_size_active_frontend | |||
|
381 | ) | |||
|
382 | self.font_menu.addAction(self.increase_font_size) | |||
457 |
|
383 | |||
458 | try: |
|
384 | self.decrease_font_size = QtGui.QAction("&Decrease Font Size", | |
459 | self.who_action = QtGui.QAction("&Who", |
|
385 | self, | |
460 | self, |
|
386 | shortcut="Ctrl+-", | |
461 | statusTip="List interactive variable", |
|
387 | triggered=self.decrease_font_size_active_frontend | |
462 | triggered=self.who_magic_active_frontend) |
|
388 | ) | |
463 |
|
|
389 | self.font_menu.addAction(self.decrease_font_size) | |
464 | except AttributeError: |
|
|||
465 | self.log.error("trying to add unexisting action (who), skipping") |
|
|||
466 |
|
390 | |||
467 | try: |
|
391 | self.reset_font_size = QtGui.QAction("&Reset Font Size", | |
468 | self.who_ls_action = QtGui.QAction("Wh&o ls", |
|
392 | self, | |
469 | self, |
|
393 | shortcut="Ctrl+0", | |
470 | statusTip="Return a list of interactive variable", |
|
394 | triggered=self.reset_font_size_active_frontend | |
471 | triggered=self.who_ls_magic_active_frontend) |
|
395 | ) | |
472 |
|
|
396 | self.font_menu.addAction(self.reset_font_size) | |
473 | except AttributeError: |
|
397 | ||
474 | self.log.error("trying to add unexisting action (who_ls), skipping") |
|
398 | self.reset_action = QtGui.QAction("&Reset", | |
|
399 | self, | |||
|
400 | statusTip="Clear all varible from workspace", | |||
|
401 | triggered=self.reset_magic_active_frontend) | |||
|
402 | self.magic_menu.addAction(self.reset_action) | |||
|
403 | ||||
|
404 | self.history_action = QtGui.QAction("&History", | |||
|
405 | self, | |||
|
406 | statusTip="show command history", | |||
|
407 | triggered=self.history_magic_active_frontend) | |||
|
408 | self.magic_menu.addAction(self.history_action) | |||
|
409 | ||||
|
410 | self.save_action = QtGui.QAction("E&xport History ", | |||
|
411 | self, | |||
|
412 | statusTip="Export History as Python File", | |||
|
413 | triggered=self.save_magic_active_frontend) | |||
|
414 | self.magic_menu.addAction(self.save_action) | |||
|
415 | ||||
|
416 | self.clear_action = QtGui.QAction("&Clear", | |||
|
417 | self, | |||
|
418 | statusTip="Clear the console", | |||
|
419 | triggered=self.clear_magic_active_frontend) | |||
|
420 | self.magic_menu.addAction(self.clear_action) | |||
|
421 | ||||
|
422 | self.who_action = QtGui.QAction("&Who", | |||
|
423 | self, | |||
|
424 | statusTip="List interactive variable", | |||
|
425 | triggered=self.who_magic_active_frontend) | |||
|
426 | self.magic_menu.addAction(self.who_action) | |||
|
427 | ||||
|
428 | self.who_ls_action = QtGui.QAction("Wh&o ls", | |||
|
429 | self, | |||
|
430 | statusTip="Return a list of interactive variable", | |||
|
431 | triggered=self.who_ls_magic_active_frontend) | |||
|
432 | self.magic_menu.addAction(self.who_ls_action) | |||
|
433 | ||||
|
434 | self.whos_action = QtGui.QAction("Who&s", | |||
|
435 | self, | |||
|
436 | statusTip="List interactive variable with detail", | |||
|
437 | triggered=self.whos_magic_active_frontend) | |||
|
438 | self.magic_menu.addAction(self.whos_action) | |||
|
439 | ||||
|
440 | self.intro_active_frontend_action = QtGui.QAction("intro", | |||
|
441 | self, | |||
|
442 | triggered=self.intro_active_frontend | |||
|
443 | ) | |||
|
444 | self.help_menu.addAction(self.intro_active_frontend_action) | |||
475 |
|
445 | |||
476 | try: |
|
446 | self.guiref_active_frontend_action = QtGui.QAction("guiref", | |
477 | self.whos_action = QtGui.QAction("Who&s", |
|
447 | self, | |
478 | self, |
|
448 | triggered=self.guiref_active_frontend | |
479 | statusTip="List interactive variable with detail", |
|
449 | ) | |
480 | triggered=self.whos_magic_active_frontend) |
|
450 | self.help_menu.addAction(self.guiref_active_frontend_action) | |
481 | self.magic_menu.addAction(self.whos_action) |
|
|||
482 | except AttributeError: |
|
|||
483 | self.log.error("trying to add unexisting action (whos), skipping") |
|
|||
484 |
|
451 | |||
485 | def undo_active_frontend(self): |
|
452 | def undo_active_frontend(self): | |
486 | self.active_frontend.undo() |
|
453 | self.active_frontend.undo() | |
@@ -517,6 +484,12 b' class MainWindow(QtGui.QMainWindow):' | |||||
517 | self.active_frontend.decrease_font_size.trigger() |
|
484 | self.active_frontend.decrease_font_size.trigger() | |
518 | def reset_font_size_active_frontend(self): |
|
485 | def reset_font_size_active_frontend(self): | |
519 | self.active_frontend.reset_font_size.trigger() |
|
486 | self.active_frontend.reset_font_size.trigger() | |
|
487 | ||||
|
488 | def guiref_active_frontend(self): | |||
|
489 | self.active_frontend.execute("%guiref") | |||
|
490 | ||||
|
491 | def intro_active_frontend(self): | |||
|
492 | self.active_frontend.execute("?") | |||
520 | #--------------------------------------------------------------------------- |
|
493 | #--------------------------------------------------------------------------- | |
521 | # QWidget interface |
|
494 | # QWidget interface | |
522 | #--------------------------------------------------------------------------- |
|
495 | #--------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now