# `TaurusMainWindow`

digraph inheritance509a54281a { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "BaseConfigurableClass" [URL="taurus.qt.qtcore.configuration-BaseConfigurableClass.html#taurus.qt.qtcore.configuration.BaseConfigurableClass",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="A base class defining the API for configurable objects."]; "Logger" [URL="taurus-Logger.html#taurus.Logger",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="The taurus logger class. All taurus pertinent classes should inherit"]; "QMainWindow" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QMainWindow(parent: QWidget|None = None, flags: Qt.WindowFlags|Qt.WindowType = Qt.WindowFlags())"]; "QWidget" -> "QMainWindow" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QObject" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QObject(parent: QObject|None = None)"]; "wrapper" -> "QObject" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QPaintDevice" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QPaintDevice()"]; "simplewrapper" -> "QPaintDevice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QWidget" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QWidget(parent: QWidget|None = None, flags: Qt.WindowFlags|Qt.WindowType = Qt.WindowFlags())"]; "QObject" -> "QWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QPaintDevice" -> "QWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusBaseComponent" [URL="taurus.qt.qtgui.base-TaurusBaseComponent.html#taurus.qt.qtgui.base.TaurusBaseComponent",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="A generic Taurus component."]; "TaurusListener" -> "TaurusBaseComponent" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BaseConfigurableClass" -> "TaurusBaseComponent" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusBaseContainer" [URL="taurus.qt.qtgui.container-TaurusBaseContainer.html#taurus.qt.qtgui.container.TaurusBaseContainer",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="Base class for the Taurus container widgets. This type of taurus"]; "TaurusBaseWidget" -> "TaurusBaseContainer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusBaseWidget" [URL="taurus.qt.qtgui.base-TaurusBaseWidget.html#taurus.qt.qtgui.base.TaurusBaseWidget",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="The base class for all Qt Taurus widgets."]; "TaurusBaseComponent" -> "TaurusBaseWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusListener" [URL="taurus.core.tauruslistener-TaurusListener.html#taurus.core.tauruslistener.TaurusListener",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="TaurusListener Interface"]; "Logger" -> "TaurusListener" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusMainWindow" [URL="#taurus.qt.qtgui.container.TaurusMainWindow",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="A Taurus-aware QMainWindow with several customizations:"]; "QMainWindow" -> "TaurusMainWindow" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusBaseContainer" -> "TaurusMainWindow" [arrowsize=0.5,style="setlinewidth(0.5)"]; "simplewrapper" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded]; "wrapper" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded]; "simplewrapper" -> "wrapper" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

class TaurusMainWindow(parent=None, designMode=False, splash=None)

  A Taurus-aware QMainWindow with several customizations:

  > - It takes care of (re)storing its geometry and state (see `loadSettings()`)

  > - Supports perspectives (programmatic access and, optionally, accessible by user), and allows defining a set of “factory settings”

  > - It provides a customizable splashScreen (optional)

  > - Supports spawning remote consoles and remote debugging

  > - Supports full-screen mode toggling

  > - Supports adding launchers to external applications

  > - It provides a statusBar with an optional heart-beat LED

  > - The following Menus are optionally provided and populated with basic actions:

  >   > - File (accessible by derived classes as self.fileMenu)

  >   > - View (accessible by derived classes as self.viewMenu)

  >   > - Taurus (accessible by derived classes as self.taurusMenu)

  >   > - Tools (accessible by derived classes as self.toolsMenu)

  >   > - Help (accessible by derived classes as self.helpMenu)

  Import from `taurus.qt.qtgui.container` as:

      from taurus.qt.qtgui.container import TaurusMainWindow

  FILE_MENU_ENABLED = True

    Whether to show the File menu

  FULLSCREEN_TOOLBAR_ENABLED = True

    Whether to show the Full Screen Toolbar

  HEARTBEAT = 1500

    Heartbeat LED blinking semi-period in ms. Set to None for not showing it

  HELP_MENU_ENABLED = True

    Whether to show the Help menu

  LOGGER_WIDGET_ENABLED = True

    Whether add a dockwidget with the logger widget

  SAVE_SETTINGS_ON_CLOSE = None

    Whether to save settings before closing. Set to None to ask the user

  SPLASH_LOGO_NAME = 'large:TaurusSplash.png'

    Name of logo image for splash screen. Set to None for disabling splash

  SPLASH_MESSAGE = 'Initializing Main window...'

    Message for splash screen

  TAURUS_MENU_ENABLED = True

    Whether to show the Taurus menu

  TOOLS_MENU_ENABLED = True

    Whether to show the Tools menu

  USER_PERSPECTIVES_ENABLED = True

    Whether to show actions for user perspectives

  VIEW_MENU_ENABLED = True

    Whether to show the View menu

  addExternalAppLauncher(extapp, toToolBar=True, toMenu=True)

    Adds launchers for an external application to the Tools Menu and/or to the Tools ToolBar.

    Parameters:

      - extapp (ExternalAppAction or list<str>) – the external application to be launched passed as a `ExternalAppAction` (recommended because it allows to specify custom text and icon) or, alternatively, as a list of strings (sys.argv- like) that will be passed to `subprocess.Popen()`.

      - toToolBar (bool) – If True (default) a button will be added in the Tools toolBar

      - toMenu (bool) – If True (default) an entry will be added in the Tools Menu, under the “External Applications” submenu

    See also

    `ExternalAppAction`

  addLoggerWidget(hidden=True)

    adds a QLoggingWidget as a dockwidget of the main window (and hides it by default)

  applyPendingChanges()
  basicTaurusToolbar()

    returns a QToolBar with few basic buttons (most important, the logo)

    Returns:

    Return type:

      QToolBar

  checkSingleInstance(key=None)

    Tries to connect via a QLocalSocket to an existing application with the given key. If another instance already exists (i.e. the connection succeeds), it means that this application is not the only one

  closeEvent(event)

    This event handler receives widget close events

  contextMenuEvent(event)

    Reimplemented to avoid deprecation warning related to: https://gitlab.com/taurus-org/taurus/-/issues/905

  createFileMenu()

    adds a “File” Menu

  createHelpMenu()

    adds a “Help” Menu

  createPerspectivesToolBar()

    adds a Perspectives ToolBar

  createTaurusMenu()

    adds a “Taurus” Menu

  createToolsMenu()

    adds a “Tools” Menu

  createViewMenu()

    adds a “View” Menu

  deleteExternalAppLauncher(action)

    Remove launchers for an external application to the Tools Menu and/or to the Tools ToolBar.

    Parameters:

      extapp (ExternalAppAction) – the external application to be removed passed as a `ExternalAppAction`

  exportSettingsFile(fname=None)

    copies the current settings file into the given file name.

    Parameters:

      fname (str) – name of output file. If None given, a file dialog will be shown.

  getFactorySettingsFileName()

    returns the file name of the “factory settings” (the ini file with default settings). The default implementation returns “<path>/<appname>.ini”, where <path> is the path of the module where the main window class is defined and <appname> is the application name (as obtained from QApplication).

    Returns:

      the absolute file name.

    Return type:

      str

  getHeartbeat()

    returns the heart beat interval

  getHelpManualURI()
  getPerspectivesList(settings=None)

    Returns the list of saved perspectives

    Parameters:

      settings (QSettings or None) – a QSettings object. If None given, the default one returned by `getQSettings()` will be used

    Returns:

      the list of the names of the currently saved perspectives

    Return type:

      QStringList

  getQSettings()

    Returns the main window settings object. If it was not previously set, it will create a new QSettings object following the Taurus convention i.e., it using Ini format and userScope)

    Returns:

      the main window QSettings object

    Return type:

      QSettings

  classmethod getQtDesignerPluginInfo()

    Returns pertinent information in order to be able to build a valid QtDesigner widget plugin.

    The dictionary returned by this method should contain at least the following keys and values:

    - ‘module’ : a string representing the full python module name (ex.: ‘taurus.qt.qtgui.base’)

    - ‘icon’ : a string representing valid resource icon (ex.: ‘designer:combobox.png’)

    - ‘container’a bool telling if this widget is a container widget or

        not.

    This default implementation returns the following dictionary:

        { 'group'     : 'Taurus [Unclassified]',
          'icon'      : 'logos:taurus.png',
          'container' : False }

    Returns:

      a map with pertinent designer information

    Return type:

      dict

  getTangoHost()
  heartbeat
    pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

      designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

    type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

  helpManualURI
    pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

      designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

    type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

  importSettingsFile(fname=None)

    loads settings (including importing all perspectives) from a given ini file. It warns before overwriting an existing perspective.

    Parameters:

      fname (str) – name of ini file. If None given, a file dialog will be shown.

  loadPerspective(name=None, settings=None)

    Loads the settings saved for the given perspective. It emits a ‘perspectiveChanged’ signal with name as its parameter

    Parameters:

      - name (str) – name of the perspective

      - settings (QSettings or None) – a QSettings object. If None given, the default one returned by `getQSettings()` will be used

  loadSettings(settings=None, group=None, ignoreGeometry=False, factorySettingsFileName=None)

    restores the application settings previously saved with `saveSettings()`.

    Note

    This method should be called explicitly from derived classes after all initialization is done

    Parameters:

      - settings (QSettings or None) – a QSettings object. If None given, the default one returned by `getQSettings()` will be used

      - group (str) – a prefix that will be added to the keys to be loaded (no prefix by default)

      - ignoreGeometry (bool) – if True, the geometry of the MainWindow won’t be restored

      - factorySettingsFileName (str) – file name of a ini file containing the default settings to be used as a fallback in case the settings file is not found (e.g., the first time the application is launched after installation)

  model
    pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

      designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

    type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

  modelChanged

    int = …, arguments: Sequence = …) -> PYQT_SIGNAL

    types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

    Type:

      pyqtSignal(*types, name

    Type:

      str = …, revision

  newQSettings()

    Returns a settings taurus-specific QSettings object. The returned QSettings object will comply with the Taurus defaults for storing application settings (i.e., it uses Ini format and userScope)

    Returns:

      a taurus-specific QSettings object

    Return type:

      QSettings

  onIncommingSocketConnection()

    Slot to be called when another application/instance with the same key checks if this application exists.

    Note

    This is a dummy implementation which just logs the connection and discards the associated socket You may want to reimplement this if you want to act on such connections

  onShowManual(anchor=None)

    Shows the User Manual in a dockwidget

  perspectiveChanged

    int = …, arguments: Sequence = …) -> PYQT_SIGNAL

    types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

    Type:

      pyqtSignal(*types, name

    Type:

      str = …, revision

  removePerspective(name=None, settings=None)

    removes the given perspective from the settings

    Parameters:

      - name (str) – name of the perspective

      - settings (QSettings or None) – a QSettings object. If None given, the default one returned by `getQSettings()` will be used

  resetHeartbeat()

    resets the heartbeat interval

  resetHelpManualURI()
  resetPendingChanges()
  resetQSettings()

    equivalent to setQSettings(None)

  resetTangoHost()
  savePerspective(name=None)

    Stores current state of the application as a perspective with the given name

    Parameters:

      name (str) – name of the perspective

  saveSettings(group=None)

    saves the application settings (so that they can be restored with `loadSettings()`)

    Note

    this method is automatically called by default when closing the window, so in general there is no need to call it from derived classes

    Parameters:

      group (str) – a prefix that will be added to the keys to be saved (no prefix by default)

  saveSettingsFile()

    Save the current settings into default file.

  setHeartbeat(interval)

    sets the interval of the heartbeat LED for the window. The heartbeat is displayed by a Led in the status bar unless it is disabled by setting the interval to 0

    Parameters:

      interval (int) – heart beat interval in millisecs. Set to 0 to disable

  setHelpManualURI(uri)
  setQSettings(settings)

    sets the main window settings object

    Parameters:

      settings (QSettings or None)

    See also

    `getQSettings()`

  setTangoHost(host)
  showEvent(event)

    This event handler receives widget show events

  showHelpAbout()
  showQuality
    pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

      designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

    type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

  splashScreen()

    returns a the splashScreen

    Returns:

    Return type:

      QSplashScreen

  tangoHost
    pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

      designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

    type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

  updatePerspectivesMenu()

    re-checks the perspectives available to update self.perspectivesMenu

    Note

    This method may need be called by derived classes at the end of their initialization.

    Returns:

      the updated perspectives menu (or None if self.USER_PERSPECTIVES_ENABLED is False)

    Return type:

      QMenu

  useParentModel

    (deprecated))