Skip to content

Conversation

@PhoneDroid
Copy link
Member

Inspired by the work done here

I decided to go with a minimal
approach for my own implementation.

  • Adds multi tabs to addon overviews.
  • Adds a License tab

Help wanted, if someone with Python async knowledge
could make this not block the UI, that's be just great ..


Implementation Notes

I decided to have mapping of the tabs to their tab indices
to not have to hard code them and keep them in sync.

The license text is currently just dumped in the
tab, for now I just wanted to get it to work.

elif self.url.lower().endswith(".html"):
self.readme_data_type = ReadmeDataType.Html

with open(self.url, "r") as fd:

Check warning

Code scanning / CodeQL

File is not always closed Warning

File may not be closed if an exception is raised.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not my fault, seize!

Copy link
Member

@chennes chennes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments, below. Also your new code includes blank lines between nearly every line of code, so I don't know if your IDE doesn't like something or what.

Comment on lines +153 to +162
def loadLicense(self, license: License, text: QtWidgets.QTextEdit):

url = utils.construct_git_url(self.addon, license.file)

manager = NetworkManager.AM_NETWORK_MANAGER

index = manager.submit_unmonitored_get(url)

self.license_requests[index] = {"license": license, "text": text}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of whitespace here, for no benefit that I can see.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same reason as using mutliline or names other than
x , y , z for variable names, makes it easier to read?
Group together what belongs together..

You have auto-formatting rules, if you don't
like it, shouldn't you have configured that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule with using Black is, you don't configure Black 😁 -- we break that by setting the line length, but otherwise there aren't any settings. Black will let you put individual blank lines in as you see fit, which is good because it's basically impossible to check that programmatically. I'm just questioning these blank lines: there's nothing to "group", you have four individual lines. So the only grouping is that they are all part of the loadLicense method (which PEP8 says should be called load_license).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well yeah, each line does something different, if I had something like x = y() and then a bunch of indexing into x like x.z = '' I'd put them together.

I have a hard time reading blocks of text so I space things 0 , 1 , 2 lines apart depending on the context.

I can smush them all together if you'd like.

self.tabs_widget = QtWidgets.QTabWidget(self)

self.tabs[TabView.Readme] = self.tabs_widget.addTab(
self.readme_browser, translate("AddonsInstaller", "README")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FreeCAD/design-working-group what's our canonical capitalization of "README"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem like we will get any more comments any time soon, ..
I adjusted it to Overview + License.

@chennes
Copy link
Member

chennes commented Sep 29, 2025

I'll give this a refactoring pass today or tomorrow -- we shouldn't use a WidgetReadmeBrowser if ultimately we need a whole list of QTextEdit in the tab. Licenses are strange, and probably need their own class and controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants