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: Adds register method #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

FIX: Adds register method #5

wants to merge 2 commits into from

Conversation

sauravsrijan
Copy link
Contributor

registers new icons, updates README, adds tests and a test svg icon.

registers new icons, updates README, adds tests and a test svg icon.
@@ -102,6 +103,26 @@ def _calculate_height(self, width):
return int((int(width) * self.height) / self.width)


# Register method for a new icon.
@classmethod
def register(cls, symbol, svg_file):
Copy link
Owner

Choose a reason for hiding this comment

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

Add a docstring for this method, which should explain what this method does and how it should be used. This is important since it's a public method.

doc = minidom.parse(svg_file)
path_strings = [path.getAttribute('d') for path
in doc.getElementsByTagName('path')]
path = '<path fill-rule="evenodd" d="'+path_strings[0]+'"'+"/>"
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 comments for all these magic literals.

path = '<path fill-rule="evenodd" d="'+path_strings[0]+'"'+"/>"

values = {
'name': symbol,
Copy link
Owner

Choose a reason for hiding this comment

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

Indent the key-value pairs one level.

}

OCTICON_DATA.update({symbol:values})
doc.unlink()
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this needed? Please add a comment.

'path': path
}

OCTICON_DATA.update({symbol:values})
Copy link
Owner

Choose a reason for hiding this comment

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

This function should return True if the registration is successful.

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