usdmanager package

Module contents

Application module for usdmanager.

Class hierarchy:

  • App

    • UsdMngrWindow (multiple windows allowed)

      • AddressBar

      • TabWidget

        • TabBar

        • BrowserTab (one tab per file)

          • TextBrowser

            • LineNumbers
          • TextEdit

            • PlainTextLineNumbers
class usdmanager.AddressBar(parent)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Custom QLineEdit class to enable drag/drop.

addressBarActivated()[source]

Trigger loading of the current path in the address bar.

dragEnterEvent(event)[source]

Allow drag events of a file path to the address bar.

dropEvent(event)[source]

Allow drop events of a file path to the address bar.

goPressed

Used by autodoc_mock_imports.

openFile

Used by autodoc_mock_imports.

class usdmanager.AddressBarCompleter(*args, **kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Custom completer for AddressBar.

class usdmanager.App[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Application class that initializes the main Qt window as defined in a ui template file.

app = None
appDisplayName = 'USD Manager'
cleanup()[source]

Clean up the temp dir.

config = None
createWindowFrame()[source]

Create a a new widget based on self.uiSource.

Returns:A dynamically-created widget object.
Rtype:CustomWidget
mainLoop()[source]

Start the application loop.

newWindow()[source]

Create a new main window.

Returns:New main window widget
Rtype:QtWidgets.QWidget
onExit()[source]

Callback when the application is exiting.

run()[source]

Launch the application.

tmpDir = None
uiSource

alias of UsdMngrWindow

usdCache = {}
class usdmanager.BrowserTab(parent=None)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

A QWidget that contains custom objects for each tab in the browser. This primarily consists of a text browser and text editor.

addHistoryAction(menu, index=0)[source]

Create a menu action for the current path.

Parameters:
menu : QtWidgets.QMenu

Menu to add action to

index : int

Index to insert action at. Defaults to the start of the menu if the index isn’t given or is invalid.

changeTab

Used by autodoc_mock_imports.

dragEnterEvent(event)[source]

Accept drag enter events from the custom file browser.

dropEvent(event)[source]

If we receive a drop event with a file path, open the file in a new tab.

findUrl(url)[source]

Find the index of the given path in the tab’s history.

This returns the first occurrence if it is in the history more than once.

Parameters:
url : QtCore.QUrl

URL to search for in history.

Returns:

Index of the given path in the history, or 0 if not found.

Rtype:

int

getCurrentPath()[source]

Get the absolute path of the current file.

Returns:Absolute path to current file Ex: /studio/filename.usd
Rtype:str
getCurrentTextWidget()[source]

Get the current text widget (browser or editor).

Returns:The current text widget, based on edit mode
Rtype:TextBrowser | TextEdit
getCurrentUrl()[source]

Get the absolute path to the current file with any query strings appended.

Returns:Absolute path to current file plus any query strings. Ex: file:///studio/filename.usd?line=14
Rtype:QtCore.QUrl
getFileStatus()[source]

Get the current file’s status.

Returns:The current file’s cached status
Rtype:FileStatus
goBack()[source]

Go back in history one item.

goForward()[source]

Go forward in history one item.

goToLineNumber(line=1)[source]

Go to the given line number

Parameters:
line : int

Line number to scroll to. Defaults to 1 (top of document).

gotoBreadcrumb(url, index=None)[source]

Go to the historical index of the given URL.

This does not handle updating the displayed document.

Parameters:
url : QtCore.QUrl

Breadcrumb URL

index : int | None

History index of the item to go to

isBackwardAvailable()[source]

Check if you can go back in history.

Returns:If the backward action for history is available.
Rtype:bool
isDirty()[source]

Check if the current file has been modified in app.

Returns:If the current text editor document has been modified
Rtype:bool
isForwardAvailable()[source]

Check if you can go forward in history.

Returns:If the forward action for history is available.
Rtype:bool
onActionTriggered(*args)[source]

Slot called when an action for the tab is activated (i.e. a tab from the Recently Closed Tabs menu).

onHistoryActionTriggered(url)[source]

Go to the URL when a RecentItem action is clicked.

Parameters:
url : QtCore.QUrl

URL

openFile

Used by autodoc_mock_imports.

openOldUrl

Used by autodoc_mock_imports.

restoreTab

Used by autodoc_mock_imports.

setDirty(dirty=True)[source]

Set the dirty state.

Parameters:
dirty : bool

If this tab is dirty.

setIndentSettings(useSpaces=True, tabSpaces=4, autoIndent=True)[source]

Set various indent settings, such as spaces for tabs and auto indentation

Parameters:
useSpaces : bool

Use spaces instead of a tab character

spaces : int

Tab size in spaces

autoIndent: bool

Automatically copy indentation from above line with return

tabNameChanged

Used by autodoc_mock_imports.

updateBreadcrumb()[source]

Update the breadcrumb of file browsing paths and the action for the currently open file, which lets us restore the tab after it is closed.

updateFileStatus(truncated=False)[source]

Check the status of a file.

Parameters:
truncated : bool

If the file was truncated on read, and therefore should never be edited.

updateHistory(url, update=False, truncated=False)[source]

Add a newly created file to the tab’s history, cutting off any forward history.

Parameters:
url : QtCore.QUrl

Link for file to add to history list.

update : bool

Update the path’s file status cache.

truncated : bool

If the file was truncated on read, and therefore should never be edited.

class usdmanager.RecentFile(url, parent=None, slot=None)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Action representing an individual file in the Recent Files or history menus.

onClick(*args)[source]

Signal to open the selected file in the current tab.

openUrl

Used by autodoc_mock_imports.

class usdmanager.Settings(*args, **kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Add a method to get bool values from settings, since bool is stored as the str “true” or “false.”

boolValue(key, default=False)[source]

Boolean values are saved to settings as the string “true” or “false,” except on a Mac, where the .plist file saves them as actual booleans. Convert a setting back to a bool, since we don’t have QVariant objects in Qt.py.

Parameters:
key : str

Settings key

default : bool

Default value if key is undefined

Returns:

True of the value is “true”; otherwise False. False if the value is undefined.

Rtype:

bool

value(key, default=None)[source]

PySide2 bug fix of default value of 0 not getting used and None getting returned.

Parameters:
key : str

Key

default

Default value, if stored value is None.

class usdmanager.TabBar(parent=None)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Customized QTabBar to enable re-ordering of tabs.

crossWindowTabMoveRequested

Used by autodoc_mock_imports.

currentWindowIndex()[source]

Get the index of the current active window.

Returns:Index of the current active window
Rtype:int
dragEnterEvent(e)[source]

Drag enter event

Parameters:
e : QtGui.QDragEnterEvent

Drag event

dropEvent(e)[source]

Drop event, used to move tabs.

Parameters:
e : QtGui.QDropEvent

Drop event

mouseMoveEvent(e)[source]

Mouse move event

Parameters:
e : QtGui.QMouseEvent

Mouse move event

mousePressEvent(e)[source]

Mouse press event

Parameters:
e : QtGui.QMouseEvent

Mouse press event

tabMoveRequested

Used by autodoc_mock_imports.

class usdmanager.TabWidget(parent=None)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Customized QTabWidget to enable re-ordering of tabs with a custom QTabBar.

moveTab(fromIndex, toIndex)[source]

Drag and drop tabs within the same window.

Parameters:
fromIndex : int

Original tab position

toIndex : int

New tab position

setTabIcon(index, icon)[source]

Override the default method to set the same icon on our custom action that focuses on or re-opens the widget at the given index.

Parameters:
index : int

Index of widget

icon : QtGui.QIcon

Icon

class usdmanager.TextBrowser(parent=None)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Customized QTextBrowser to override mouse events and add line numbers.

copySelectionToClipboard()[source]

Store current selection to the middle mouse selection.

Doing this on selectionChanged signal instead of mouseReleaseEvent causes the following to be output in Qt5: “QXcbClipboard: SelectionRequest too old”

For some reason, this isn’t needed for QTextEdit but is for QTextBrowser?

mouseReleaseEvent(event)[source]

Add support for middle mouse button clicking of links.

Parameters:
event : QtGui.QMouseEvent

Mouse release event

resizeEvent(event)[source]

Ensure line numbers resize properly when this resizes.

Parameters:
event : QtGui.QResizeEvent

Resize event

class usdmanager.TextEdit(parent=None, tabSpaces=4, useSpaces=True, autoIndent=True)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Customized text edit widget to allow entering spaces with the Tab key.

commentOutText(commentStart='#', commentEnd='')[source]

Comment out selected lines.

TODO: For languages that use a different syntax for multi-line comments, use that when multiple lines are selected?

Parameters:
commentStart : str

String used for commenting out lines.

commentEnd : str

If the comment can be applied to multiple lines, this is the string marking the end of the comment.

indentText()[source]

Indent selected lines by one tab stop.

keyPressEvent(e)[source]

Override the Tab key to insert spaces instead and the Return key to match indentation

Parameters:
e : QtGui.QKeyEvent

Key press event

resizeEvent(event)[source]

Ensure line numbers resize properly when this resizes.

Parameters:
event : QtGui.QResizeEvent

Resize event

uncommentText(commentStart='#', commentEnd='')[source]

Uncomment selected lines.

Parameters:
commentStart : str

String used for commenting out lines.

commentEnd : str

If the comment can be applied to multiple lines, this is the string marking the end of the comment.

unindentText()[source]

Un-indent selected lines by one tab stop.

zoomIn(adjust=1)[source]

Legacy Qt 4 support.

Parameters:
adjust : int

Font point size adjustment

zoomOut(adjust=1)[source]

Legacy Qt 4 support.

Parameters:
adjust : int

Font point size adjustment

class usdmanager.UsdMngrWindow(parent=None, **kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

File Browser/Text Editor for quick navigation and editing among text-based files that reference other files. Normal links are colored blue (USD Crate files are a different shade of blue). The linked file exists. Links to multiple files are colored yellow. Files may or may not exist. Links that cannot be resolved or confirmed as valid files are colored red.

Ideas (in no particular order):

  • Better usdz support (https://graphics.pixar.com/usd/docs/Usdz-File-Format-Specification.html)
    • Ability to write and repackage as usdz
  • Plug-ins based on active file type (ABC-specific commands, USD commands, etc.)
  • Different extensions to search for based on file type.
  • Add customized print options like name of file and date headers, similar to printing a web page.
  • Move setSource link parsing to a thread?
  • Move file status to a thread?
  • Dark theme syntax highlighting could use work. The bare minimum to get this working was done.
  • Going from Edit mode back to Browse mode shouldn’t reload the document if the file on disk hasn’t changed. Not sure why this is slower than just loading the browse tab in the first place…
  • More detailed history that persists between sessions.
  • Cross-platform testing:
    • Windows mostly untested.
    • Mac could use more testing and work with icons and theme.
  • Remember scroll position per file so going back in history jumps you to approximately where you were before.
  • Add Browse… buttons to select default applications.
  • Set consistent cross-platform read/write/execute permissions when saving new files

Known issues:

  • AddressBar file completer has problems occasionally.
  • Save As… doesn’t add file to recent files or history menus.
  • Find with text containing a new line character does not work due to QTextDocument storing these as separate blocks.
  • Line numbers width not always immediately updated after switching to new class.
  • Qt.py problems:
    • PyQt5
      • Non-critical messages
        • QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-mdsandell’
        • QXcbConnection: XCB error: 3 (BadWindow), sequence: 878, resource id: 26166399, major code: 40 (TranslateCoords), minor code: 0
    • PySide2
      • Preferences dialog doesn’t center on main window, can’t load via loadUiType
addItemToMenu(url, menu, slot, maxLen=None, start=0, end=None)[source]

Add a URL to a history menu.

Parameters:
url : QtCore.QUrl

The full URL to add to a history menu.

menu : QtWidgets.QMenu

Menu to add history item to.

slot

Method to connect action to

maxLen : int

Optional maximum number of history items in the menu.

start : int

Optional number of actions at the start of the menu to ignore.

end : int | None

Optional number of actions at the end of the menu to ignore.

addRecentFileToSettings(path)[source]

Add a recent file to the user settings.

Re-read the user settings from disk to get the latest (in case there are any other open instances of this app updating the list), then just prepend the one latest file.

Parameters:
path : str

File path

browserBack()[source]

Go back one step in history for the current tab.

browserForward()[source]

Go forward one step in history for the current tab.

changeTab(tab)[source]

Set the current tab to the calling tab.

Parameters:
tab : QtWidgets.QWidget

Tab widget

closeEvent(event)[source]

Override the default closeEvent called on exit.

closeOtherTabs(*args)[source]

Close all tabs except the current tab.

closeRightTabs(*args)[source]

Close all tabs to the right of the current tab.

closeTab(checked=False, index=None)[source]

Close the current tab.

Parameters:
checked : bool

For signal only

index : int | None

Try to close this specific tab instead of where the context menu originated.

Returns:

If the tab was closed or not. If the tab needed to be saved, for example, and the user cancelled, this returns False.

Rtype:

bool

commentTextRequest()[source]

Slot called by the Comment action.

compileLinkRegEx

Used by autodoc_mock_imports.

connectSignals()[source]

Connect signals to slots.

connectTabSignals(tab)[source]

Connect signals for a new tab.

Parameters:
tab : BrowserTab

Tab widget

copy()[source]

Copy selected text in the current text editor.

createHighlighter(highlighterClass)[source]

Create a language-specific master highlighter to be used for any file of that language.

Parameters:
highlighterClass : highlighter.MasterHighlighter

Master highlighter or subclass

Returns:

Highlighter instance

Rtype:

highlighter.MasterHighlighter

currentTabChanged(idx)[source]

Slot called when the current tab has changed.

Parameters:
idx : int

Index of the newly selected tab

currentlyOpenFiles()[source]

Get the currently open files from all tabs.

Returns:str file paths for each open tab
Rtype:list
customTabWidgetContextMenu(pos)[source]

Slot for the right-click context menu for the tab widget.

Parameters:
pos : QtCore.QPoint

Position of the right-click

customTextBrowserContextMenu(pos)[source]

Slot for the right-click context menu when in Browse mode.

Parameters:
pos : QtCore.QPoint

Position of the right-click

customTextEditorContextMenu(pos)[source]

Slot for the right-click context menu when in Edit mode.

Parameters:
pos : QtCore.QPoint

Position of the right-click

cut()[source]

Cut selected text in the current text editor.

decreaseFontSize()[source]

Decrease font size in the text browser and editor.

defaultFontSize()[source]

Reset the text browser and editor to the default font size.

desktopOpenUrl(checked=False, url=None)[source]

Open a URL in a web browser. This method doesn’t do anything if the URL evaluates to False.

Parameters:
checked : bool

For signal only

url : str

A URL to open. If one is not provided, it defaults to self.appURL.

diffFile()[source]

Compare current version of file in app to current version on disk. Allows you to make comparisons using a temporary file, without saving your changes.

dirtySave(tab=None)[source]

Present a save dialog for dirty tabs to know if they’re safe to close/reload or not.

Parameters:
tab : BrowserTab | None

Tab to save. Defaults to current tab.

Returns:

False if Cancel selected. True if Discard selected. True if Save selected (and actually saving).

Rtype:

bool

disconnectTabSignals(tab)[source]

Disconnect signals for a tab.

Parameters:
tab : BrowserTab

Tab widget

duplicateTab()[source]

Duplicate the tab that was right-clicked. This doesn’t duplicate edit state or any history at the moment.

editModeChanged

Used by autodoc_mock_imports.

editPreferences()[source]

Open Preferences dialog

fileInfo()[source]

Display information about the current file.

find(flags=None, startPos=3, loop=True)[source]

Find next hit for the search text.

Parameters:
flags

Options for document().find().

startPos : int

Position from which the search should begin. 0=Start of document 1=End of document 2=Start of selection 3=End of selection (default)

loop : bool

True lets us loop through the beginning or end of a document if the phrase was not found from the current position. False limits that behavior so that we don’t endlessly loop.

find2(startPos=3, loop=True, findText=None, tab=None)[source]

Find functionality for find/replace dialog.

Parameters:
startPos : int

Position from which the search should begin. 0=Start of document 1=End of document 2=Start of selection 3=End of selection (default)

loop : bool

True lets us loop through the beginning or end of a document if the phrase was not found from the current position. False limits that behavior so that we don’t endlessly loop.

findText : str

Text to find.

tab : BrowserTab | None

Tab. Defaults to current tab if None.

findAndReplace(findText, replaceText, tab, startPos=0)[source]

Replace a single occurrence of a phrase.

Parameters:
findText : str

Text to find

replaceText : str

Text to replace with

startPos : int

Position from which the search should begin. 0=Start of document (default) 1=End of document 2=Start of selection 3=End of selection

Returns:

Whether or not a match was found.

Rtype:

bool

findHighlightAll(checked=True)[source]

Highlight all hits for the search text.

Parameters:
checked : bool

If True, highlight all occurrences of the current find phrase.

findPrev()[source]

Find previous hit for the search text.

findRehighlightAll()[source]

Rehighlight all occurrences of the find phrase when the active document changes.

getCommentStrings()[source]

Get the language-specific string(s) for a comment.

Returns:Tuple of start str and end str defining a comment.
Rtype:tuple
getFindText()[source]

Get the text to find.

Returns:The search text from the Find/Replace dialog.
Rtype:str
static getPermissionString(path)[source]

Get permissions string for a file’s mode. Qt.py compatibility fix since QFileInfo.permissions isn’t in PySide2.

Parameters:
path : str

File path

Returns:

String corresponding to read (r), write (w), and execute (x) permissions for file.

getRecentFilesFromSettings()[source]

Get recent files from user settings.

Returns:Recent files as str paths
Rtype:list
getReplaceText()[source]

Get the text to replace the search text with.

Returns:The replace text from the Find/Replace dialog.
Rtype:str
getSaveAsPath(path=None, tab=None)[source]

Get a path from the user to save an arbitrary file as.

Parameters:
path : str | None

Path to use for selecting default file extension filter.

tab : BrowserTab | None

Tab that path is for.

Returns:

Tuple of the absolute path user wants to save file as (or None if no file was selected or an error occurred) and the file format if explicitly set for USD files (e.g. usda)

Rtype:

(str`|None, `int)

getUsdCrateCachePath(fileStr)[source]

Cache a converted Crate file so we can use it again later without reconversion if it’s still newer.

Parameters:
fileStr : str

USD file path

Returns:

Cache file path

Rtype:

str

goPressed(*args)[source]

Handle loading the current path in the address bar.

goToLineNumber(line=1)[source]

Go to the given line number

Parameters:
line : int

Line number to scroll to. Defaults to 1 (top of document).

goToLineNumberDlg()[source]

Get a line number from the user and scroll to it.

hoverUrl(link)[source]

Slot called when the mouse hovers over a URL.

increaseFontSize()[source]

Increase font size in the text browser and editor.

indentText()[source]

Indent selected lines by one tab stop.

isDarkTheme()[source]

Check if any dark theme is active based on launch preference and the background lightness.

Returns:True if launched with the dark theme preference or the lightness factor of the window background is less than 0.5. The 0.5 threshold to determine if it’s dark is completely arbitrary.
Rtype:bool
launchProcess(args, **kwargs)[source]

Launch a program with the path str as an argument.

Any additional keyword arguments are passed to the Popen object.

Parameters:
args : list | str

A sequence of program arguments with the program as the first arg. If also passing in shell=True, this should be a single string.

Returns:

Returns process ID or None

Rtype:

subprocess.Popen | None

launchProgramOfChoice(path=None)[source]

Open a file with a program given by the user.

Parameters:
path : str

File to open. If None, use currently open file.

launchTextEditor()[source]

Launch the current file in a separate text editing application.

launchUsdView()[source]

Launch the current file in usdview.

moveTab(fromIndex, toIndex)[source]

Rearrange tabs in menu after a drag/drop event. This isn’t moving the tab itself. That’s handled in the TabWidget class.

Parameters:
fromIndex : int

Original tab position

toIndex : int

New tab position

moveTabAcrossWindows(fromIndex, toIndex, fromWindow, toWindow)[source]

Rearrange tabs in menu after a drag/drop event. This isn’t moving the tab itself. That’s handled in the TabWidget class.

Parameters:
fromIndex : int

Original tab position

toIndex : int

New tab position

newTab(*args)[source]

Create a new tab.

Returns:New tab
Rtype:BrowserTab
newWindow()[source]

Create a new window.

Returns:New main window widget
Rtype:QtWidgets.QWidget
onBackspace()[source]

Handle the Backspace key for back browser navigation.

onBreadcrumbActivated(path)[source]

Slot called when a breadcrumb link (history for the current tab) is selected.

Parameters:
path : str

Breadcrumb path

onBreadcrumbHovered(path)[source]

Slot called when the mouse is hovering over a breadcrumb link.

onFileChange(path)[source]

Track files that have been modified on disk.

Parameters:
path : str

Modified file path

onOpen(path)[source]

Open the path in a new tab.

Parameters:
path : str

File to open

onOpenLinkNewTab()[source]

Open the currently highlighted link in a new tab.

onOpenLinkNewWindow()[source]

Open the currently highlighted link in a new window.

onOpenLinkWith()[source]

Show the “Open With…” dialog for the currently highlighted link.

onOpenOldUrl(url)[source]

Open a path from history in the current tab.

Parameters:
url : QtCore.QUrl

URL to open

openFileDialog(path=None, tab=None)[source]

Show the Open File dialog and open any selected files.

Parameters:
path : str | None

File path to pre-select on open

tab : BrowserTab | None

Tab to open files for. Defaults to current tab.

openFileDialogToCurrentPath()[source]

Show the Open File dialog and open any selected files, pre-selecting the current file (if any).

openRecent(url)[source]

Open an item from the Open Recent menu in a new tab.

Parameters:
url : QtCore.QUrl

File URL

overrideCursor(**kwds)[source]

For use with the “with” keyword, so the override cursor is always restored via a try/finally block, even if the commands in-between fail.

Example:
with overrideCursor():
# do something that may raise an error
paste()[source]

Paste selected text in the current text editor.

printDialog(checked=False)[source]

Open a print dialog.

Parameters:
checked : bool

For signal only

printPreview(checked=False)[source]

Open a print preview dialog.

Parameters:
checked : bool

For signal only

promptOnFileChange(path)[source]

Prompt if the file should be reloaded when it has changed on the file system.

Parameters:
path : str

Modified file path

Returns:

True if the user reloaded the file; otherwise, False

Rtype:

bool

readSettings()[source]

Read in user config settings.

readUsdCrateFile(fileStr)[source]

Read in a USD crate file via usdcat converting a temp file to ASCII.

Parameters:
fileStr : str

USD file path

Returns:

ASCII file text

Rtype:

bool

readUsdzFile(fileStr, layer=None)[source]

Read in a USD zip (.usdz) file via usdzip, uncompressing to a temp directory.

Parameters:
fileStr : str

USD file path

layer : str | None

Default layer within file (e.g. the portion within the square brackets here: @foo.usdz[path/to/file/within/package.usd]@)

Returns:

Destination file

Rtype:

str

Raises zipfile.BadZipfile:
 

For bad ZIP files

Raises zipfile.LargeZipFile:
 

When a ZIP file would require ZIP64 functionality but that has not been enabled

Raises ValueError:
 

If default layer not found

redo()[source]

Redo last change in the current text editor.

refreshSelectedTab()[source]

Refresh the tab that was right-clicked.

refreshTab(tab=None)[source]

Reload the file for a tab.

Parameters:
tab : BrowserTab | None

Tab to refresh. Defaults to current tab if None.

Returns:

If the tab was reloaded successfully.

Rtype:

bool

removeTab(index)[source]

Stores as recently closed tab, then closes it.

Parameters:
index : int

Index of tab to remove.

replace(findText=None, replaceText=None, tab=None)[source]

Replace next hit for the search text.

Parameters:
findText : str | None

Text to find. Defaults to getting text from Find/Replace dialog.

replaceText : str | None

Text to replace it with. Defaults to getting text from Find/Replace dialog.

tab : BrowserTab | None

Tab to replace text in. Defaults to current tab if None.

replaceAll(findText=None, replaceText=None, tab=None, report=True)[source]

Replace all occurrences of the search text.

Parameters:
findText : str | None

Text to find. If None, get the value from the Find/Replace dialog.

replaceText : str | None

Text to replace. If None, get the value from the Find/Replace dialog.

tab : TabWidget | None

Tab to replace text in. Defaults to current tab.

report : bool

If True, report replace statistics; otherwise, just return the number of replacements.

Returns:

Number of replacements

Rtype:

int

replaceAllInOpenFiles()[source]

Iterate through all the writable tabs, finding and replacing the search text.

replaceFind()[source]

Replace next hit for the search text, then find the next after that.

restoreOverrideCursor()[source]

If an override cursor is currently set, restore the previous cursor.

restoreTab(tab)[source]

Restore a previously closed tab.

Parameters:
tab : QtWidgets.QWidget

Tab widget

saveFile(filePath, fileFormat=4, tab=None, _checkUsd=True)[source]

Save the current file as the given filePath.

Parameters:
filePath : str

Path to save file as.

fileFormat : int

File format when saving as a generic extension

tab : BrowserTab | None

Tab to save. Defaults to current tab.

_checkUsd : bool

Check if this needs to be written as a binary USD file instead of a text file

Returns:

If saved or not.

Rtype:

bool

saveFileAs(tab=None)[source]

Save the current file with a new filename.

Parameters:
tab : BrowserTab | None

Tab to save. Defaults to current tab.

Returns:

If saved or not.

Rtype:

bool

saveLinkAs()[source]

The user right-clicked a link and wants to save it as a new file. Get a new file path with the Save As dialog and copy the original file to the new file, opening the new file in a new tab.

saveTab(tab=None)[source]

If the file already has a name, save it; otherwise, get a filename and save it.

Parameters:
tab : BrowserTab | None

Tab to save. Defaults to current tab.

Returns:

If saved or not.

Rtype:

bool

selectAll()[source]

Select all text in the current focused widget.

setHighlighter(ext=None, tab=None)[source]

Set the current tab’s highlighter based on the current file extension.

Parameters:
ext : str | None

File extension (language) to highlight.

tab : BrowserTab | None

Tab to set highlighter on. Defaults to current tab.

setIncludePanelActionState(pos=0, index=0)[source]

Set the check state of the include panel action. If it is visible, the action will be checked.

Parameters:
pos : int

Position from left edge of widget. For catching signal only.

index : int

Splitter handle index. For catching signal only.

setLoadingProgress(value)[source]

Called by parser to update loading progress bar’s value.

Parameters:
value : int

Line number being parsed

setNavigationMenus()[source]

Set the navigation buttons to use the current tab’s history menus.

setOverrideCursor(cursor=<sphinx.ext.autodoc.importer._MockObject object>)[source]

Set the override cursor if it is not already set.

Parameters:
cursor

Qt cursor

setSource(link, isNewFile=True, newTab=False, hScrollPos=0, vScrollPos=0, tab=None)[source]

Create a new tab or update the current one. Process a file to add links. Send the formatted text to the appropriate tab.

Parameters:
link : QtCore.QUrl

File to open. If link contains a fragment (e.g. #text), no new file will be loaded. The current file (if any) will remain and the portion after the # will be treated as a query string. Useful for jumping to line numbers without reloading the current file.

isNewFile : bool

Optional bool for if this is a new file or an item from history.

newTab : bool

Optional bool to open in a new tab no matter what.

hScrollPos : int

Horizontal scroll bar position.

vScrollPos : int

Vertical scroll bar position.

tab : BrowserTab | None

Existing tab to load in. Defaults to current tab. Ignored if newTab=True.

Returns:

True if the file was loaded successfully (or was dirty but the user cancelled the save prompt).

Rtype:

bool

setSourceFinish(success=True, warning=None, details=None, tab=None)[source]

Finish updating UI after loading a new source.

Parameters:
success : bool

If the file was loaded successfully or not

warning : str | None

Optional warning message

details : str | None

Optional details for the warning message

tab : `BrowserTab | None

Tab that finished. Defaults to current tab.

Returns:

Success

Rtype:

bool

setSources(files, tab=None)[source]

Open multiple files in new tabs.

Parameters:
files : list

List of string-based paths to open

tab : BrowserTab | None

Tab this may be opening from. Useful for path expansion.

setupUi()[source]

Create and lay out the widgets defined in the ui file, then add additional modifications to the UI.

showAboutDialog(*args)[source]

Display a modal dialog box that shows the “about” information for the application.

showAboutQtDialog(*args)[source]

Show Qt about dialog.

showCriticalMessage(message, details=None, title=None)[source]

Show an error message with optional details text (useful for tracebacks).

Parameters:
message : str

Main message

details : str | None

Optional details

title : str

Dialog title (defaults to app name)

Returns:

Selected StandardButton value

Rtype:

int

showFindReplaceDlg()[source]

Show the Find/Replace dialog.

showSuccessMessage(msg, title=None)[source]

Display a generic message if the user’s preferences are not set to only show warnings/errors.

Parameters:
msg : str

Message to display.

title : str | None

Optional title.

showWarningMessage(message, details=None, title=None, icon=<sphinx.ext.autodoc.importer._MockObject object>)[source]

Show a warning message with optional details text (useful for tracebacks).

Parameters:
message : str

Main message

details : str | None

Optional details

title : str

Dialog title (defaults to app name)

icon : int

QMessageBox.Icon

Returns:

Selected StandardButton value

Rtype:

int

tabIterator()[source]

Iterator through the tab widgets.

toggleEdit(tab=None)[source]

Switch between Browse mode and Edit mode.

Returns:True if we switched modes; otherwise, False. This only returns False if we were in Edit mode and the user cancelled due to unsaved changes.
Rtype:bool
toggleFind()[source]

Show/Hide the Find bar.

toggleFindClose()[source]

Hide the Find bar.

toggleFullScreen(*args)[source]

Toggle between full screen mode

toggleInclude(checked)[source]

Show/Hide the side file browser.

Parameters:
checked : bool

State of checked menu.

uncommentTextRequest()[source]

Slot called by the Uncomment action.

undo()[source]

Undo last change in the current text editor.

unindentText()[source]

Un-indent selected lines by one tab stop.

updateButtons()[source]

Update button states, text fields, and other GUI elements.

updateEditButtons()[source]

Toggle edit action and button text.

updatePreference(key, value)[source]

Update a user preference, setting the preferences dict and updating the config file.

Parameters:
key : str

Preference key

value

Serializable preference value

updatePreference_findMatchCase(checked)[source]

Stores a bool representation of checkbox’s state.

Parameters:
checked : bool

State of checkbox.

updatingButtons

Used by autodoc_mock_imports.

validateAddressBar(address)[source]

Validate the text in the address bar. Currently, this just ensures the address is not an empty string.

Parameters:
address : str

Current text in the address bar.

validateFileSize(info)[source]

If a file’s size is above a certain threshold, confirm the user still wants to open the file.

Parameters:
info : QtCore.QFileInfo

File info object

Returns:

If we should open the file or not

Rtype:

bool

validateFindBar(text)[source]

Update widgets on the Find bar as the search text changes.

Parameters:
text : str

Current text in the find bar.

viewSource(checked=False)[source]

For debugging, view the source HTML of the text browser widget.

Parameters:
checked : bool

Just for signal

writeRecentFilesToSettings(paths)[source]

Write recent files list to user settings.

Parameters:
paths : list

List of str file paths

writeSettings()[source]

Write out user config settings to disk.

This should only write settings modified via the Preferences dialog, as other preferences like “recentFiles” will be written immediately as they’re modified. Some settings like window state are only saved on exit.

usdmanager.run()[source]

Main entry point to start the application.