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

fix issue for multiple attributes with same name (crashed the import) #2

Closed
wants to merge 8 commits into from

Conversation

renoust
Copy link

@renoust renoust commented Dec 11, 2019

I had an issue with some generated graphml that contained multiple entries with the same name (and sometimes different types), which crashed the import. The fix only prepends '_' to existing key names.

@anlambert
Copy link
Owner

Hi Benjamin,

I assume this should only happen on attributes with different types.
How about suffixing the Talipot property to create with _<type> instead ?
Also we should add some tests for the GraphML import using really simple
graphs in that format.

Once this work done, you should also submit a PR to the official Tulip repo.
I am done on officially contributing to Tulip and prefer focusing on that fork
as I am free to go in the direction that I want for the framework (notably
in terms of code style, API design, GUI, Python integration, rendering engine,
...)

PS: I can only work on that Tulip fork on my spare time and I am far to reach
a releasable version yet. Nevertheless, you should be able to test my advancements
on this through this dmg bundle updated on each push on the master
branch (when the associated CI job does not timeout as it is the case actually).

@@ -71,6 +71,9 @@ def startElement(self, name, attrs):
self.attrLabel = 'label'

# Create a Talipot property compatible with the attribute type
while self.graph.existProperty(attrName):
attrName = '_'+attrName
Copy link
Owner

Choose a reason for hiding this comment

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

Please add spaces around the + operator.

You should try the flake8 tool by the way, it really helps
to write clean Python code and it is really easy to integrate it in IDE.

@renoust
Copy link
Author

renoust commented Dec 12, 2019 via email

@anlambert
Copy link
Owner

Hey Benjamin,

Sorry for the late answer, I did not have enough time to work on this during the last days.

The fix is done, there is still the test to write though, but I can share
the dataset that triggered the error originally.

Cool ! Can you squash the commits first and push force your branch before I merge this ? Also it is a better practice to create a feature branch locally on your fork and push it to GitHub in order to create a PR from it.

Yes I am interested by your GraphML dataset, it will help me write proper tests (I handle it, don't worry).

As for the repository I though I could help everyone at once, and tried to
fork also tulip, but it appears that I cannot work only on one fork.
But it seemed that my PR worked on both I guess. This is my first time
trying this on a fork of a fork, so I'm not sure what goes on here.

Indeed this will not work as I started diverging a lot from the Tulip codebase and I changed the project name. If you want to contribute to both, you will need to have a fork of Tulip and a fork of Talipot in separate folders.

Anyway, and thanks for the Talipot bundle link! as long as I can I'm gonna
try to work and contribute on both.

You should already benefit of some improvements on MacOS using my bundle as I removed the dependency to deprecated QOpenGL module in favor of plain QtGui and its OpenGL features: this should fix numerous rendering glitches observed on that platform. Migrating away from QtOpenGL also fixes REALLY slow selection using an Intel GPU on debian (my case) for instance.

But as I said, I can not be full time on this so I have to do it incrementally to prepare the big changes
I want to introduce. So better keeping using Tulip at the moment but expect some cool things to happen in that repo along the next year ;-)

Cheers !

@@ -71,6 +71,9 @@ def startElement(self, name, attrs):
self.attrLabel = 'label'

# Create a Talipot property compatible with the attribute type
while self.graph.existProperty(attrName):
Copy link
Owner

Choose a reason for hiding this comment

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

I think a simple if should be enough here.

adding spaces around + as requested

minor code cleaning

now change the while into an if since we specify the type

Add a test dataset for the case of same attribute multiple types.
@renoust
Copy link
Author

renoust commented Dec 18, 2019 via email

@renoust renoust closed this Dec 18, 2019
p-mary referenced this pull request Jan 3, 2020
QOpenGL module is marked as deprecated since a while now so it is time
to remove its use from the Talipot codebase and promote the use of
QOpenGL* classes directly integrated in the QtGui module.

The big difference between QOpenGL and QtOpenGL from Qt5 is that all
rendering is performed in framebuffer objects, there is no more direct
rendering in the underlying os windows with its own OpenGL context.

Talipot OpenGL rendering also follows that idiom, all renderings are performed
offscreen using a shared OpenGL context. This also means that there is no
more QGLWidget as viewport for QGraphicsView. Talipot OpenGL scene are
now converted to QImage in order to display them using the default Qt raster
rendering engine. This should fixes the numerous rendering glitches observed
on MacOS.

First thing observed after the migration is a consequent performance boost
in OpenGL rendering when using an Intel GPU on a Linux host machine (especially
when selecting elements, it is now 10 times faster on debian stable).
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.

2 participants