Skip to content

Conversation

mj3cheun
Copy link

@mj3cheun mj3cheun commented Aug 20, 2021

About

Adds the bilkent context menu to dash-cytoscape using an API and implementation which will allow the toronto context menu to be added as well using the same format. Replaces existing context menu PRs.

  • Adds a cxtmenu property to provide configuration for the context menu
  • Adds a cxtmenuData property to receive callbacks from the context menu

Note: please let me know what dash-cytoscape version an update including this addition along with the map addition should hold. I will update the change log with it once I know.

Description of changes

Pre-Merge checklist

  • The project was correctly built with npm run build:all.
  • If there was any conflict, it was solved correctly.
  • All changes were documented in CHANGELOG.md.
  • All tests on CircleCI have passed.
  • All Percy visual changes have been approved.
  • Two people have 💃'd the pull request. You can be one of these people if you are a Dash Cytoscape core contributor.

Reference Issues

Closes #[issue number]

Other comments

@mj3cheun mj3cheun requested a review from alexcjohnson as a code owner August 20, 2021 16:32
@mj3cheun mj3cheun changed the title Bilkent cxtmenu Bilkent cxtmenu draft Aug 20, 2021
@mj3cheun mj3cheun marked this pull request as draft August 20, 2021 16:34
@mj3cheun mj3cheun marked this pull request as ready for review August 22, 2021 16:50
@mj3cheun mj3cheun changed the title Bilkent cxtmenu draft Add Bilkent Cxtmenu Aug 22, 2021
@@ -841,7 +850,7 @@ Cytoscape.propTypes = {
tapEdgeData: PropTypes.object,

/**
* The data dictionary of a node returned when you hover over it. Read-only.
modified: src/lib/cyCxtMenu.js
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unintentional change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops yes unintentional change. Reverted.

Comment on lines 914 to 916
* Property that determines whether a context menu is displayed and how. Requires extra layouts loaded.
* Context menu is accessed by right clicking. It accepts a list of dictionaries, each of which describes
* a context menu option. Options are rendered in the order presented.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Property that determines whether a context menu is displayed and how. Requires extra layouts loaded.
* Context menu is accessed by right clicking. It accepts a list of dictionaries, each of which describes
* a context menu option. Options are rendered in the order presented.
* Displays a context menu on right click. Requires extra layouts loaded.
* Accepts a list of dictionaries, each of which describes
* a context menu option. Options are rendered in the order presented.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just two minor comments. 💃

Copy link

@mtwichan mtwichan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm running into an error installing the library.

C:\Users\Dell\Desktop\Code\Zyphr\dash-cytoscape\dist>pip install dash_cytoscape-0.3.0.tar.gz
Processing c:\users\dell\desktop\code\zyphr\dash-cytoscape\dist\dash_cytoscape-0.3.0.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\dell\appdata\local\programs\python\python39\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-req-build-vjwdxxaw\\setup.py'"'"'; __file__='"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-req-build-vjwdxxaw\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Dell\AppData\Local\Temp\pip-pip-egg-info-gleh_o9b'
         cwd: C:\Users\Dell\AppData\Local\Temp\pip-req-build-vjwdxxaw\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Dell\AppData\Local\Temp\pip-req-build-vjwdxxaw\setup.py", line 7, in <module>
        with open('package.json') as f:
    FileNotFoundError: [Errno 2] No such file or directory: 'package.json'
    ----------------------------------------
WARNING: Discarding file:///C:/Users/Dell/Desktop/Code/Zyphr/dash-cytoscape/dist/dash_cytoscape-0.3.0.tar.gz. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I'm building the tarball for the library using python setup.py sdist and then attempting to install the library by pip install dash_cytoscape-0.3.0.tar.gz. Am I doing something wrong?

@maxkfranz @mj3cheun


- cxtmenuData (dict; optional):
Dictionary returned when you a context menu option is selected.
Read-only.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.

Dictionary returned when a context menu option is selected

@alexcjohnson
Copy link
Collaborator

I'm running into an error installing the library.

Hmm yeah, there's a bunch of issues here. I can install v0.3.0 from PyPI but I can't import it in Python:

>>> import dash_cytoscape as cy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/alex/plotly/dash-cytoscape/dash_cytoscape/__init__.py", line 23, in <module>
    with open(_filepath) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/alex/plotly/dash-cytoscape/dash_cytoscape/package-info.json'

Presumably I can install it because it has a wheel (which is great! keep building wheels along with the sdist tarballs!). If I try to build as you did, I get a similar problem. Has this really been broken since 0.3.0 was released in May? Specifically I think we need to revert these two changes:

@mtwichan
Copy link

mtwichan commented Sep 9, 2021

Hi folks,

What was the reasoning for naming the context menu property cxtmenuData/cxtmenu vs. contextmenuData/contextmenu?

I'm thinking that using the full word context may make the API easier to read.

What are your thoughts?

@mj3cheun @maxkfranz

@mtwichan
Copy link

mtwichan commented Sep 9, 2021

Everything looks good to me! We will not be fixing the packaging error in this PR as discussed with @alexcjohnson.

Good to merge after considering the above comment about the naming conventions. Once this PR is merged, I will create another PR to add the example Dash application I created.

💃

@alexcjohnson
Copy link
Collaborator

What was the reasoning for naming the context menu property cxtmenuData/cxtmenu vs. contextmenuData/contextmenu?

I'm thinking that using the full word context may make the API easier to read.

Good call - also to avoid confusion, I've more often seen context abbreviated to ctx, so if we use cxt I'd be mis-typing it constantly. So yeah, let's use the full word.

Manfred Cheung and others added 2 commits September 13, 2021 19:56
@mj3cheun
Copy link
Author

All comments addressed

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.

4 participants