-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: master
Are you sure you want to change the base?
Conversation
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): |
There was a problem hiding this comment.
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]+'"'+"/>" |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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}) |
There was a problem hiding this comment.
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.
registers new icons, updates README, adds tests and a test svg icon.