-
Notifications
You must be signed in to change notification settings - Fork 5
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
Added the ability to generate custom_labels with custom ranges. #141
base: develop
Are you sure you want to change the base?
Added the ability to generate custom_labels with custom ranges. #141
Conversation
…o support python 3.8
I'm getting an error trying to onboard nautobot using this app, granted im starting from scratch, reproduction: Error trace
|
@msheiny that sounds like the migrations didn't run. |
Yeeeeepppp - that's exactly it. Looks good now! |
The
|
Moved all but svg.py to utils folder. I feel like svg.py is a core component of floor plan and not just a utility. |
I recommend squashing these commits down to make the history cleaner before the final merge. I was also thinking on the custom range selection, as feature request (i can file it as an |
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.
I'll freely admit I didn't review this exhaustively, but while quite complex it seems well-documented and thoroughly tested. Hopefully it doesn't end up being too complex to maintain. :-)
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.
I dropped a few comments with references to code areas that were missing a lot of test coverage in my local tests.
This PR is pretty large though, it might be better to let it by if you confirmed it works locally and then swoop back in another PR to try to get more test coverage. Just worried long-term if anyone wants to go make changes to some of these sections later and they can't be 100% confident whether they broke anything or not.
return grid_number_to_letter(converted_location) | ||
|
||
|
||
def axis_init_label_conversion(axis_origin, axis_location, step, is_letters): |
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.
) from e | ||
|
||
|
||
def axis_clean_label_conversion(axis_origin, axis_label, step, is_letters, custom_ranges=None): |
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.
return str(original_location) | ||
|
||
|
||
def calculate_letter_range_size(custom_range, converter): |
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.
looks like dead code? I couldn't find it's reference in-use though theres a similar method in custom_validators.py
-> _calculate_letter_range_size
return labels[:count] | ||
|
||
# If custom ranges don't provide enough labels, fall back to default labeling | ||
if len(labels) < count: |
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.
Looks like everything under this if statement is not being triggered in tests
|
||
return labels | ||
|
||
def _generate_default_labels(self, axis, count): |
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 method isnt being hit in unit tests
|
||
return self._generate_default_range(start, step, count, is_letters) | ||
|
||
def _generate_default_range(self, start, step, count, is_letters): |
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 section is not being hit in unit-tests
Added the ability to generate custom labels with custom ranges. Currently supports Alphanumeric, Numbers, NumericAlpha, Letters, Roman Numerals, Greek Letter, Binary, and Hex. Updated table and default views to display custom label information if configured.
Added a custom label tab to floor plan form. Added an option to disable tile movement once placed on a floor plan.