Show More
@@ -335,11 +335,11 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
335 | 335 | expr : string |
|
336 | 336 | valid string to be executed by the kernel. |
|
337 | 337 | callback : function |
|
338 |
function accepting one argu |
|
|
338 | function accepting one argument, as a string. The string will be | |
|
339 | 339 | the `repr` of the result of evaluating `expr` |
|
340 | 340 | |
|
341 |
The `callback` is called with the |
|
|
342 |
first argument. To get the object, do |
|
|
341 | The `callback` is called with the `repr()` of the result of `expr` as | |
|
342 | first argument. To get the object, do `eval()` on the passed value. | |
|
343 | 343 | |
|
344 | 344 | See Also |
|
345 | 345 | -------- |
@@ -347,8 +347,8 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
347 | 347 | |
|
348 | 348 | """ |
|
349 | 349 | |
|
350 |
# generate uuid, which would be used as a indication of wether or |
|
|
351 | # the unique request originate from here (can use msg id ?) | |
|
350 | # generate uuid, which would be used as an indication of whether or | |
|
351 | # not the unique request originated from here (can use msg id ?) | |
|
352 | 352 | local_uuid = str(uuid.uuid1()) |
|
353 | 353 | msg_id = self.kernel_manager.shell_channel.execute('', |
|
354 | 354 | silent=True, user_expressions={ local_uuid:expr }) |
@@ -356,7 +356,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
356 | 356 | self._request_info['execute'][msg_id] = self._ExecutionRequest(msg_id, 'silent_exec_callback') |
|
357 | 357 | |
|
358 | 358 | def _handle_exec_callback(self, msg): |
|
359 | """Execute `callback` corresonding to `msg` reply, after ``_silent_exec_callback`` | |
|
359 | """Execute `callback` corresponding to `msg` reply, after ``_silent_exec_callback`` | |
|
360 | 360 | |
|
361 | 361 | Parameters |
|
362 | 362 | ---------- |
@@ -365,7 +365,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
365 | 365 | |
|
366 | 366 | Notes |
|
367 | 367 | ----- |
|
368 |
This f |
|
|
368 | This function will look for a `callback` associated with the | |
|
369 | 369 | corresponding message id. Association has been made by |
|
370 | 370 | `_silent_exec_callback`. `callback` is then called with the `repr()` |
|
371 | 371 | of the value of corresponding `user_expressions` as argument. |
@@ -92,7 +92,7 b' class MainWindow(QtGui.QMainWindow):' | |||
|
92 | 92 | |
|
93 | 93 | send a self.close if number of tab ==0 |
|
94 | 94 | |
|
95 |
need to be called explicit |
|
|
95 | need to be called explicitly, or be connected to tabInserted/tabRemoved | |
|
96 | 96 | """ |
|
97 | 97 | if self.tab_widget.count() <= 1: |
|
98 | 98 | self.tab_widget.tabBar().setVisible(False) |
@@ -133,21 +133,23 b' class MainWindow(QtGui.QMainWindow):' | |||
|
133 | 133 | def close_tab(self,current_tab): |
|
134 | 134 | """ Called when you need to try to close a tab. |
|
135 | 135 | |
|
136 | It takes the number of the tab to be closed as argument, or a referece | |
|
137 |
to the wiget insi |
|
|
136 | It takes the number of the tab to be closed as argument, or a reference | |
|
137 | to the widget inside this tab | |
|
138 | 138 | """ |
|
139 | 139 | |
|
140 |
# let's be sure "tab" and "closing widget are respectivey the index |
|
|
141 |
# and a reference to the |
|
|
140 | # let's be sure "tab" and "closing widget" are respectively the index | |
|
141 | # of the tab to close and a reference to the frontend to close | |
|
142 | 142 | if type(current_tab) is not int : |
|
143 | 143 | current_tab = self.tab_widget.indexOf(current_tab) |
|
144 | 144 | closing_widget=self.tab_widget.widget(current_tab) |
|
145 | 145 | |
|
146 | 146 | |
|
147 |
# when trying to be closed, widget might re-send a request to be |
|
|
148 |
# be deleted when event will be processed. So |
|
|
149 | # skip if not. One example of this is when 'exit' is send in a slave tab. 'exit' will be | |
|
150 | # re-send by this fonction on the master widget, which ask all slaves widget to exit | |
|
147 | # when trying to be closed, widget might re-send a request to be | |
|
148 | # closed again, but will be deleted when event will be processed. So | |
|
149 | # need to check that widget still exists and skip if not. One example | |
|
150 | # of this is when 'exit' is sent in a slave tab. 'exit' will be | |
|
151 | # re-sent by this function on the master widget, which ask all slave | |
|
152 | # widgets to exit | |
|
151 | 153 | if closing_widget==None: |
|
152 | 154 | return |
|
153 | 155 | |
@@ -264,13 +266,13 b' class MainWindow(QtGui.QMainWindow):' | |||
|
264 | 266 | |
|
265 | 267 | def find_master_tab(self,tab,as_list=False): |
|
266 | 268 | """ |
|
267 | Try to return the frontend that own the kernel attached to the given widget/tab. | |
|
269 | Try to return the frontend that owns the kernel attached to the given widget/tab. | |
|
268 | 270 | |
|
269 | Only find frontend owed by the current application. Selection | |
|
270 |
based on port of the kernel |
|
|
271 | Only finds frontend owned by the current application. Selection | |
|
272 | based on port of the kernel might be inaccurate if several kernel | |
|
271 | 273 | on different ip use same port number. |
|
272 | 274 | |
|
273 |
This f |
|
|
275 | This function does the conversion tabNumber/widget if needed. | |
|
274 | 276 | Might return None if no master widget (non local kernel) |
|
275 | 277 | Will crash IPython if more than 1 masterWidget |
|
276 | 278 | |
@@ -570,13 +572,13 b' class MainWindow(QtGui.QMainWindow):' | |||
|
570 | 572 | |
|
571 | 573 | Notes |
|
572 | 574 | ----- |
|
573 |
`fun` execute `magic` |
|
|
574 |
not the active frontend at the moment it |
|
|
575 | `fun` executes `magic` in active frontend at the moment it is triggered, | |
|
576 | not the active frontend at the moment it was created. | |
|
575 | 577 | |
|
576 | 578 | This function is mostly used to create the "All Magics..." Menu at run time. |
|
577 | 579 | """ |
|
578 |
# need to level nested function |
|
|
579 |
# o |
|
|
580 | # need two level nested function to be sure to pass magic | |
|
581 | # to active frontend **at run time**. | |
|
580 | 582 | def inner_dynamic_magic(): |
|
581 | 583 | self.active_frontend.execute(magic) |
|
582 | 584 | inner_dynamic_magic.__name__ = "dynamics_magic_s" |
@@ -626,9 +628,9 b' class MainWindow(QtGui.QMainWindow):' | |||
|
626 | 628 | self.all_magic_menu.addAction(xaction) |
|
627 | 629 | |
|
628 | 630 | def update_all_magic_menu(self): |
|
629 |
""" Update the list o |
|
|
631 | """ Update the list of magics in the "All Magics..." Menu | |
|
630 | 632 | |
|
631 |
Request the kernel with the list of avail |
|
|
633 | Request the kernel with the list of available magics and populate the | |
|
632 | 634 | menu with the list received back |
|
633 | 635 | |
|
634 | 636 | """ |
@@ -672,12 +674,12 b' class MainWindow(QtGui.QMainWindow):' | |||
|
672 | 674 | self, triggered=self.update_all_magic_menu) |
|
673 | 675 | self.add_menu_action(self.all_magic_menu, self.pop) |
|
674 | 676 | # we need to populate the 'Magic Menu' once the kernel has answer at |
|
675 | # least once let's do it immedialy, but it's assured to works | |
|
677 | # least once let's do it immediately, but it's assured to works | |
|
676 | 678 | self.pop.trigger() |
|
677 | 679 | |
|
678 | 680 | self.reset_action = QtGui.QAction("&Reset", |
|
679 | 681 | self, |
|
680 | statusTip="Clear all varible from workspace", | |
|
682 | statusTip="Clear all variables from workspace", | |
|
681 | 683 | triggered=self.reset_magic_active_frontend) |
|
682 | 684 | self.add_menu_action(self.magic_menu, self.reset_action) |
|
683 | 685 | |
@@ -695,19 +697,19 b' class MainWindow(QtGui.QMainWindow):' | |||
|
695 | 697 | |
|
696 | 698 | self.who_action = QtGui.QAction("&Who", |
|
697 | 699 | self, |
|
698 | statusTip="List interactive variable", | |
|
700 | statusTip="List interactive variables", | |
|
699 | 701 | triggered=self.who_magic_active_frontend) |
|
700 | 702 | self.add_menu_action(self.magic_menu, self.who_action) |
|
701 | 703 | |
|
702 | 704 | self.who_ls_action = QtGui.QAction("Wh&o ls", |
|
703 | 705 | self, |
|
704 | statusTip="Return a list of interactive variable", | |
|
706 | statusTip="Return a list of interactive variables", | |
|
705 | 707 | triggered=self.who_ls_magic_active_frontend) |
|
706 | 708 | self.add_menu_action(self.magic_menu, self.who_ls_action) |
|
707 | 709 | |
|
708 | 710 | self.whos_action = QtGui.QAction("Who&s", |
|
709 | 711 | self, |
|
710 | statusTip="List interactive variable with detail", | |
|
712 | statusTip="List interactive variables with details", | |
|
711 | 713 | triggered=self.whos_magic_active_frontend) |
|
712 | 714 | self.add_menu_action(self.magic_menu, self.whos_action) |
|
713 | 715 | |
@@ -751,8 +753,8 b' class MainWindow(QtGui.QMainWindow):' | |||
|
751 | 753 | # please keep the Help menu in Mac Os even if empty. It will |
|
752 | 754 | # automatically contain a search field to search inside menus and |
|
753 | 755 | # please keep it spelled in English, as long as Qt Doesn't support |
|
754 |
# a QAction.MenuRole like HelpMenuRole otherwise it will lo |
|
|
755 |
# this search field f |
|
|
756 | # a QAction.MenuRole like HelpMenuRole otherwise it will lose | |
|
757 | # this search field functionality | |
|
756 | 758 | |
|
757 | 759 | self.help_menu = self.menuBar().addMenu("&Help") |
|
758 | 760 |
General Comments 0
You need to be logged in to leave comments.
Login now