usdmanager package

Module contents

Application module for usdmanager.

Class hierarchy:

  • App
    • UsdMngrWindow (multiple windows allowed)
      • AddressBar
      • TabWidget
        • TabBar
        • BrowserTab (one tab per file)
          • LineNumbers
          • TextBrowser
          • TextEdit
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(model, parent=None)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Custom completer for AddressBar.

pathFromIndex(index)[source]
splitPath(path)[source]
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:QtGui.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.

findPath(path)[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:
path : str

Path 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 | QtGui.QTextEdit
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: /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.

gotoBreadcrumb(path, index=None)[source]

Go to the historical index of the given path.

This does not handle updating the displayed document.

Parameters:
path : str

Breadcrumb path

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]
openFile

Used by autodoc_mock_imports.

openOldUrl

Used by autodoc_mock_imports.

restoreTab

Used by autodoc_mock_imports.

setTabSpaces(useSpaces=True, tabSpaces=4)[source]

Set the width of a tab character in spaces, both for display and editing.

Parameters:
useSpaces : bool

Use spaces instead of a tab character

spaces : int

Tab size in spaces

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.PathCacheDict[source]

Bases: collections.defaultdict

Cache if file paths referenced more than once in a file exist, so we don’t check on disk over and over.

class usdmanager.RecentFile(path, 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.

openFile

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”. Convert a setting back to a bool, since we don’t have QVariant objects in Qt.py.

Parameters:
key : str

Settings key

Returns:

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

Rtype:

bool

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

nextTab()[source]

Switch to the next tab. If on the last tab, go back to the first.

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.

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

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

Bases: sphinx.ext.autodoc.importer._MockObject

Customized QTextEdit 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.

Parameters:
e : QtGui.QKeyEvent

Key press 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.

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
  • Add a preference for which files to enable teletype for (currently hard-coded to .log and .txt files).
  • Plug-ins based on active file type (ABC-specific commands, USD commands, etc.)
  • Link matching RegEx based on active file type instead of all using the same rules. Different extensions to search for based on file type, too.
  • 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?
  • From Pixar: There’s one feature in a tool our sim dept wrote that might be useful to incorporate into your browser, which can help immensely for big files, and it’s to basically allow filtering of what gets displayed for the usd file’s contents. Not just like pattern matching so only certain prims/properties get shown (though that is also useful), but things like “don’t show timeSamples” or “only show first and last values for each array with an ellipsis in the middle”.
  • 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.

Known issues:

  • AddressBar file completer has problems occasionally.
  • Figure out why network printers aren’t showing up. Linux or DWA issue? macOS and Windows are fine.
  • 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(path, menu, slot, maxLen=None, start=0, end=None)[source]

Add a path to a history menu.

Parameters:
path : str

The full path to add to the history menu.

menu : QtGui.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

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()[source]

Compile regular expression to find links based on the acceptable extensions stored in self.programs.

NOTE: If this RegEx is changed, the syntax highlighting rule needs to be as well.

TODO: Support different search rules for different file extensions. Since we use the RegEx match groups in
setSource, each file type might be responsible for building its own HTML representation at that point.
connectSignals()[source]

Connect signals to slots.

connectTabSignals(tab)[source]

Connect signals for a new tab.

Parameters:
tab : TabWidget

Tab widget

static convertTeletype(t)[source]

Convert teletype codes to HTML styles. This method assumes you have already escaped any necessary HTML characters.

Parameters:
t : str

Original text

Returns:

String with teletype codes converted to HTML styles.

Rtype:

str

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

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.

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()[source]

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

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 : TabWidget

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)[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.

findAndReplace(findText, replaceText, 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()[source]

Highlight all hits for the search text.

findPrev()[source]

Find previous hit for the search text.

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)[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.

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)

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.

newWindow()[source]

Create a new window.

Returns:New main window widget
Rtype:QtGui.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.

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)[source]

Show the Open File dialog and open any selected files.

Parameters:
path : str | None

File path to pre-select on open

openFileDialogToCurrentPath()[source]

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

openRecent(path)[source]

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

Parameters:
path : str

File path

openUrl(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.

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

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()[source]

Refresh the current tab.

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)[source]

Replace next hit for the search text.

replaceAll()[source]

Replace all occurrences of the search text.

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, _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

_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()[source]

Save the current file with a new filename.

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()[source]

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

Returns:If saved or not.
Rtype:bool
selectAll()[source]

Select all text in the current focused widget.

setDirtyTab(dirty=True)[source]

Set the dirty state of the current tab.

Parameters:
dirty : bool

If the current tab is dirty.

setHighlighter(ext=None)[source]

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

Parameters:
ext : str | None

File extension (language) to highlight.

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.

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)[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.

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.

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)[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

Returns:

Success

Rtype:

bool

setSources(files)[source]

Open multiple files in new tabs.

Parameters:
files : list

List of string-based paths to open

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

stopTab()[source]

Stop loading the current tab.

tabIterator()[source]

Iterator through the tab widgets.

toggleEdit()[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 : int

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(path)[source]

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

Parameters:
path : str

File path

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]