예제 #1
0
    def set_function_help(self, function_name, module_name):
        """ Display Beautified version of a function doc-string.

            The function is specified as the name of the function and the
            module name for the function.
        """
        func = PythonFunctionInfo(name=function_name, module=module_name)

        if func.doc_string == "":
            self.set_text("No information about this function.")
        else:
            self._html = rest_html.convert_function_info(
                func.name, func.doc_string)
    def _get_description(self, function_info):
        """ Grab a short text description of the described function.

            The first line in the doc-string is returned if it is available.
            Otherwise, an empty string is returned.
        """
        # Create a PythonFunctionInfo for the function.
        # fixme: This seems a little heavy weight to just get the
        #        doc-string, but it is the shortest path between here
        #        and there...
        # fixme: We should likely do some error handling here...
        func = PythonFunctionInfo(module=function_info.module,
                                  name=function_info.name)

        if func.doc_string is "":
            short_description = "No information about this function."
        else:
            # Use the first line as the "short" function description.
            short_description = func.doc_string.splitlines()[0]

        return short_description
예제 #3
0
                                label_bg_color=WindowColor,
                                cell_bg_color='white',
                            ),
                            show_label=False,
                            resizable=True,
                        ),
                    ),
                ),
                label="Context Info",
            ),
        ),

        #            width=720, # about 80 columns wide on code view.
        #            height=700,
        resizable=True,
        buttons=menu.OKCancelButtons,
        close_result=False,
    )

    return view


if __name__ == "__main__":
    from python_function_info import PythonFunctionInfo
    from function_call import FunctionCall
    func = PythonFunctionInfo(
        module='cp.rockphysics.converge.fluids.brine_properties',
        name='brine_properties')
    func_call = FunctionCall.from_callable_object(func)
    func_call.configure_traits(view=create_view())