Skip to content

Commit e850562

Browse files
authored
Release version 0.5.0 (#9)
* 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]>
1 parent ebe4da1 commit e850562

File tree

7 files changed

+523
-407
lines changed

7 files changed

+523
-407
lines changed

docs/keyboardShortcuts.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,7 @@ For ease of use, there are some extra shortcuts not shown in the menus themselve
106106
- Ctrl+Shift+Tab
107107
* - Reload
108108
- F5
109-
109+
* - Indent (if text is selected)
110+
- Tab
111+
* - Unindent (if text is selected)
112+
- Shift+Tab

logo.png

4.21 KB
Loading

usdmanager/__init__.py

Lines changed: 264 additions & 193 deletions
Large diffs are not rendered by default.

usdmanager/images/logo.png

241 Bytes
Loading

usdmanager/images_rc.py

Lines changed: 222 additions & 207 deletions
Large diffs are not rendered by default.

usdmanager/utils.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,30 @@ def expandPath(path, parentPath=None, sdf_format_args=None):
8383
return os.path.expandvars(os.path.expanduser(os.path.normpath(path)))
8484

8585

86+
def expandUrl(path, parentPath=None):
87+
""" Expand and normalize a URL that may have variables in it and a query string after it.
88+
89+
:Parameters:
90+
path : `str`
91+
File path
92+
parentPath : `str` | None
93+
Parent file path this file is defined in relation to.
94+
Helps with asset resolution.
95+
:Returns:
96+
Normalized path with variables expanded.
97+
:Rtype:
98+
`str`
99+
"""
100+
sdf_format_args = {}
101+
if "?" in path:
102+
sdf_format_args.update(sdfQuery(QtCore.QUrl(path)))
103+
path, query = path.split("?", 1)
104+
query = "?" + query
105+
else:
106+
query = ""
107+
return QtCore.QUrl(os.path.abspath(expandPath(path, parentPath, sdf_format_args)) + query)
108+
109+
86110
def findModules(subdir):
87111
""" Find and import all modules in a subdirectory of this project.
88112
Ignores any files starting with an underscore or tilde.
@@ -107,20 +131,22 @@ def findModules(subdir):
107131
return modules
108132

109133

110-
def generateTemporaryUsdFile(usdFileName):
134+
def generateTemporaryUsdFile(usdFileName, tmpDir=None):
111135
""" Generate a temporary ASCII USD file that the user can edit.
112136
113137
:Parameters:
114138
usdFileName : `str`
115139
Binary USD file path
140+
tmpDir : `str` | None
141+
Temp directory to create the new unzipped directory within
116142
:Returns:
117143
Temporary file name
118144
:Rtype:
119145
`str`
120146
:Raises OSError:
121147
If usdcat fails
122148
"""
123-
fd, tmpFileName = tempfile.mkstemp(suffix=".usd")
149+
fd, tmpFileName = tempfile.mkstemp(suffix=".usd", dir=tmpDir)
124150
try:
125151
usdcat(usdFileName, tmpFileName, format="usda")
126152
finally:
@@ -180,7 +206,7 @@ def usdzip(inputs, dest):
180206

181207

182208
# TODO: Support nested references (e.g. @set.usdz[areas/shire.usdz[architecture/BilboHouse/Table.usd]]@)
183-
def unzip(path, layer=None):
209+
def unzip(path, layer=None, tmpDir=None):
184210
""" Unzip a usdz format file to a temporary directory.
185211
186212
:Parameters:
@@ -189,6 +215,8 @@ def unzip(path, layer=None):
189215
layer : `str` | None
190216
Default layer within file (e.g. the portion within the square brackets here:
191217
@foo.usdz[path/to/file/within/package.usd]@)
218+
tmpDir : `str` | None
219+
Temp directory to create the new unzipped directory within
192220
:Returns:
193221
Destination file
194222
:Rtype:
@@ -198,8 +226,7 @@ def unzip(path, layer=None):
198226
:Raises ValueError:
199227
If default layer not found
200228
"""
201-
# TODO: Clean up this temp dir when exiting the app?
202-
destDir = tempfile.mkdtemp(prefix="usdmanager_usdz_")
229+
destDir = tempfile.mkdtemp(prefix="usdmanager_usdz_", dir=tmpDir)
203230
cmd = "unzip {} -d {}".format(path, destDir)
204231
logger.debug(cmd)
205232
try:

usdmanager/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = '0.4.1'
16+
__version__ = '0.5.0'

0 commit comments

Comments
 (0)