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

Add optional image to connectors and cables #153

Merged
merged 21 commits into from
Oct 14, 2020

Commits on Aug 13, 2020

  1. Configuration menu
    Copy the full SHA
    43ec3bf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c8c4005 View commit details
    Browse the repository at this point in the history
  3. Remove border between image and caption

    Adding helper function for each of these with a leading <tdX> tag that
    instructs nested_html_table() to inject attributes to the <td> tag.
    kvid committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    0cb7118 View commit details
    Browse the repository at this point in the history
  4. Expand example 08 with images and captions

    - Stereo phone plug (a slight modification of a public domain image
      from https://openclipart.org/detail/192396/headphones-connctor ).
    - Cable cross-section drawn to match the wire colors in example 08.
    - Make the cable jacket and shield colors match the cross-section.
    - Images for embedding in the connector and cable nodes are stored
      in a new resources folder.
    kvid committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    06e6c49 View commit details
    Browse the repository at this point in the history
  5. Add an image_scale attribute to both Connectors and Cables

    It specifies how an image will use any extra space available in its
    cell. Allowed values are one of these strings:
    - FALSE : keep image its natural size. (Default)
    - TRUE : scale image uniformly to fit.
    - WIDTH : expand image width to fill.
    - HEIGHT : expand image height to fill.
    - BOTH : expand both image width and height to fill.
    
    The value is sent to Graphviz as a scale attribute to the <img> tag.
    Note that there is normally no extra height in the image cell.
    kvid committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    3dc2a55 View commit details
    Browse the repository at this point in the history
  6. Add an image_size attribute to both Connectors and Cables

    It is a list containing minimum width and minimum height of the
    image cell. To obtain more available space in the image cell,
    this size must be set greater than the natural size of the image.
    kvid committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    41b3f3a View commit details
    Browse the repository at this point in the history
  7. Add fixedsize as third image_size value

    When True, enclose the image cell in a table without borders to avoid
    narrow borders when the fixed width is less than the node width.
    kvid committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    3d7f027 View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2020

  1. Move image attributes into Image dataclass to fix change requests

    @formatc1702 requested changes in his review of wireviz#153:
    - Lowercase attribute values
    - Nested image attributes
    - Avoid sending the whole node object as argument to helper functions
    - Simplify html_size_attr()
    - Move the resources folder
    kvid committed Aug 15, 2020
    Configuration menu
    Copy the full SHA
    204379a View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2020

  1. Add info about Image dataclass

    - Add Optional keyword and value alternatives as requested in review.
    - Add a few extra comments about the attributes.
    kvid committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    c23679d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d289f95 View commit details
    Browse the repository at this point in the history
  3. Compute sensible default values for unspecified image attributes

    The goal is to enable the user to avoid specifying more attributes
    than strictly needed.
    kvid committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    0c6b6f3 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2020

  1. Test image.width and image.height without using 'is not None'

    - Simplification requested by @formatc1702 in review of wireviz#153
    - Inspection of size_html_cell() in Graphviz source code
      https://gitlab.com/graphviz/graphviz/-/blob/master/lib/common/htmltable.c#L1210-1221
      supports that a zero value is treated as not specified.
    kvid committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    c217079 View commit details
    Browse the repository at this point in the history
  2. Avoid some bad combinations of default values

    - Avoid setting image.fixedsize default True when image.scale is
      specified different than "true" or "both" by the user.
    - Avoid calculating the missing dimension unless image.fixedsize
      is actually True. It might have been specified False by the user.
    kvid committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    285a28d View commit details
    Browse the repository at this point in the history
  3. Add aspect_ratio() function that reads image size from file

    - To be able to find an image file with relative path, the directory
      of the .gv file output is injected into each Image data object.
    - aspect_ratio() prints a warning and returns 1:1 ratio if it fails.
    kvid committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    19c415c View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2020

  1. Configuration menu
    Copy the full SHA
    9950f7f View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2020

  1. Configuration menu
    Copy the full SHA
    c0a11d0 View commit details
    Browse the repository at this point in the history
  2. Make Image.gv_dir an InitVar

    It is only used during initialization in the __post_init__() function
    and does not need to be a proper attribute of the Image dataclass.
    https://docs.python.org/3/library/dataclasses.html#init-only-variables
    kvid committed Aug 29, 2020
    Configuration menu
    Copy the full SHA
    ede29cb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7c2fdd6 View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2020

  1. Configuration menu
    Copy the full SHA
    dabd4ba View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2020

  1. Add pillow (PIL) as dependecy

    As requested by the owner, it is added to both requirements.txt and
    setup.py - see also issue wireviz#172 about a possible redundancy/conflict.
    kvid committed Oct 11, 2020
    Configuration menu
    Copy the full SHA
    a94ff3d View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2020

  1. Configuration menu
    Copy the full SHA
    50d4dc7 View commit details
    Browse the repository at this point in the history