neo-nie / pynsource

Automatically exported from code.google.com/p/pynsource
0 stars 0 forks source link

Crash when switch to Ascii UML view when multiple inheritance uml #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. File New
2. Import pynsourcegui.py (see attached)
3. Switch to Ascii view.

What is the expected output? 

Expect to see ascii uml.  

What do you see instead?

Instead crash occurs with message:

  File "F:\Devel\pyNsource\trunk\src\layout\graph.py", line 161, in nodes_sorted_by_generalisation
    assert len(result) == len(self.nodes), "Count increased! from %d to %d" %(len(self.nodes), len(result))
         # ensure not introducing duplicates

AssertionError: Count increased! from 9 to 10

Original issue reported on code.google.com by abu...@gmail.com on 6 Aug 2012 at 1:24

GoogleCodeExporter commented 8 years ago
Import the pyNsourceGui.py attached to see the problem.  It may also be 
reproducible with the current pyNsourceGui.py being developed.

Note the IMPORT and rendering is ok.  Its just switching to ascii view that has 
gone a bit iffy.

Original comment by abu...@gmail.com on 6 Aug 2012 at 1:27

Attachments:

GoogleCodeExporter commented 8 years ago
Seems to be an issue re imprting code which uses multiple inheritance. 
Reproduced the problem by importing:

class Fred(Mary, Sam):
    pass

Original comment by abu...@gmail.com on 8 Aug 2012 at 7:02

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was updated by revision r473.

Preparing to debug multiple inheritance parsing bug, adding unit tests to catch 
it.

Original comment by abu...@gmail.com on 8 Aug 2012 at 8:10

GoogleCodeExporter commented 8 years ago
This issue was updated by revision r518.

ast_parser - switched pynsourcegui to the new ast parser!  Fixed multiple 
inheritence parsing bug.

Still have multiple inheritance crash when switch to ascii uml view because of 
graph.py sort by generalisation algorithm introducing duplicates.

Original comment by abu...@gmail.com on 17 Aug 2012 at 7:41

GoogleCodeExporter commented 8 years ago
This issue was updated by revision r519.

Moved graph node tests into testing dir.  One test that is failing is the one 
we have to solve to fix this bug.

Original comment by abu...@gmail.com on 17 Aug 2012 at 8:17

GoogleCodeExporter commented 8 years ago
The problem of multiple inheritance means new 'ordering' and 'annotation' 
decisions were needed for multiple inheritance cases.  

The final solution of [('M', 'root'), ('F', 'root'), ('S', 'root')] meant 
treating all as roots, then adding extra logic to the ascii rendering stage so 
that multiple parents were picked up and drawn as aliases e.g. not fully 
rendered classes but rather a class in square brackets e.g. [classname] above 
the child with multiple parents.

Original comment by abu...@gmail.com on 19 Aug 2012 at 3:35

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was updated by revision r520.

Fixed ascii rendering problem in cases of multiple inheritance.

Original comment by abu...@gmail.com on 19 Aug 2012 at 3:36

GoogleCodeExporter commented 8 years ago
HOW IT WORKS
============

unit tests in
    test_graph_nodes.py
    test_asciiworkspace_01.py
    test_asciiworkspace_02.py

This layout is generated from the graph model and relies on the call
    graph.nodes_sorted_by_generalisation()
which returns the nodes in an order conducive to ascii layout.

The order of nodes returned is something like:
[('A', 'root'), ('B', 'fc'), ('D', 'tab'), ('F', 'tab'), ('C', 'fc'), ('H', 
'fc'), ('E', 'root')]
or
[(m, 'root'), (s, 'root'), (f, 'root')]

Where root means start a newline and render a box.  (exception to this is where
you have multiple roots by themselves, then we spread them out across the page)

Where 'fc' means first child under a root.  Usually a subclass rendered along
the left edge of the page.

Where 'tab' means tab out to the next column in the same row.

Sometimes to avoid wiring cross-overs, we write out a class a second time as
an 'alias' which looks like this:

+------+
| Mary |
+------+

[ Mary ][ Sam ]       +-----+
  .                   | Sam |
 /_\                  +-----+
  |                          
  |                          
  |                          
+------+                     
| Fred |                     
+------+                     

Aliases appear in [nnnnn] square brackets.

The utility class 'asciiworkspace' is a nice class which looks after organising
things in rows and columns with appropriate padding.  You send it chunks of text
and flush/newline commands and it will appear in a nice grid format.

Original comment by abu...@gmail.com on 19 Aug 2012 at 4:04

GoogleCodeExporter commented 8 years ago
This issue was updated by revision r521.

Moved ascii_uml modules into its own package.  Added documentation.

Original comment by abu...@gmail.com on 19 Aug 2012 at 4:08

GoogleCodeExporter commented 8 years ago
Fixed.

Original comment by abu...@gmail.com on 19 Aug 2012 at 4:08