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

Problems with Link Attributes #22

Open
e-q opened this issue Dec 4, 2015 · 3 comments
Open

Problems with Link Attributes #22

e-q opened this issue Dec 4, 2015 · 3 comments

Comments

@e-q
Copy link
Contributor

e-q commented Dec 4, 2015

Hi Sean, I really like this project, and have just started to try it out.

Unfortunately, the current state as I've cloned seems to have some problems exporting images, which I think is related to where the Link objects pattern, color, and width attributes live.

I've managed to hack around this (see 565b459), but maybe not in the most robust way.

First off, at the current HEAD of 76859c5, running the export.py example crashes with AttributeError: 'Scene' object has no attribute 'addComponent'. Taking out the addComponent lines (which maybe aren't necessary anymore?), crashes with the following trace:

Traceback (most recent call last):
  File "export.py", line 65, in <module>
    view.export(path, fileFormat=fileFormat)
  File "../optivis/view/svg.py", line 96, in export
    svgByteString = unicode.encode(self.getSvgString(size=size))
  File "../optivis/view/svg.py", line 138, in getSvgString
    svgLink.draw(drawElement)
  File "../optivis/view/svg.py", line 265, in draw
    if len(self.link.pattern) > 0:
AttributeError: 'Link' object has no attribute 'pattern'

Probably relatedly, some tests related to links crash:

======================================================================
FAIL: test_invalid_pattern (optivis.bench.test_links.TestLinkAttributes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ericq/Developer/optivis/optivis/bench/test_links.py", line 62, in test_invalid_pattern
    self.assertRaises(Exception, setattr, self.link, 'pattern', str('invalid'))
AssertionError: Exception not raised

======================================================================
FAIL: test_invalid_width (optivis.bench.test_links.TestLinkAttributes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ericq/Developer/optivis/optivis/bench/test_links.py", line 49, in test_invalid_width
    self.assertRaises(Exception, setattr, self.link, 'width', -2)
AssertionError: Exception not raised

======================================================================
FAIL: test_invalid_length (optivis.bench.test_links.TestLinkInstantiation)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ericq/Developer/optivis/optivis/bench/test_links.py", line 38, in test_invalid_length
    self.assertRaises(TypeError, links.Link, self.componentA.getOutputNode('out'), self.componentB.getInputNode('fr'), None)
AssertionError: TypeError not raised

My workaround in 565b459 was just to edit view/svg.py to look for link.specs[0].pattern instead of self.link.pattern, and similar for color and width. I can't claim to have enough understanding of your code to know if this is a robust way to fix this, though.

I'm running Python 2.7.10 (from Anaconda 2.4.0) on OS X 10.11.1, just FYI.

@SeanDS
Copy link
Owner

SeanDS commented Dec 8, 2015

Hi Eric, thanks for this report. It looks like I forgot to update a few examples and the SVG export code when I changed the way you add links.

Could you open a pull request, please? It looks like your fixes are exactly what was required. I'm a little busy right now but next week I should have time to patch this up.

Cheers!

@SeanDS
Copy link
Owner

SeanDS commented Dec 19, 2015

Merged in #23

@SeanDS SeanDS closed this as completed Dec 19, 2015
@SeanDS SeanDS reopened this Dec 19, 2015
@SeanDS
Copy link
Owner

SeanDS commented Dec 19, 2015

Tests still fail - these should be fixed.

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

No branches or pull requests

2 participants