usdmanager package¶
Submodules¶
- usdmanager.constants module
- usdmanager.file_dialog module
- usdmanager.file_status module
- usdmanager.find_dialog module
- usdmanager.highlighter module
- usdmanager.images_rc module
- usdmanager.include_panel module
- usdmanager.linenumbers module
- usdmanager.parser module
- usdmanager.preferences_dialog module
- usdmanager.utils module
- usdmanager.version module
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.
-
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'¶
-
config
= None¶
-
createWindowFrame
()[source]¶ Create a a new widget based on self.uiSource.
Returns: A dynamically-created widget object. Rtype: CustomWidget
-
fileCache
= {}¶
-
newWindow
()[source]¶ Create a new main window.
Returns: New main window widget Rtype: QtWidgets.QWidget
-
tmpDir
= None¶
-
uiSource
¶ alias of
UsdMngrWindow
-
-
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.
-
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
-
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.
-
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.
-
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
-
-
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
-
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.
-
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?
-
mousePressEvent
(event)[source]¶ Store the starting mouse position so that on mouse release we can determine if it was an intentional mouse move to highlight text or a click that may have drifted a pixel or two.
Parameters: - event : QtGui.QMouseEvent
Mouse press 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.
-
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
-
-
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
- 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.
- 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.
- If a file loses edit permissions, it can stay in edit mode and let you make changes that can’t be saved.
- Qt bug: QPushButton dark theme hover/press color not respected.
-
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
-
changeTab
(tab)[source]¶ Set the current tab to the calling tab.
Parameters: - tab : QtWidgets.QWidget
Tab widget
-
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
-
compileLinkRegEx
¶ Used by autodoc_mock_imports.
-
connectTabSignals
(tab)[source]¶ Connect signals for a new tab.
Parameters: - tab : BrowserTab
Tab widget
-
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
-
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.
-
find
(checked=False, flags=None, startPos=3, loop=True)[source]¶ Find next hit for the search text.
Parameters: - checked : bool
For signal only
- 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.
-
findRehighlightAll
()[source]¶ Rehighlight all occurrences of the find phrase when the active document changes.
-
getCachePath
(fileStr, fileParser)[source]¶ Cache a converted binary file so we can use it again later without reconversion if it’s still newer.
Parameters: - fileStr : str
Binary file path
- fileParser : AbstractExtParser
File parser
Returns: Cache file path
Rtype: str
-
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, fileFilter=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.
- fileFilter : str | None
File name filter to pre-select
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)
-
goToLineNumber
(line=1)[source]¶ Go to the given line number
Parameters: - line : int
Line number to scroll to. Defaults to 1 (top of document).
-
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
-
launchPathCommand
(command, path, **kwargs)[source]¶ Launch a command with a file path either being appended to the end or substituting curly brackets if present.
Any additional keyword arguments are passed to the Popen object.
- Example:
launchPathCommand(“rez-env usd_view -c ‘usdview {}’”, “scene.usd”) runs: rez-env usd_view -c ‘usdview scene.usd’
launchPathCommand(“nedit”, “scene.usd”) runs: nedit scene.usd
launchPathCommand(“ls”, [“foo”, “bar”]) runs: ls foo bar
Parameters: - command : str | [str]
Command to run. If the path to open with the command cannot simply be appended with a space at the end of the command, use {} like standard python string formatting to denote where the path should go.
- path : str | [str]
File path str, space-separated list of files paths as a single str, or list of str file paths
Returns: Returns process ID, or None if the subprocess fails
Rtype: subprocess.Popen | None
-
launchProcess
(args, **kwargs)[source]¶ Launch a subprocess. 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.
Returns: Returns process ID, or None if the subprocess fails
Rtype: subprocess.Popen | None
-
launchProgramOfChoice
(checked=False, path=None)[source]¶ Open a file with a program given by the user.
Parameters: - checked : bool
For signal only
- path : str
File to open. If None, use currently open file.
-
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
(checked=False, focus=True)[source]¶ Create a new tab.
Parameters: - checked : bool
For signal only
- focus : bool
If True, change focus to this tab
Returns: New tab
Rtype: BrowserTab
-
onBreadcrumbActivated
(path)[source]¶ Slot called when a breadcrumb link (history for the current tab) is selected.
Parameters: - path : str
Breadcrumb path
-
onFileChange
(path)[source]¶ Track files that have been modified on disk.
Parameters: - path : str
Modified file path
-
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
-
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
-
readBinaryFile
(fileStr, fileParser)[source]¶ Read in a binary file, converting to a temp ASCII file.
Used by file parsers.
Parameters: - fileStr : str
Binary file path
- fileParser : AbstractExtParser
File parser
Returns: ASCII file text
Rtype: str
-
refreshTab
(checked=False, tab=None)[source]¶ Reload the file for a tab.
Parameters: - checked : bool
For signal only
- 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.
-
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=5, tab=None)[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.
Returns: If saved or not.
Rtype: bool
-
saveFileAs
(checked=False, tab=None)[source]¶ Save the current file with a new filename.
Parameters: - checked : bool
For signal only
- 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
(checked=False, tab=None)[source]¶ If the file already has a name, save it; otherwise, get a filename and save it.
Parameters: - checked : bool
For signal only
- tab : BrowserTab | None
Tab to save. Defaults to current tab.
Returns: If saved or not.
Rtype: bool
-
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
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, focus=True)[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.
- focus : bool
If True, change focus to this tab. Currently only applies when creating new tabs.
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, focus=True)[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.
- focus : bool
Change focus to the new tabs as they are created.
-
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.
-
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
-
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
-
toggleEdit
(checked=False, tab=None)[source]¶ Switch between Browse mode and Edit mode.
Parameters: - checked : bool
Unused. For signal/slot only
- tab : BrowserTab
Tab to toggle edit mode on
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
-
toggleInclude
(checked)[source]¶ Show/Hide the side file browser.
Parameters: - checked : bool
State of checked menu.
-
updateParserPlugins
()[source]¶ Update parser-specific UI actions when the file parser has changed due to the display of a different file type.
-
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.
-
updateRecentMenus
(link, fullUrlStr)[source]¶ Update the history and recently open files menus.
Parameters: - link : QtCore.QUrl
URL to file
- fullUrlStr : str
URL string representation
-
updateTabParser
(tab, fileInfo, link, fileFormat=None)[source]¶ Update the file parser a tab is using based on the given file.
Parameters: - tab : BrowserTab
Tab
- fileInfo : QtCore.QFileInfo
File info object
- link : QtCore.QUrl
Link to file, potentially with query parameters
- fileFormat : int | None
The parser must match this file format, if not None.
-
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
- Better usdz support (https://graphics.pixar.com/usd/docs/Usdz-File-Format-Specification.html)