-
Notifications
You must be signed in to change notification settings - Fork 11
Remove dependence on Qt #170
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
Open
macumber
wants to merge
26
commits into
develop
Choose a base branch
from
remove_qt
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
decac91
#167 - Replace ProgressDialog with an OS SDK ProgressBar (need to imp…
jmarrec 0f699ff
Initial dialog
macumber 403204f
Style updates
macumber cdf0ab1
Move files
macumber 5581652
Intermediate checkpoint
macumber 69b2921
Intermediate check point
macumber 04ee576
Ready to start dev testing
macumber 18e01c3
Done for this weekend
macumber f449735
Merge remote-tracking branch 'origin/167-Remove_Qt' into remove_qt
macumber 5b92aa7
Interim progress
macumber d1a158d
Good working point
macumber b5146a0
Remove file with rubocop violations
macumber 26997f7
Address review comments
macumber f5e6697
Change ProgressDialog to update html dialog
macumber a67dc2b
Fix remaining issues
macumber 3d125c5
Fix for bug splats on Mac ARM64
macumber 248d12c
Update progress bar in Cleanup_Origins.rb. I guess we have lots of sc…
jmarrec 75f1b12
Replace OpenStudio::Ruleset::ModelUserScript with OpenStudio::Measure…
jmarrec 743eb10
Tweak Assign Building Stories progress bar update
jmarrec 3f84399
Don't center the progress bar if already visible
jmarrec 6949785
Tweak "destroy": hide: only if SU 2026.1, and delay 1s + set done (10…
jmarrec 21e63d1
Return type Correctness: All OpenStudio Measures should always return…
jmarrec c4f5392
Existing copy pasta bug in one measure
jmarrec b4a6fd9
Capture failures and set progress bar to red if so
jmarrec 4c25bb4
<title> div is useless, this is set once internally via UI::HtmlDialo…
jmarrec 1b4d914
dlg.visible? returns true after hiding dialog in 2026, always call sh…
macumber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| ######################################################################################################################## | ||
| # OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors. | ||
| # See also https://openstudiocoalition.org/about/software_license/ | ||
| ######################################################################################################################## | ||
|
|
||
| module OpenStudio | ||
|
|
||
| # Maps each SpaceLoadInstance IDD type name (upper-case, colon-style) to: | ||
| # :definition_type – IDD type name of the matching Definition object | ||
| # :field_index – index of the "Definition Name" field in the instance object | ||
| SPACE_LOAD_DEFINITION_MAP = { | ||
| 'OS:ELECTRICEQUIPMENT' => { definition_type: 'OS_ElectricEquipment_Definition', field_index: 2 }, | ||
| 'OS:GASEQUIPMENT' => { definition_type: 'OS_GasEquipment_Definition', field_index: 2 }, | ||
| 'OS:HOTWATEREQUIPMENT' => { definition_type: 'OS_HotWaterEquipment_Definition', field_index: 2 }, | ||
| 'OS:INTERNALMASS' => { definition_type: 'OS_InternalMass_Definition', field_index: 2 }, | ||
| 'OS:LIGHTS' => { definition_type: 'OS_Lights_Definition', field_index: 2 }, | ||
| 'OS:LUMINAIRE' => { definition_type: 'OS_Luminaire_Definition', field_index: 2 }, | ||
| 'OS:PEOPLE' => { definition_type: 'OS_People_Definition', field_index: 2 }, | ||
| }.freeze | ||
|
|
||
| # Pure-Ruby replacement for OpenStudio::Modeleditor::ensureSpaceLoadDefinition. | ||
| # | ||
| # Ensures that the given SpaceLoadInstance workspace object has a linked | ||
| # Definition object. If the instance already points to a definition, returns | ||
| # immediately. Otherwise: | ||
| # 1. If the model contains existing definitions of the matching type, asks | ||
| # the user whether to reuse one (picks the first) or create a new one. | ||
| # 2. Creates a new blank definition and links it to the instance. | ||
| # | ||
| # @param model_object [OpenStudio::WorkspaceObject] a SpaceLoadInstance | ||
| def self.ensureSpaceLoadDefinition(model_object) | ||
| return if model_object.nil? | ||
|
|
||
| type_key = model_object.iddObject.name.upcase | ||
| mapping = SPACE_LOAD_DEFINITION_MAP[type_key] | ||
|
|
||
| unless mapping | ||
| Plugin.log(OpenStudio::Warn, | ||
| "ensureSpaceLoadDefinition: unknown SpaceLoadInstance type '#{type_key}' – skipping") | ||
| return | ||
| end | ||
|
|
||
| definition_type_str = mapping[:definition_type] | ||
| field_index = mapping[:field_index] | ||
|
|
||
| # If a definition is already linked, nothing to do | ||
| current_def = model_object.getTarget(field_index) | ||
| return unless current_def.empty? | ||
|
|
||
| model = model_object.model | ||
| idd_type = OpenStudio::IddObjectType.new(definition_type_str) | ||
| existing = model.getObjectsByType(idd_type) | ||
|
|
||
| definition_handle = nil | ||
|
|
||
| if !existing.empty? | ||
| # Ask the user whether to reuse an existing definition or create a new one. | ||
| # The C++ code showed a full selector dialog; here we offer a simple YES/NO. | ||
| friendly_type = model_object.iddObject.name.sub(/^OS:/, '').gsub(/(?<=[a-z])(?=[A-Z])/, ' ') | ||
| answer = UI.messagebox( | ||
| "The model has #{existing.size} existing #{friendly_type} Definition(s).\n\n" \ | ||
| "Click YES to reuse the first existing definition.\n" \ | ||
| "Click NO to create a new blank definition.", | ||
| MB_YESNO | ||
| ) | ||
|
|
||
| if answer == 6 # YES – reuse the first existing definition | ||
| definition_handle = existing.first.handle.to_s | ||
| end | ||
| # NO falls through to create a new definition below | ||
| end | ||
|
|
||
| if definition_handle.nil? | ||
| # Create a new blank definition object | ||
| new_def_opt = model.addObject(OpenStudio::IdfObject.new(idd_type)) | ||
| unless new_def_opt.empty? | ||
| definition_handle = new_def_opt.get.handle.to_s | ||
| end | ||
| end | ||
|
|
||
| if definition_handle | ||
| model_object.setString(field_index, definition_handle) | ||
| else | ||
| Plugin.log(OpenStudio::Error, | ||
| "ensureSpaceLoadDefinition: failed to create or find a definition for #{type_key}") | ||
| end | ||
|
|
||
| rescue => e | ||
| Plugin.log(OpenStudio::Error, "ensureSpaceLoadDefinition error: #{e.message}") | ||
| end | ||
|
|
||
| end # module OpenStudio |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.