Skip to content

Commit

Permalink
Release version 0.5.0 (#9)
Browse files Browse the repository at this point in the history
* Release version 0.5.0

[BUG] Support spaces in file names on Windows
[BUG] Prompt to save modifications before history changes
[BUG] Handle query strings properly during URL expansion
[ENH] Support Tab/Shift+Tab indentation of selected lines
[ENH] Set window icon for MacOS and add repository logo for SourceTree/GitLab
[ENH] Display app version in About dialog
[ENH] Clean up temp files on exit

Signed-off-by: mds-dwa <[email protected]>
  • Loading branch information
mds-dwa authored Jun 20, 2019
1 parent ebe4da1 commit e850562
Show file tree
Hide file tree
Showing 7 changed files with 523 additions and 407 deletions.
5 changes: 4 additions & 1 deletion docs/keyboardShortcuts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,7 @@ For ease of use, there are some extra shortcuts not shown in the menus themselve
- Ctrl+Shift+Tab
* - Reload
- F5

* - Indent (if text is selected)
- Tab
* - Unindent (if text is selected)
- Shift+Tab
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
457 changes: 264 additions & 193 deletions usdmanager/__init__.py

Large diffs are not rendered by default.

Binary file modified usdmanager/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
429 changes: 222 additions & 207 deletions usdmanager/images_rc.py

Large diffs are not rendered by default.

37 changes: 32 additions & 5 deletions usdmanager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,30 @@ def expandPath(path, parentPath=None, sdf_format_args=None):
return os.path.expandvars(os.path.expanduser(os.path.normpath(path)))


def expandUrl(path, parentPath=None):
""" Expand and normalize a URL that may have variables in it and a query string after it.
:Parameters:
path : `str`
File path
parentPath : `str` | None
Parent file path this file is defined in relation to.
Helps with asset resolution.
:Returns:
Normalized path with variables expanded.
:Rtype:
`str`
"""
sdf_format_args = {}
if "?" in path:
sdf_format_args.update(sdfQuery(QtCore.QUrl(path)))
path, query = path.split("?", 1)
query = "?" + query
else:
query = ""
return QtCore.QUrl(os.path.abspath(expandPath(path, parentPath, sdf_format_args)) + query)


def findModules(subdir):
""" Find and import all modules in a subdirectory of this project.
Ignores any files starting with an underscore or tilde.
Expand All @@ -107,20 +131,22 @@ def findModules(subdir):
return modules


def generateTemporaryUsdFile(usdFileName):
def generateTemporaryUsdFile(usdFileName, tmpDir=None):
""" Generate a temporary ASCII USD file that the user can edit.
:Parameters:
usdFileName : `str`
Binary USD file path
tmpDir : `str` | None
Temp directory to create the new unzipped directory within
:Returns:
Temporary file name
:Rtype:
`str`
:Raises OSError:
If usdcat fails
"""
fd, tmpFileName = tempfile.mkstemp(suffix=".usd")
fd, tmpFileName = tempfile.mkstemp(suffix=".usd", dir=tmpDir)
try:
usdcat(usdFileName, tmpFileName, format="usda")
finally:
Expand Down Expand Up @@ -180,7 +206,7 @@ def usdzip(inputs, dest):


# TODO: Support nested references (e.g. @set.usdz[areas/shire.usdz[architecture/BilboHouse/Table.usd]]@)
def unzip(path, layer=None):
def unzip(path, layer=None, tmpDir=None):
""" Unzip a usdz format file to a temporary directory.
:Parameters:
Expand All @@ -189,6 +215,8 @@ def unzip(path, layer=None):
layer : `str` | None
Default layer within file (e.g. the portion within the square brackets here:
@foo.usdz[path/to/file/within/package.usd]@)
tmpDir : `str` | None
Temp directory to create the new unzipped directory within
:Returns:
Destination file
:Rtype:
Expand All @@ -198,8 +226,7 @@ def unzip(path, layer=None):
:Raises ValueError:
If default layer not found
"""
# TODO: Clean up this temp dir when exiting the app?
destDir = tempfile.mkdtemp(prefix="usdmanager_usdz_")
destDir = tempfile.mkdtemp(prefix="usdmanager_usdz_", dir=tmpDir)
cmd = "unzip {} -d {}".format(path, destDir)
logger.debug(cmd)
try:
Expand Down
2 changes: 1 addition & 1 deletion usdmanager/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = '0.4.1'
__version__ = '0.5.0'

0 comments on commit e850562

Please sign in to comment.