Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE with defaults #288

Closed
wants to merge 13 commits into from
Closed

IDE with defaults #288

wants to merge 13 commits into from

Conversation

rmarren1
Copy link
Contributor

@rmarren1 rmarren1 commented Jul 13, 2018

Adds default arguments to build-time generated python files.

In this PR:

  • None replaces the javascript null
  • Component._NO_DEFAULT_ARG is given for properties with no default argument
  • The python True, False are in place of the javascript true, false
  • Javascript objects are converted to python dictionaries

Example:

class Graph(Component):
    """docstring'"""
    @_explicitize_args
    def __init__(self, id=Component._NO_DEFAULT_ARG, clickData=None, hoverData=None, clear_on_unhover=False, selectedData=None, relayoutData=None, figure={'data': [], 'layout': {}}, style=Component._NO_DEFAULT_ARG, className=Component._NO_DEFAULT_ARG, animate=False, animation_options={'frame': {'redraw': False}, 'transition': {'duration': 750, 'ease': 'cubic-in-out'}}, config={'staticPlot': False, 'editable': False, 'edits': {'annotationPosition': False, 'annotationTail': False, 'annotationText': False, 'axisTitleText': False, 'colorbarPosition': False, 'colorbarTitleText': False, 'legendPosition': False, 'legendText': False, 'shapePosition': False, 'titleText': False}, 'autosizable': False, 'queueLength': 0, 'fillFrame': False, 'frameMargins': 0, 'scrollZoom': False, 'doubleClick': 'reset+autosize', 'showTips': True, 'showAxisDragHandles': True, 'showAxisRangeEntryBoxes': True, 'showLink': False, 'sendData': True, 'linkText': 'Edit chart', 'showSources': False, 'displayModeBar': 'hover', 'modeBarButtonsToRemove': [], 'modeBarButtonsToAdd': [], 'modeBarButtons': False, 'displaylogo': True, 'plotGlPixelRatio': 2, 'topojsonURL': 'https://cdn.plot.ly/', 'mapboxAccessToken': None}, **kwargs):
        

see also:
plotly/dash-core-components#234
plotly/dash-html-components#51

@chriddyp
Copy link
Member

What was the syntax that we ended up agreeing on last Friday? Was it Component.Undefined and Component.Required?

@rmarren1
Copy link
Contributor Author

Yes, rather than just None for everything. I ended up capitalizing (Component.REQUIRED). I have included those changes in #276, I am reserving this PR for the case when we are actually setting the default properties on the Python objects.

@alexcjohnson
Copy link
Collaborator

These ideas have been incorporated into other completed or in-progress PRs - closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants