USEPA / SWMM-EPANET_User_Interface

User interface for the Stormwater-Management-Model
111 stars 66 forks source link

Save widget geometry and shape for Title/Notes #363

Closed barrc closed 4 years ago

barrc commented 4 years ago

See #361

This demonstrates a possible way to save and restore the widget dimensions for the Title/Notes box.

I'm not sure if this is the best approach, so before going through the rest of the widgets and adding code, I'm hoping to get feedback. If so, I would add these functions and call them like I do in this example in the other SWMM widgets.

TongZhai commented 4 years ago

@barrc I think this is a good idea. In fact, currently, there are two settings the program is maintaining when it is running, i.e. program_settings and project_settings. The project_settings is used to save things like parameter defaults etc, things related to model setup and simulation. The program_settings is used for things like UI look and feel type of things, so these window state stuff should go in there and there is already mechanism setup for recording and retrieving settings via simple function calls. So, let's discuss this further and coordinate as it looks like this will touch on a lot of elements.

barrc commented 4 years ago

@TongZhai @PaulDudaRESPEC thank you for the feedback, I need to take a look at program_settings, using a name-specific window, and the default size and position.

TongZhai commented 4 years ago

@barrc program_settings will save settings into file like .ini files. Entries can be put into groups. There are 3 inifile.py, i.e. ui/inifile.py, ui/SWMM/inifile.py, and ui/EPANET/inifile.py, the latter two inherit from the first one. It's been a while since I last worked on these, feel free to discuss where to put the setting.

barrc commented 4 years ago

@PaulDudaRESPEC @TongZhai still just working on Title/Notes for now, but I got it set up to use program_settings. Specifically it saves to a section called [Geometry] in the .ini file.

Couple questions:

Thanks!

PaulDudaRESPEC commented 4 years ago

@barrc I think your commit looks good, I like the naming. I would suggest checking to see if the values exist and if so use them.

barrc commented 4 years ago

Thanks @PaulDudaRESPEC. From our call today it seemed like there was some uncertainty whether there was a better approach or whether we should try this way and add similar code to all the forms. I looked at the documentation for Qsettings but didn't see an obvious way to save the dimensions/position of all modals at once. Do you think we should go ahead and add this code to all the forms? Or is there a better way that you (or @TongZhai) see?

PaulDudaRESPEC commented 4 years ago

I don't see a better way to do all at once. @TongZhai mentioned that there might be; we should see if he can respond. In the meantime, I suggest you try this approach in the dates form that I just improved to be expandable -- it would be nice to see it resolves the concerns of @michelleannesimon with regard to the sizing/resolution issues.

PaulDudaRESPEC commented 4 years ago

I don't see a better way to do all at once. @TongZhai mentioned that there might be; we should see if he can respond. In the meantime, I suggest you try this approach in the dates form that I just improved to be expandable -- it would be nice to see it resolves the concerns of @michelleannesimon with regard to the sizing/resolution issues.

barrc commented 4 years ago

@PaulDudaRESPEC good idea, I tried this approach for the dates form in PR #405

barrc commented 4 years ago

Thanks for merging my other PR @PaulDudaRESPEC! I agree, now we can let @michelleannesimon test how it works along with your change. If it seems good to her, I can go ahead and add similar code to the other forms.

barrc commented 4 years ago

I just talked with Michelle and Faryn. Michelle tested the Dates form in dev-ui-py3qt5 and it looked good to her so she requested I work on adding similar code to the other SWMM forms. I'm going to close this PR now and work on that separately.