Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 0 additions & 123 deletions python/tk_desktop/licenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -980,129 +980,6 @@
</pre>
</div>

<!-- PySide2 v.5.15.0 -->
<div>
<p><strong>PySide2 v.5.15.0</strong></p>
<pre>
Portions related to pySide Copyright (C) 2020The Qt Company. This Autodesk
software contains PySide2 v.5.15.0. pySide is licensed under the GNU Lesser
General Public License v.3, which can be found at
https://www.gnu.org/licenses/lgpl-3.0.html. A text copy of this license is
included with the download of this Autodesk software. You may obtain a copy of
the source code for PySide2 v. 5.15.0 from www.autodesk.com/lgplsource or by
sending a written request to:

Autodesk, Inc.
Attention: General Counsel
Legal Department
The Landmark @ One Market
Suite 400
San Francisco, CA 94105

Your written request must:

1. Contain a self-addressed CD/DVD mailer (or envelope sufficiently large to
hold a DVD) with postage sufficient to cover the amount of the current U.S.
Post Office First Class postage rate for CD/DVD mailers (or the envelope you
have chosen) weighing 5 ounces from San Francisco, California USA to your
indicated address; and

2. Identify:
a. This Autodesk software name and release number;
b. That you are requesting the source code for PySide2 v. 5.15.0 and;
c. The above URL (www.autodesk.com/lgplsource )so that Autodesk may
properly respond to your request. The offer to receive this pySide
source code via the above URL (www.autodesk.com/lgplsource ) or by
written request to Autodesk is valid for a period of three (3) years
from the date you purchased your license to this Autodesk software.

You may modify, debug and relink PySide to this Autodesk software as provided
under the terms of the GNU Lesser General Public License v.3.
</pre>
</div>

<!-- PySide6 v6.2.1 -->
<div>
<p><strong>PySide6 v6.2.1</strong></p>
<pre>
Portions related to pySide6 v6.2.1 are Copyright (C) 2020The Qt Company. This
Autodesk software contains pySide6 v6.2.1. pySide6 v6.2.1 is licensed under
the GNU Lesser General Public License v.3, which can be found at
https://www.gnu.org/licenses/lgpl-3.0.html. A text copy of this license is
included with the download of this Autodesk software. You may obtain a copy of
the source code for pySide6 v6.2.1 from www.autodesk.com/lgplsource or by
sending a written request to:

Autodesk, Inc.
Attention: General Counsel
Legal Department
The Landmark @ One Market
Suite 400
San Francisco, CA 94105

Your written request must:

1. Contain a self-addressed CD/DVD mailer (or envelope sufficiently large to
hold a DVD) with postage sufficient to cover the amount of the current U.S.
Post Office First Class postage rate for CD/DVD mailers (or the envelope you
have chosen) weighing 5 ounces from San Francisco, California USA to your
indicated address; and

2. Identify:
a. This Autodesk software name and release number;
b. That you are requesting the source code for pySide6 v6.2.1 and;
c. The above URL (www.autodesk.com/lgplsource )so that Autodesk may
properly respond to your request. The offer to receive this pySide
source code via the above URL (www.autodesk.com/lgplsource ) or by
written request to Autodesk is valid for a period of three (3) years
from the date you purchased your license to this Autodesk software.

You may modify, debug and relink PySide to this Autodesk software as provided
under the terms of the GNU Lesser General Public License v.3.
</pre>
</div>

<!-- PySide6 v6.5.3 -->
<div>
<p><strong>PySide6 v6.5.3</strong></p>
<pre>
Portions related to pySide6 v6.5.3 are Copyright (C) 2020The Qt Company. This
Autodesk software contains pySide6 v6.5.3. pySide6 v6.5.3 is licensed under
the GNU Lesser General Public License v.3, which can be found at
https://www.gnu.org/licenses/lgpl-3.0.html. A text copy of this license is
included with the download of this Autodesk software. You may obtain a copy of
the source code for pySide6 v6.5.3 from www.autodesk.com/lgplsource or by
sending a written request to:

Autodesk, Inc.
Attention: General Counsel
Legal Department
The Landmark @ One Market
Suite 400
San Francisco, CA 94105

Your written request must:

1. Contain a self-addressed CD/DVD mailer (or envelope sufficiently large to
hold a DVD) with postage sufficient to cover the amount of the current U.S.
Post Office First Class postage rate for CD/DVD mailers (or the envelope you
have chosen) weighing 5 ounces from San Francisco, California USA to your
indicated address; and

2. Identify:
a. This Autodesk software name and release number;
b. That you are requesting the source code for pySide6 v6.5.3 and;
c. The above URL (www.autodesk.com/lgplsource )so that Autodesk may
properly respond to your request. The offer to receive this pySide
source code via the above URL (www.autodesk.com/lgplsource ) or by
written request to Autodesk is valid for a period of three (3) years
from the date you purchased your license to this Autodesk software.

You may modify, debug and relink PySide to this Autodesk software as provided
under the terms of the GNU Lesser General Public License v.3.
</pre>
</div>

<!-- Python API v3.6.2 -->
<div>
<p><strong>python-api v3.6.2</strong></p>
Expand Down
80 changes: 79 additions & 1 deletion python/tk_desktop/licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import logging
import os

from sgtk.platform.qt import QtGui
Expand All @@ -16,6 +17,33 @@

LICENSE_LOCATION = os.path.join(os.path.dirname(__file__), "licenses.html")

_logger = logging.getLogger(__name__)

# LBP-approved Qt LGPL attribution template.
# Version placeholders are filled at runtime by get_pyside_license_html().
_PYSIDE_LGPL_TEMPLATE = """\
<!-- Qt / PySide -->
<div>
<p><strong>Qt v. {qt_version} / PySide {pyside_version}</strong></p>
<pre>
The Qt Toolkit is Copyright (C) 2022 The Qt Company Ltd. and other
contributors. This Autodesk software contains Qt v. {qt_version}, as modified
by Autodesk. Qt is licensed under the GNU Lesser General Public License v.3,
which can be found at https://www.gnu.org/licenses/lgpl-3.0.html. You may
obtain a copy of the license and source code for Qt v. {qt_version}, as
modified by Autodesk, from
https://github.com/autodesk-forks/qt5/tree/adsk-v{qt_version} or by sending
a written request to:

Autodesk, Inc.
Attention: General Counsel
Legal Department
The Landmark at One Market Street, Suite 400
San Francisco, CA 94105
</pre>
</div>
"""


class Licenses(QtGui.QDialog):
"""Simple about dialog"""
Expand All @@ -27,5 +55,55 @@ def __init__(self, parent=None):
self.ui = licenses.Ui_Licenses()
self.ui.setupUi(self)
# setSource seems broken on Qt4, so use setHtml instead.
self.ui.licenseText.setHtml(self.get_license_html())

@classmethod
def get_pyside_license_html(cls):
"""Return the Qt/PySide LGPL attribution HTML with runtime version detection.

Detects the installed PySide version so the wording is always accurate
regardless of which SGD and tk-desktop versions are running together.

This method is intentionally designed to be overridable. External code
(e.g. tk-framework-desktopstartup) may replace it on old tk-desktop
builds to inject the correct version when needed.

:returns: HTML string with the Qt/PySide LGPL attribution.
:rtype: str
"""
try:
import PySide6
import PySide6.QtCore

pyside_version = PySide6.__version__
qt_version = PySide6.QtCore.__version__
except ImportError:
try:
import PySide2
import PySide2.QtCore

pyside_version = PySide2.__version__
qt_version = PySide2.QtCore.__version__
except ImportError:
_logger.debug(
"Could not detect PySide version for license attribution."
)
pyside_version = "unknown"
qt_version = "unknown"

return _PYSIDE_LGPL_TEMPLATE.format(
pyside_version=pyside_version,
qt_version=qt_version,
)

@classmethod
def get_license_html(cls):
"""Return the full license HTML, combining the static file with the
dynamic Qt/PySide attribution.

:returns: Full HTML string for the Licenses dialog.
:rtype: str
"""
with open(LICENSE_LOCATION, encoding="utf-8") as f:
self.ui.licenseText.setHtml(f.read())
base_html = f.read()
return base_html + cls.get_pyside_license_html()