gui: Main ChimeraX graphical user interface

The principal class that tool writers will use from this module is MainToolWindow, which is either instantiated directly, or subclassed and instantiated to create the tool’s main window. Additional windows are created by calling that instance’s MainToolWindow.create_child_window() method.

Rarely, methods are used from the UI class to get keystrokes typed to the main graphics window, or to execute code in a thread-safe manner. The UI instance is accessed as session.ui.

class ChildToolWindow(tool_instance, title, **kw)

Bases: ToolWindow

Supported API. Child (i.e. additional) tool window

Only created through use of MainToolWindow.create_child_window() method.

class DefineSelectorDialog(session, *args, **kw)

Bases: QDialog

class InitWindowSizeOption(*args, session=None, **kw)

Bases: Option

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class LabelHeightDialog(session, *args, **kw)

Bases: QDialog

class MainToolWindow(tool_instance, **kw)

Bases: ToolWindow

Supported API. Class used to generate tool’s main UI window.

The window’s ui_area attribute is the parent to all the tool’s widgets for this window. Call manage() once the widgets are set up to show the tool window in the main interface.

Parameters

tool_instance – a ToolInstance instance The tool creating this window.

create_child_window(title, *, window_class=None, **kw)

Supported API . Make additional tool window

Parameters
  • title (str) – Text shown in the window’s title bar.

  • window_class (Optional[ChildToolWindow]) – Class to instantiate to create the child window. Only needed if you want to override methods/attributes in order to change behavior.

  • kw – Keywords to pass on to the tool window’s constructor

class MainWindow(ui, session)

Bases: QMainWindow, PlainTextLog

add_menu_entry(menu_names, entry_name, callback, *, tool_tip=None, insertion_point=None, shortcut=None)

Supported API . Add a main menu entry. Adding entries to the Select menu should normally be done via the add_select_submenu method instead. For details, see the doc string for that method.

Menus that are needed but that don’t already exist (including top-level ones) will be created. The menu names (and entry name) can contain appropriate keyboard navigation markup. Callback function takes no arguments. This method cannot be used to add entries to menus that are updated dynamically, such as Tools.

If ‘insertion_point is specified, then the entry will be inserted before it. ‘insertion_point’ can be a QAction, a string (menu item text with navigation markup removed) an integer indicating a particular separator (top to bottom, numbering starting at 1), or False indicating that the entry should be placed at the top of the menu.

add_menu_selector(menu, label, selector_text=None, *, insertion_point=None)

Supported API . Add an item to the given menu (which was probably obtained with the add_select_submenu method) which will make a selection using the given selector text (which should just be the text of the selector, not a full command) while honoring the current selection mode set in the Select menu. If ‘selector_text’ is not given, it defaults to be the same as ‘label’. The label can have keyboard navigation markup. If ‘insertion_point’ is specified, then the item will be inserted before it. ‘insertion_point’ can be a QAction, a string (menu item text with navigation markup removed) or an integer indicating a particular separator (top to bottom, numbering starting at 1).

add_select_submenu(parent_menu_names, submenu_name, *, append=True)

Supported API . Add a submenu (or get it if it already exists). Any parent menus will be created as needed. Menu names can contain keyboard navigation markup (the ‘&’ character). ‘parent_menu_names’ should not contain the Select menu itself. If ‘append’ is True then the menu will be appended at the end of any existing items, otherwise it will be alphabetized into them.

The caller is responsible for filling out the menu with entries, separators, etc. Any further submenus should again use this call. Entry or menu callbacks that actually make selections should use the select_by_mode(selector_text) method to make the selection, which will run the command appropriate to the current selection mode of the Select menu.

The convenience method add_menu_selector, which takes a menu, a label, and an optional selector text (defaulting to the label) can be used to easily add items to the menu.

add_settings_option(category, option)

Experimental API . For bundles that need/want to present their settings with the core ChimeraX settings rather than present their own settings UI

changeEvent(self, QEvent)

Experimental API .

enable_stereo(stereo=True)

Experimental API . Switching to a sequential stereo OpenGL context seems to require replacing the graphics window with a stereo compatible window on Windows 10 with Qt 5.9.

log(*args, **kw)

Supported API . Log a message.

Parameters
  • level (LOG_XXX constant from Log base class) – How important the message is (e.g., error, warning, info)

  • msg (text) – Message to log

Returns

Return type

True if the routine displayed/handled the log message, False otherwise.

select_by_mode(selector_text)

Supported API . Select based on the selector ‘selector_text’ but honoring the current selection mode chosen in the Select menu. Typically used by callbacks off the Selection menu

status(msg, color, secondary)

Supported API . Show a status message.

Parameters
  • msg (plain (non-HTML) text) – The message to display

  • color (text or (r,g,b) tuple, r/g/b in range 0-1) – Color to display text in. If log cannot understand color text string, use black instead.

  • secondary (boolean) – Whether to show the status in the secondary status area. If the log doesn’t support a secondary status area it should either drop the status or combine it with the last known primary status message.

Returns

  • True if the routine displayed/handled the status, False otherwise.

  • This method is not abstract because a log is free to totally

  • ignore/drop status messages.

  • Note that this method may be called from a thread (due to the

  • use of timers to get proper time delays) and that therefore

  • special window toolkit handling may be necessary to get your

  • code executed in the main thread (*e.g., session.ui.thread_safe()).*

class SelSeqDialog(session, *args, **kw)

Bases: QDialog

class SelZoneDialog(session, *args, **kw)

Bases: QDialog

class ToolSideOption(*args, values=None, **kw)

Bases: EnumOption

class ToolWindow(tool_instance, title, *, close_destroys=True, hide_title_bar=False, statusbar=False)

Bases: StatusLogger

Supported API. An area that a tool can populate with widgets.

This class is not used directly. Instead, a tool makes its main window by instantiating the MainToolWindow class (or a subclass thereof), and any subwindows by calling that class’s create_child_window() method.

The window’s ui_area attribute is the parent to all the tool’s widgets for this window. Call manage() once the widgets are set up to show the tool window in the main interface.

The close_destroys keyword controls whether closing this window destroys it or hides it. If it destroys it and this is the main window, all the child windows will also be destroyed.

The statusbar keyword controls whether the tool will display status messages via an in-window statusbar, or via the main ChimeraX statusbar. In either case, the status() method can be used to issue status messages. It accepts the exact same arguments/keywords as the status() method in the Logger class. The resulting QStatusBar widget (or None if statusbar was False) will be available from the ToolWindow’s “statusbar” in case you need to add widgets to it or otherwise customize it.

cleanup()

Supported API . Perform tool-specific cleanup

Override this method to perform additional actions needed when the window is destroyed

destroy()

Supported API . Called to destroy the window (from non-UI code)

Destroying a tool’s main window will also destroy all its child windows.

fill_context_menu(menu, x, y)

Supported API . Add items to this tool window’s context menu, whose downclick occurred at position (x,y)

Override to add items to any context menu popped up over this window.

Note that you need to specify the ‘parent’ argument of the QAction constructor (as ‘menu’) to avoid having the action automatically destroyed and removed from the menu when this method returns.

manage(placement, fixed_size=False, allowed_areas=15, initially_hidden=False)

Supported API . Show this tool window in the interface

Tool will be docked into main window on the side indicated by placement (which should be a value from placements or ‘side’ or None, or another tool window). If placement is “side”, then the user-preferred side will be used. If placement is None, the tool will be detached from the main window. If placement is another tool window, then those tools will be tabbed together.

If fixed_size is True then the vertical size of the panel will equal the requested size, otherwise the panel could be vertically larger or smaller than its layout requires.

The tool window will be allowed to dock in the allowed_areas, the value of which is a bitmask formed from Qt’s Qt.DockWidgetAreas flags.

The tool will be displayed unless ‘initially_hidden’ is True. This flag is needed because setting tool.shown to False after manage() will otherwise briefly show the tool.

placements = ['side', 'right', 'left', 'top', 'bottom']

Experimental API . Where the window can be placed in the main interface; ‘side’ is either left or right, depending on user preference

property shown

Whether this window is hidden or shown

shown_changed(shown)

Supported API . Perform actions when window hidden/shown

Override to perform any actions you want done when the window is hidden (shown = False) or shown (shown = True)

shrink_to_fit()

Supported API . Resize the window to take up the minimum size needed by its contents. Typically used after hiding widgets.

status(*args, **kw)

Supported API . Show a status message for the tool.

property title

Supported API. Get/change window title.

class UI(session)

Bases: QApplication

Main ChimeraX user interface

The only methods that tools might directly use are:

register(/deregister)_for_keystrokes

For the rare tool that might want to get keystrokes that are typed when focus is in the main graphics window

thread_safe

To execute a function in a thread-safe manner

deregister_for_keystrokes(sink, notfound_okay=False)

Experimental API . ‘undo’ of register_for_keystrokes(). Use the same argument.

forward_keystroke(event)

Experimental API . forward keystroke from graphics window to most recent caller of ‘register_for_keystrokes’

up/down arrow keystrokes are not forwarded and instead promote/demote the graphics window selection

register_for_keystrokes(sink)

Experimental API . ‘sink’ is interested in receiving keystrokes from the main graphics window. That object’s ‘forwarded_keystroke’ method will be called with the keystroke event as the argument.

thread_safe(func, *args, **kw)

Supported API . Call function ‘func’ in a thread-safe manner

window_image()

Experimental API . Tests on macOS 10.14.5 show that QWidget.grab() gives a correct QPixmap even for undisplayed or iconified windows, except not for html widgets (e.g. Log, or file history) which come out blank. Hidden windows also may render an image at the wrong size with a new layout (e.g. Model Panel).

initialize_pyqt5_compatibility()

Experimental API . Attempt to allow PyQt5 code to run using Qt. This can work for simple uses of Qt but for more complex tools there is often some small differences between PyQt5 and Qt that cause errors. I think this compatibility code should not be used but I am leaving it in if we decide to temporarily use it during transition to Qt.

class HtmlToolInstance(session, tool_name, size_hint=None, show_http_in_help=True, log_errors=False)

Bases: ToolInstance

Base class for creating a ChimeraX tool using HTML as its main user interface. HtmlToolInstance takes care of creating the ChimeraX tool instance, main window, and HTML widget. Derived classes can also define methods that are called when hyperlinks in the HTML widget are clicked, or when ChimeraX models are added or removed.

The tool_window instance attribute refers to the MainToolWindow instance for the tool.

The html_view instance attribute refers to the HtmlView instance for managing HTML content and link actions.

To facilitate customizing the HTML view, if the derived class has an attribute CUSTOM_SCHEME and a method handle_scheme(), then the HtmlView instance will be configured to support the custom scheme.

If the HtmlToolInstance has a method update_models(), then it will be called as a handler to model addition and removal events. update_models() should take three arguments: self, trigger_name and trigger_data. trigger_name is a string and trigger_data is a list of models added or removed.

Parameters
  • session (a Session instance) – The session in which the tool is created.

  • tool_name (a string) – The name of the tool being created.

  • size_hint (a 2-tuple of integers, or ''None'') – The suggested initial widget size in pixels.

delete()

Supported API . Delete this HtmlToolInstance.

ChimeraXHtmlView provides a HTML window that understands ChimeraX-specific schemes. It is built on top of HtmlView, which provides scheme support.

class ChimeraXHtmlView(session, parent, *args, schemes=None, interceptor=None, download=None, handlers=None, profile=None, **kw)

Bases: HtmlView

HTML window with ChimeraX-specific scheme support.

The schemes are ‘cxcmd’ and ‘help’.

class HtmlView(*args, size_hint=None, schemes=None, interceptor=None, download=None, handlers=None, profile=None, profile_is_private=None, tool_window=None, log_errors=False, **kw)

Bases: QWebEngineView

HtmlView is a derived class from Qt.QtWebEngineWidgets.QWebEngineView that simplifies using custom schemes and intercepting navigation requests.

HtmlView may be instantiated just like QWebEngineView, with additional keyword arguments:

Parameters
  • size_hint (a QSize compatible value, typically (width, height),) – specifying the preferred initial size for the view. Default None.

  • interceptor (a callback function taking one argument, an instance) – of QWebEngineUrlRequestInfo, invoked to handle navigation requests. Default None.

  • schemes (an iterable of custom schemes that will be used in the) – view. If schemes is specified, then interceptor will be called when custom URLs are clicked. Default None.

  • download (a callback function taking one argument, an instance) – of QWebEngineDownloadItem, invoked when download is requested. Default None.

  • profile (the QWebEngineProfile to use. If it is given, then) – ‘interceptor’, ‘schemes’, and ‘download’ parameters are ignored because they are assumed to be already set in the profile. Default None.

  • profile_is_private (True if profile should be deleted when widget is) – closed. Default True if profile is None.

  • tool_window (if specified, ChimeraX context menu is displayed instead) – of default context menu. Default None.

  • log_errors (whether to log JavaScript error/warning/info messages) – to ChimeraX console. Default False.

profile
Type

the QWebEngineProfile used

deleteLater()

Supported API . Schedule HtmlView instance for deletion at a safe time.

runJavaScript(script, *args)

Supported API . Run JavaScript using currently displayed HTML page.

Parameters
  • script (a string containing URL to new content.) –

  • args (additional arguments supported by) – Qt.QtWebEngineWidgets.QWebEnginePage.runJavaScript().

setHtml(html, url=None)

Supported API . Replace widget content.

Parameters
  • html (a string containing new HTML content.) –

  • url (a string containing URL corresponding to content.) –

setUrl(url)

Supported API . Replace widget content.

Parameters

url (a string containing URL to new content.) –

sizeHint()

Supported API . Returns size hint as a :py:class:Qt.QtCore.QSize instance.

chimerax_intercept(request_info, *args, session=None, view=None)

Experimental API . Interceptor for ChimeraX-specific schemes

Parameters
  • request_info (QWebEngineRequestInfo) –

  • session (a Session instance) –

  • view (a QWebEngineView instance or a function that returns the instance) –

create_chimerax_profile(parent, schemes=None, interceptor=None, download=None, handlers=None, storage_name=None)

Experimental API . Create QWebEngineProfile with ChimeraX-specific scheme support

See create_profile() for argument types. The interceptor should incorporate the chimerax_intercept() functionality.

create_profile(parent, schemes=None, interceptor=None, download=None, handlers=None, storage_name=None)

Experimental API . Create a QWebEngineProfile. The profile provides shared access to the files in the html directory in the chimerax.ui package by rewriting links to /chimerax/ui/html to that directory.

Parameters
  • interceptor (a callback function taking one argument, an instance) – of QWebEngineUrlRequestInfo, invoked to handle navigation requests. Default None.

  • schemes (an iterable of custom schemes that will be used in the) – view. If schemes is specified, then interceptor will be called when custom URLs are clicked. Default None.

  • download (a callback function taking one argument, an instance) – of QWebEngineDownloadItem, invoked when download is requested. Default None.

  • handlers (a dictionary of scheme handlers. Default None.) –

  • storage_name (a string giving a unique name for persistent cookie storage.) – if this is None then cookies are only stored in memory.

delete_profile(profile)

Experimental API . Cleanup profiles created by create_profile

set_user_agent(profile)

Experimental API . Set profile’s user agent

ui_autostart(session, do_start, tool_name)

Experimental API . Control whether a tool is launched at ChimeraX startup

ui_dockable(session, dockable, tool_name)

Experimental API . Control whether a tool’s windows are dockable

ui_favorite(session, make_favorite, tool_name)

Experimental API . Control whether a tool is launched at ChimeraX startup

ui_fullscreen(session, show)

Experimental API . Show fullscreen (no titlebar) or normal mode.

ui_hide_floating(session, hide_tools)

Experimental API . Temporarily show/hide floating tools.

ui_menubar(session, show)

Experimental API . Show or hide the top of window menubar.

ui_statusbar(session, show)

Experimental API . Show or hide the statusbar.

ui_tool_hide(session, tool_name, _show=True)

Experimental API . Hide tool.

Parameters

tool_name (string) –

ui_tool_show(session, tool_name, _show=True)

Experimental API . Show a tool, or start one if none is running.

Parameters

tool_name (string) –

ui_windowfill(session, fill)

Experimental API . Temporarily show/hide docked tools.

mouse_modes: Mouse modes

Classes to create mouse modes and assign mouse buttons and modifier keys to specific modes.

class MouseEvent(event=None, modifiers=None, position=None, wheel_value=None)

Bases: object

Provides an interface to mouse event coordinates and modifier keys so that mouse modes do not directly depend on details of the window toolkit.

__init__(event=None, modifiers=None, position=None, wheel_value=None)

Experimental API .

alt_down()

Supported API . Does the mouse event have the alt key down.

position()

Supported API . Pair of floating point x,y pixel coordinates relative to upper-left corner of graphics window. These values can be fractional if pointer device gives subpixel resolution.

shift_down()

Supported API . Does the mouse event have the shift key down.

wheel_value()

Supported API . Number of clicks the mouse wheel was turned, signed float. One click is typically 15 degrees of wheel rotation.

class MouseMode(session)

Bases: object

Classes derived from MouseMode implement specific mouse modes providing methods mouse_down(), mouse_up(), mouse_motion(), wheel(), pause() that are called when mouse events occur. Which mouse button and modifier keys are detected by a mode is controlled by a different MauseModes class.

__init__(session)

Supported API .

double_click

Supported API . Whether the last mouse-down was actually a double_click. Can be used in the mouse-up event handler if different behavior needed after a double click. There is a mouse_double_click method for doing something on a double click (which happens on the second mouse down), so this boolean is only for mouse-up handlers that behave differently after single vs. double clicks.

enable()

Supported API . Called when mouse mode is enabled. Override if mode wants to know that it has been bound to a mouse button.

icon_file = None

Supported API . Image file name for an icon for this mouse mode to show in the mouse mode GUI panel. The icon file of this name needs to be in the mouse_modes tool icons subdirectory, should be PNG, square, and at least 64 pixels square. It will be rescaled as needed. A none value means no icon will be shown in the gui interface.

last_mouse_position

Experimental API . Last mouse position during a mouse drag.

mouse_double_click(event)

Supported API . Override this method to handle double clicks. Keep in mind that you will also receive the mouse_down and mouse_up events. If your mouse_up handler needs to behave differently depending on whether it is the second part of a double click, have it check the self.double_click boolean, and make sure to call this base method so that the boolean is set.

mouse_down(event)

Supported API . Override this method to handle mouse down events. Derived methods can call this base class method to set mouse_down_position and last_mouse_position and properly handle double clicks.

mouse_down_position

Experimental API . Pixel position (x,y) of mouse-down, sometimes useful to detect on mouse-up whether any mouse motion occured. Set to None after mouse up.

mouse_drag(event)

Supported API . Override this method to handle mouse drag events.

mouse_motion(event)

Supported API . Return the mouse motion in pixels (dx,dy) since the last mouse event.

mouse_up(event)

Supported API . Override this method to handle mouse down events. Derived methods can call this base class method to set mouse_down_position and last_mouse_position to None.

move_after_pause()

Supported API . Override this method to take action when the mouse moves after a hover. This allows for instance undisplaying a popup help balloon window.

name = 'mode name'

Supported API . Name of the mouse mode used with the mousemode command. Should be unique among all mouse modes.

pause(position)

Supported API . Override this method to take action when the mouse hovers for a time given by the MouseModes pause interval (default 0.5 seconds).

pixel_size(center=None, min_scene_frac=1e-05)

Supported API . Report the pixel size in scene units at the center of rotation. Clamp the value to be at least min_scene_fraction times the width of the displayed models.

touchpad_four_finger_trans(event)

Supported API . Override this method to take action when a four-finger swiping motion is used on a multitouch touchpad. The move parameter is available as event.three_finger_trans and is a tuple of two floats: (delta_x, delta_y) representing the distance moved on the touchpad as a fraction of its width.

touchpad_three_finger_trans(event)

Supported API . Override this method to take action when a three-finger swiping motion is used on a multitouch touchpad. The move parameter is available as event.three_finger_trans and is a tuple of two floats: (delta_x, delta_y) representing the distance moved on the touchpad as a fraction of its width.

touchpad_two_finger_scale(event)

Supported API . Override this method to take action when a two-finger pinching motion is used on a multitouch touchpad. The scale parameter is available as event.two_finger_scale and is a float, where values larger than 1 indicate fingers moving apart and values less than 1 indicate fingers moving together.

touchpad_two_finger_trans(event)

Supported API . Override this method to take action when a two-finger swiping motion is used on a multitouch touchpad. This method should use either event.two_finger_trans (a tuple of two floats delta_x and delta_y) or event.wheel_value (an effective mouse wheel value synthesized from delta_y). delta_x and delta_y are distances expressed as fractions of the total width of the trackpad.

touchpad_two_finger_twist(event)

Supported API . Override this method to take action when a two-finger twisting motion is used on a multitouch touchpad. The angle parameter is available as event.two_finger_twist, and is a float representing the rotation angle in degrees.

property uses_wheel

Return True if derived class implements the wheel() method.

wheel(event)

Supported API . Override this method to handle mouse wheel events.

class MouseModes(session)

Bases: object

Keep the list of available mouse modes and also which mode is bound to each mouse button (left, middle, right), or mouse button and modifier key (alt, command, control shift). The mouse modes object for a session is session.ui.mouse_modes

__init__(session)

Experimental API .

add_mode(mode)

Supported API . Add a MouseMode instance to the list of available modes.

bind_mouse_mode(mouse_button=None, mouse_modifiers=[], mode=None, trackpad_action=None, trackpad_modifiers=[])

Experimental API . Bind a MouseMode to a mouse click and/or a multitouch trackpad action with optional modifier keys.

mouse_button is either None or one of (“left”, “middle”, “right”, “wheel”, or “pause”).

trackpad_action is either None or one of (“pinch”, “twist”, “two finger swipe”, “three finger swipe” or “four finger swipe”).

mouse_modifiers and trackpad_modifiers are each a list of 0 or more of (“alt”, “command”, “control” or “shift”).

mode is a MouseMode instance.

bind_standard_mouse_modes(buttons=('left', 'middle', 'right', 'wheel', 'pause'), trackpad=('two finger swipe', 'twist', 'pinch', 'three finger swipe', 'four finger swipe'))

Experimental API . Bind the standard mouse modes: left = rotate, ctrl-left = select, middle = translate, right = zoom, wheel = zoom, pause = identify object.

property bindings

List of MouseBinding instances.

mode(button='left', modifiers=[], exact=False)

Experimental API . Return the MouseMode associated with a specified button and modifiers, or None if no mode is bound.

property modes

List of MouseMode instances.

mouse_pause_tracking()

Experimental API . Called periodically to check for mouse pause and invoke pause mode. Typically this will be called by the redraw loop and is used to determine when a mouse pause occurs.

remove_binding(button=None, modifiers=[], trackpad_action=None, trackpad_modifiers=[])

Experimental API . Unbind the mouse button and modifier key combination. No mode will be associated with this button and modifier.

remove_mode(mode)

Experimental API . Remove a MouseMode instance from the list of available modes.

trackpad_mode(action, modifiers=[], exact=False)

Experimental API . Return the MouseMode associated with a specific multitouch action and modifiers, or None if no mode is bound.

mod_key_info(key_function)

Experimental API . Qt swaps control/meta on Mac, so centralize that knowledge here. The possible “key_functions” are: alt, control, command, and shift

Returns the Qt modifier bit (e.g. Qt.KeyboardModifier.AltModifier) and name of the actual key

OptionsPanel and CategorizedOptionsPanel are for interfaces that want to present a set of options that aren’t remembered in any way between different sessions. The corresponding Settings classes offer buttons to Save/Reset/Restore the option values to/from a Settings instance (found in chimerax.core.settings).

The Categorized classes organize the presented options into categories, which the user can switch between.

class CategorizedOptionsPanel(parent=None, *, category_sorting=True, option_sorting=True, category_scrolled={}, **kw)

Bases: QTabWidget

Supported API. CategorizedOptionsPanel is a container for single-use (not savable) Options sorted by category

add_option(category, option)

Supported API . Add option (instance of chimerax.ui.options.Option) to given category

add_tab(category, panel)

Supported API . Only used if a tab needs to present a custom interface.

The panel needs to offer a .options() method that returns its options.

class CategorizedSettingsPanel(parent=None, *, category_sorting=True, option_sorting=True, **kw)

Bases: SettingsPanelBase

Supported API. CategorizedSettingsPanel is a container for remember-able Options (i.e. Options that have Settings instances (found in chimerax.core.settings) specified via their ‘settings’ constructor arg) and that are presented in categories.

add_option(category, option)

Supported API . Add option (instance of chimerax.ui.options.Option) to given category

add_option_group(category, **kw)

Experimental API . Returns a container widget and an OptionsPanel; caller is responsible for creating a layout for the container widget and placing the OptionsPanel in it, along with any other desired widgets

add_tab(category, panel)

Supported API . Same as CategorizedOptionsPanel.add_tab(…)

class OptionsPanel(parent=None, *, sorting=True, scrolled=True, contents_margins=None)

Bases: QWidget

Supported API. OptionsPanel is a container for single-use (not savable) Options

add_option(option)

Supported API . Add an option (instance of chimerax.ui.options.Option).

class SettingsPanel(parent=None, *, sorting=True, **kw)

Bases: SettingsPanelBase

Supported API. SettingsPanel is a container for remember-able Options that work in conjunction with Options that have Settings instances (found in chimerax.core.settings) specified via their ‘settings’ constructor arg.

add_option(option)

Supported API . Add an option (instance of chimerax.ui.options.Option).

add_option_group(**kw)

Experimental API . Returns a container widget and an OptionsPanel; caller is responsible for creating a layout for the container widget and placing the OptionsPanel in it, along with any other desired widgets

class SettingsPanelBase(parent, option_sorting, multicategory, *, category_sorting=None, buttons=True, help_cb=None, **kw)

Bases: QWidget

class BooleanOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: Option

Supported API. Option for true/false values

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class ColorOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: RGBA8Option

Option for rgba colors

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class EnumBase(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: Option

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class EnumOption(*args, values=None, **kw)

Bases: EnumBase

Supported API. Option for enumerated values. The given values will be displayed in the interface and returned by the ‘value’ attribute. If you want to display different text in the interface than the literal value, use the SymbolicEnumOption. You can specify values either by subclassing and overriding the ‘values’ class attribute, or by supplying the ‘values’ keyword to the constructor.

class FileOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: Option

base class for specifying a file

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class FloatEnumOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: EnumBase

Supported API. Option for a floating-point number and an enum (as a 2-tuple), for something such as size and units

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class FloatOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: NumericOption

Supported API. Option for floating-point values. Constructor takes option min/max keywords to specify lower/upper bound values. Besides being numeric values, those keyords can also be ‘positive’ or ‘negative’ respectively, in which case the allowed value can be arbitrarily close to zero but cannot be equal to zero.

‘decimal_places’ indicates allowable number of digits after the decimal point (default: 3). Values with more digits will be rounded. If the widget provides a means to increment the value (e.g. up/down arrow) then ‘step’ is how much the value will be incremented (default: 10x the smallest value implied by ‘decimal_places’).

if ‘as_slider’ is True, then a slider widget will be used instead of an entry widget. If using a slider, it is recommended to set ‘min’ and ‘max’ values; otherwise the widget will cover a very large numeric range. When using a slider, you can specify ‘continuous_callback’ as True/False (default False) to control whether the option’s callback happens as the slider is dragged, or just when the slider is released.

Supports ‘left_text’ and ‘right_text’ keywords for putting text before and after the entry widget on the right side of the form, or below left/right of the slider if using a slider.

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

show_text(text)

Experimental API . So that option can show text such as ‘N/A’ and number ranges

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class FontOption(*args, **kw)

Bases: EnumOption

values = None
class HostPortOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: StringIntOption

Supported API. Option for a host name or address and a TCP port number (as a 2-tuple)

class InputFileOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: FileOption

class InputFolderOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: Option

Option for specifying an existing folder for input

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class IntOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: NumericOption

Supported API. Option for integer values. Constructor takes option min/max keywords to specify lower/upper bound values.

Supports ‘left_text’ and ‘right_text’ keywords for putting text before and after the entry widget on the right side of the form

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

show_text(text)

Experimental API . So that option can show text such as ‘N/A’ and number ranges

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class NumericOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: Option

base class for options that display single numbers (e.g. IntOption, FloatOption)

display_for_items(items)

Supported API . Use the option’s ‘attr_name’ attribute to survey the given items for their value or values for that attribute and display the value or values in the option. The ‘items’ can be a chimerax.atomic.Collection or a normal Python sequence. If a Collection, the “plural form” of attr_name will be used to check the Collection. Ranges will be shown appropriately.

abstract show_text(text)

Experimental API . So that option can show text such as ‘N/A’ and number ranges

class Option(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: object

Supported API. Base class (and common API) for all options

display_for_items(items)

Supported API . Use the option’s ‘attr_name’ attribute to survey the given items for their value or values for that attribute and display the value or values in the option. The ‘items’ can be a chimerax.atomic.Collection or a normal Python sequence. If a Collection, the “plural form” of attr_name will be used to check the Collection.

property enabled

Supported API. Enable/disable the option

get_attribute()

Supported API . Get the attribute associated with this option (‘attr_name’ in constructor) from the option’s settings attribute

make_callback()

Supported API . Called (usually by GUI) to propagate changes back to program

set_attribute()

Supported API . Set the attribute associated with this option (‘attr_name’ in constructor) from the option’s settings attribute

abstract set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

abstract property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

values_for_items(items)

Supported API . Convenience function to get values for the ‘attr_name’ attribute from the given items. Used by display_for_items() and by subclasses overriding display_for_items().

class OptionalRGBA8PairOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: Option

Like OptionalRGBA8Option, but two checkboxes/colors

Supports ‘initial_colors’ constructor arg (2-tuple of colors) for initializing the color buttons even when the starting value of the option is (None, None) (checkboxes will be unchecked)

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

set_value(value)

Experimental API . 2-tuple. Accepts a wide variety of values, not just rgba

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class OptionalRGBAOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: OptionalRGBA8Option

Option for floating-point (0-1) rgba colors, with possibility of None.

Supports ‘initial_color’ constructor arg for initializing the color button even when the starting value of the option is None (checkbox will be unchecked)

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class OptionalRGBAPairOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: OptionalRGBA8PairOption

Like OptionalRGBAOption, but two checkboxes/colors

Supports ‘initial_colors’ constructor arg (2-tuple of colors) for initializing the color buttons even when the starting value of the option is (None, None) (checkboxes will be unchecked)

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class OutputFileOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: FileOption

OutputFolderOption

alias of chimerax.ui.options.options.InputFolderOption

class PasswordOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: StringOption

Supported API. Option for entering a password

class PhysicalSizeOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: FloatEnumOption

class RGBA8Option(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: Option

Option for rgba colors, returns 8-bit (0-255) rgba values

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

set_value(value)

Experimental API . Accepts a wide variety of values, not just rgba

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class RGBAOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: RGBA8Option

Option for rgba colors, returns floating-point (0-1) rgba values

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class StringIntOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: Option

Supported API. Option for a string and an int (as a 2-tuple), for something such as host and port

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class StringOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: Option

Supported API. Option for text strings

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class StringsOption(name, default, callback, *, balloon=None, attr_name=None, settings=None, auto_set_attr=True, **kw)

Bases: Option

Supported API. Option for list of plain text strings There is no builtin way for the user to indicate that they are done editing the text, so no callback will occur. If such an indication is needed, another widget would have to provide it.

set_multiple()

Supported API . Indicate that the items the option covers have multiple different values

property value

Supported API. Get/set the option’s value; when set it should NOT invoke the callback

class SymbolicEnumOption(*args, labels=None, **kw)

Bases: EnumOption

Supported API. Option for enumerated values with symbolic names The given values will be returned by the ‘value’ attribute and the corresponding symbolic names will be displayed in the user interface. If your values and symbolic names are the same, just use EnumOption. You can specify values and symbolic names either by subclassing and overriding the ‘values’ and ‘labels’ class attributes, or by supplying the ‘values’ and ‘labels’ keywords to the constructor.