-
-
Notifications
You must be signed in to change notification settings - Fork 411
Print Sheets Improvements #2962 #2968
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
base: develop
Are you sure you want to change the base?
Conversation
Implement sheet search functionality to filter sheets based on user input.
Added configuration handling for print settings and improved document selection logic.
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.
PR Summary:
This PR adds several improvements to the Print Sheets tool:
- Search bar to filter sheets by number/name
- Load Last Print Settings feature to restore previous print configurations per project
- Auto-select naming format from Project Information parameter
- Right-click to copy naming format to clipboard
Review Summary:
Reviewed the PR and identified 2 critical issues, 3 high-severity issues, and 1 low-severity style issue. The most critical problem is that EditNamingFormats.xaml has been completely replaced with the wrong content (appears to be PrintSheets.xaml), which will break the Edit Formats functionality. Additionally, there's a wrong event handler binding in PrintSheets.xaml that breaks the index start feature. The code also contains bare except: clauses that violate repository guidelines requiring explicit exception types, and lacks defensive null checking before accessing ProjectInformation.
Knowledge utilized: Repository code standards (PEP 8, Black formatting, IronPython 2.7.12 requirements), review validation checklist (exception handling patterns, defensive programming), and configuration parser patterns.
Follow-up suggestions:
@devloai fix the identified issues- Address the critical XAML file replacement and event handler binding issues@devloai ensure EditNamingFormats.xaml is reverted to its original content- Restore the naming formats editor functionality
...sions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Print Sheets.pushbutton/script.py
Outdated
Show resolved
Hide resolved
...sions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Print Sheets.pushbutton/script.py
Show resolved
Hide resolved
...Tools.extension/pyRevit.tab/Drawing Set.panel/Print Sheets.pushbutton/EditNamingFormats.xaml
Outdated
Show resolved
Hide resolved
| Click="rest_index" /> | ||
| <TextBox x:Name="indexstart_tb" Text="0" Margin="10,0,0,0" VerticalContentAlignment="Center" Padding="5,0,0,0" | ||
| PreviewTextInput="validate_index_start" TextChanged="options_changed"/> | ||
| PreviewTextInput="validate_index_start" TextChanged="sheet_search_changed"/> |
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.
Wrong event handler breaks index start functionality
The indexstart_tb TextBox is incorrectly bound to sheet_search_changed instead of options_changed. This means changing the index start value will trigger the search filter instead of updating print options.
Expected behavior: Changing index start should update print indices
Actual behavior: Changing index start triggers sheet search
| PreviewTextInput="validate_index_start" TextChanged="sheet_search_changed"/> | |
| PreviewTextInput="validate_index_start" TextChanged="options_changed"/> |
actions
Feedback: Rate this comment to help me improve future code reviews:
- 👍 Good - Helpful and accurate
- 👎 Poor - Wrong, unclear, or unhelpful
- Skip if you don't have any strong opinions either way.
|
|
||
|
|
||
| def _apply_projectinfo_naming_format_default(self): | ||
| pi = self.selected_doc.ProjectInformation |
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.
Potential NullReferenceException when accessing ProjectInformation
The code attempts to access self.selected_doc.ProjectInformation without checking if selected_doc is None. This could throw an exception during initialization if the document isn't loaded yet.
Add a null check before accessing ProjectInformation:
def _apply_projectinfo_naming_format_default(self):
if not self.selected_doc:
return
pi = self.selected_doc.ProjectInformation
# ... rest of the codeactions
Feedback: Rate this comment to help me improve future code reviews:
- 👍 Good - Helpful and accurate
- 👎 Poor - Wrong, unclear, or unhelpful
- Skip if you don't have any strong opinions either way.
| import os.path as op | ||
| import codecs | ||
| import os, datetime, locale | ||
| import os, datetime, locale, ConfigParser |
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.
Import style: ConfigParser should be on separate line
According to PEP 8 style guide (repository requirement):
"Imports should usually be on separate lines"
Change to:
import os, datetime, locale
import ConfigParseractions
Feedback: Rate this comment to help me improve future code reviews:
- 👍 Good - Helpful and accurate
- 👎 Poor - Wrong, unclear, or unhelpful
- Skip if you don't have any strong opinions either way.
…l/Print Sheets.pushbutton/script.py Co-authored-by: devloai[bot] <168258904+devloai[bot]@users.noreply.github.com>
Print Sheet Improvements
Description
Search Bar - Filters drawings, hiding sheet number / names that don't contain string.
DONELoad Last Print Settings? - Ticking this will load the last print settings you used on that project.
QA/TIDY CODE/IMPROVE UINaming Format - if Project information parameter: Naming Format matches a built in pyRevit Naming Format, then choose this Naming Format by default when Print Sheet loads.
QA/ALLOW NAMING FORMATS FROM pyRevit_config.iniNaming Format 2 - Allow namingformat_cb to be right clicked and copied to clipboard.
DONEEmbed images when exporting to DWG - Sadly don't think this is possible
Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}Related Issues
If applicable, link the issues resolved by this pull request:
Additional Notes
WIP
Thank you for contributing to pyRevit! 🎉