Show More
@@ -1,6 +1,7 b'' | |||||
1 | { |
|
1 | { | |
2 | "metadata": { |
|
2 | "metadata": { | |
3 | "name": "" |
|
3 | "name": "", | |
|
4 | "signature": "sha256:7b872a09743460a3ce0358e9010c3b4baf5136b79a2a075964dea2c2fd85c82e" | |||
4 | }, |
|
5 | }, | |
5 | "nbformat": 3, |
|
6 | "nbformat": 3, | |
6 | "nbformat_minor": 0, |
|
7 | "nbformat_minor": 0, | |
@@ -76,18 +77,12 b'' | |||||
76 | " self._modal_body_label = widgets.HTMLWidget(value = 'Not hooked')\n", |
|
77 | " self._modal_body_label = widgets.HTMLWidget(value = 'Not hooked')\n", | |
77 | " self._modal_body.children = [self._modal_body_label]\n", |
|
78 | " self._modal_body.children = [self._modal_body_label]\n", | |
78 | "\n", |
|
79 | "\n", | |
79 | " self._modal_footer = widgets.ContainerWidget()\n", |
|
|||
80 | " self._var_filter = widgets.ToggleButtonsWidget(description=\"Method:\", values=['List', 'Details'], value='List')\n", |
|
|||
81 | " self._modal_footer.children = [self._var_filter]\n", |
|
|||
82 | "\n", |
|
|||
83 | " self._popout.children = [\n", |
|
80 | " self._popout.children = [\n", | |
84 | " self._modal_body, \n", |
|
81 | " self._modal_body, \n", | |
85 | " self._modal_footer,\n", |
|
|||
86 | " ]\n", |
|
82 | " ]\n", | |
87 | " \n", |
|
83 | " \n", | |
88 | " self._ipython = ipython\n", |
|
84 | " self._ipython = ipython\n", | |
89 | " self._ipython.register_post_execute(self._fill)\n", |
|
85 | " self._ipython.register_post_execute(self._fill)\n", | |
90 | " self._var_filter.on_trait_change(self._fill, 'value')\n", |
|
|||
91 | "\n", |
|
86 | "\n", | |
92 | " def close(self):\n", |
|
87 | " def close(self):\n", | |
93 | " \"\"\"Close and remove hooks.\"\"\"\n", |
|
88 | " \"\"\"Close and remove hooks.\"\"\"\n", | |
@@ -100,19 +95,14 b'' | |||||
100 | " def _fill(self):\n", |
|
95 | " def _fill(self):\n", | |
101 | " \"\"\"Fill self with variable information.\"\"\"\n", |
|
96 | " \"\"\"Fill self with variable information.\"\"\"\n", | |
102 | " values = self.namespace.who_ls()\n", |
|
97 | " values = self.namespace.who_ls()\n", | |
103 | " mode = self._var_filter.value\n", |
|
98 | " self._modal_body_label.value = '<table class=\"table table-bordered table-striped\"><tr><th>Name</th><th>Type</th><th>Value</th></tr><tr><td>' + \\\n", | |
104 | " if mode == \"List\":\n", |
|
99 | " '</td></tr><tr><td>'.join(['{0}</td><td>{1}</td><td>{2}'.format(v, type(eval(v)).__name__, str(eval(v))) for v in values]) + \\\n", | |
105 | " self._modal_body_label.value = '<br>'.join(values)\n", |
|
100 | " '</td></tr></table>'\n", | |
106 | " elif mode == \"Details\":\n", |
|
|||
107 | " self._modal_body_label.value = '<table class=\"table table-bordered table-striped\"><tr><th>Name</th><th>Type</th><th>Value</th></tr><tr><td>' + \\\n", |
|
|||
108 | " '</td></tr><tr><td>'.join(['{0}</td><td>{1}</td><td>{2}'.format(v, type(eval(v)).__name__, str(eval(v))) for v in values]) + \\\n", |
|
|||
109 | " '</td></tr></table>'\n", |
|
|||
110 | "\n", |
|
101 | "\n", | |
111 | " def _ipython_display_(self):\n", |
|
102 | " def _ipython_display_(self):\n", | |
112 | " \"\"\"Called when display() or pyout is used to display the Variable \n", |
|
103 | " \"\"\"Called when display() or pyout is used to display the Variable \n", | |
113 | " Inspector.\"\"\"\n", |
|
104 | " Inspector.\"\"\"\n", | |
114 | " self._popout._ipython_display_()\n", |
|
105 | " self._popout._ipython_display_()\n", | |
115 | " self._modal_footer.add_class('modal-footer')\n", |
|
|||
116 | " self._popout.add_class('vbox')\n", |
|
106 | " self._popout.add_class('vbox')\n", | |
117 | " self._modal_body.add_class('box-flex1')\n" |
|
107 | " self._modal_body.add_class('box-flex1')\n" | |
118 | ], |
|
108 | ], |
General Comments 0
You need to be logged in to leave comments.
Login now