Skip to content

Commit 039839c

Browse files
authored
Merge pull request #18 from dreamworksanimation/dev
Release version 0.10.0
2 parents 1e5d5bc + 6d3e2ca commit 039839c

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

usdmanager/__init__.py

+18-17
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
# Set up logging.
8989
logger = logging.getLogger(__name__)
9090
logging.basicConfig()
91+
logger.setLevel(logging.WARNING)
9192

9293

9394
# Qt.py compatibility: HACK for missing QUrl.path in PySide2 build.
@@ -141,11 +142,14 @@ class UsdMngrWindow(QtWidgets.QMainWindow):
141142
- Mac could use more testing and work with icons and theme.
142143
143144
- Remember scroll position per file so going back in history jumps you to approximately where you were before.
145+
- Add Browse... buttons to select default applications.
146+
- Set consistent cross-platform read/write/execute permissions when saving new files
144147
145148
Known issues:
146149
147150
- AddressBar file completer has problems occasionally.
148151
- Figure out why network printers aren't showing up. Linux or DWA issue? macOS and Windows are fine.
152+
- Save As... doesn't add file to recent files or history menus.
149153
- Qt.py problems:
150154
151155
- PyQt5
@@ -291,7 +295,11 @@ def setupUi(self):
291295
self.exitAction.setIcon(ft("application-exit"))
292296
self.documentationAction.setIcon(ft("help-browser"))
293297
self.aboutAction.setIcon(ft("help-about"))
294-
self.buttonCloseFind.setIcon(ft("window-close")) # TODO: Need mac icon
298+
icon = ft("window-close")
299+
if icon.isNull():
300+
self.buttonCloseFind.setText("x")
301+
else:
302+
self.buttonCloseFind.setIcon(ft("window-close"))
295303

296304
# Try for standard name, then fall back to crystal_project name.
297305
self.actionBrowse.setIcon(ft("applications-internet", ft("Globe")))
@@ -2769,7 +2777,7 @@ def setSource(self, link, isNewFile=True, newTab=False, hScrollPos=0, vScrollPos
27692777
# Read in the file.
27702778
usd = False
27712779
try:
2772-
if self.validateFileSize(fileStr):
2780+
if self.validateFileSize(fileInfo):
27732781
if utils.queryItemBoolValue(link, "binary") or ext == "usdc":
27742782
# Treat this file as a binary USD crate file. Don't bother
27752783
# checking the first line. If this is a valid ASCII USD
@@ -3043,18 +3051,18 @@ def setSources(self, files):
30433051
for path in files:
30443052
self.setSource(utils.expandUrl(path, prevPath), newTab=True)
30453053

3046-
def validateFileSize(self, path):
3054+
def validateFileSize(self, info):
30473055
""" If a file's size is above a certain threshold, confirm the user still wants to open the file.
30483056
30493057
:Parameters:
3050-
path : `str`
3051-
File path
3058+
info : `QtCore.QFileInfo`
3059+
File info object
30523060
:Returns:
30533061
If we should open the file or not
30543062
:Rtype:
30553063
`bool`
30563064
"""
3057-
size = QtCore.QFileInfo(path).size()
3065+
size = info.size()
30583066
if size >= 104857600: # 100 MB
30593067
self.restoreOverrideCursor()
30603068
try:
@@ -3126,9 +3134,9 @@ def goPressed(self, *args):
31263134
""" Handle loading the current path in the address bar.
31273135
"""
31283136
# Check if text has changed.
3129-
text = utils.expandUrl(self.addressBar.text().strip())
3130-
if text != self.currTab.getCurrentUrl():
3131-
self.setSource(text)
3137+
url = utils.expandUrl(self.addressBar.text().strip())
3138+
if url != self.currTab.getCurrentUrl():
3139+
self.setSource(url)
31323140
else:
31333141
self.refreshTab()
31343142

@@ -3786,7 +3794,6 @@ def __init__(self, parent=None):
37863794
self.tabBar = TabBar(self)
37873795
self.tabBar.tabMoveRequested.connect(self.moveTab)
37883796
self.setTabBar(self.tabBar)
3789-
QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Tab"), self, self.nextTab)
37903797

37913798
@Slot(int, int)
37923799
def moveTab(self, fromIndex, toIndex):
@@ -3805,12 +3812,6 @@ def moveTab(self, fromIndex, toIndex):
38053812
self.insertTab(toIndex, widget, icon, text)
38063813
self.setCurrentIndex(toIndex)
38073814

3808-
def nextTab(self):
3809-
""" Switch to the next tab. If on the last tab, go back to the first.
3810-
"""
3811-
i = self.currentIndex() + 1
3812-
self.setCurrentIndex(0 if i == self.count() else i)
3813-
38143815
def setTabIcon(self, index, icon):
38153816
""" Override the default method to set the same icon on our custom action that focuses on or re-opens the
38163817
widget at the given index.
@@ -4585,7 +4586,6 @@ def _set_log_level(self):
45854586
45864587
Call this after each component in the case of misbehaving libraries.
45874588
"""
4588-
logger.setLevel(logging.WARNING)
45894589
if self.opts['info']:
45904590
logger.setLevel(logging.INFO)
45914591
if self.opts['debug']:
@@ -4650,6 +4650,7 @@ def onExit(self):
46504650
"""
46514651
App._eventLoopStarted = False
46524652
self.cleanup()
4653+
logging.shutdown()
46534654

46544655

46554656
class Settings(QtCore.QSettings):

usdmanager/file_status.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ def __init__(self, url=None, update=True, truncated=False):
4545
If the file was truncated on read, and therefore should never be edited.
4646
"""
4747
self.url = url if url else QUrl()
48-
self.path = url.path() if url else ""
48+
self.path = "" if self.url.isEmpty() else self.url.path()
4949
self.status = self.FILE_NEW
50+
self.fileInfo = None
5051
if update:
5152
self.updateFileStatus(truncated)
52-
else:
53-
self.fileInfo = None
5453

5554
def updateFileStatus(self, truncated=False):
5655
""" Cache the status of a file.
@@ -60,7 +59,9 @@ def updateFileStatus(self, truncated=False):
6059
If the file was truncated on read, and therefore should never be edited.
6160
"""
6261
if self.path:
63-
self.fileInfo = QFileInfo(self.path)
62+
if self.fileInfo is None:
63+
self.fileInfo = QFileInfo(self.path)
64+
self.fileInfo.setCaching(False)
6465
if truncated:
6566
self.status = self.FILE_TRUNCATED
6667
elif self.fileInfo.isWritable():

usdmanager/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def unzip(path, tmpDir=None):
227227
tmpDir : `str` | None
228228
Temp directory to create the new unzipped directory within
229229
:Returns:
230-
Destination directory for unzipped usdz
230+
Absolute path to destination directory for unzipped usdz
231231
:Rtype:
232232
`str`
233233
:Raises zipfile.BadZipfile:

usdmanager/version.py

+1-1
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.9.0'
16+
__version__ = '0.10.0'

0 commit comments

Comments
 (0)