50. gui.guimain — Graphical User Interface for pyFormex.

This module contains the main functions responsible for constructing and starting the pyFormex GUI.

50.1. Classes defined in module gui.guimain

class gui.guimain.Board(parent=None)[source]

Message board for displaying read-only plain text messages.

class gui.guimain.FileWatcher(*args)[source]

Watch for changes in files and then execute the associated function.

class gui.guimain.Gui(windowname, size=(800, 600), pos=(0, 0), bdsize=(0, 0))[source]

Implements a GUI for pyformex.

class gui.guimain.Application(args)[source]

The interactive Qt application

It sets the default locale to ‘C’ and rejects thousands separators. This is the only sensible thing to do for processing numbers in a scientific international community.

50.2. Functions defined in module gui.guimain

gui.guimain.setAppStyle(style)[source]

Set the main application style.

gui.guimain.setAppFont(font)[source]

Set the main application font.

font is either a QFont or a string resulting from the QFont.toString() method

gui.guimain.setAppFontFamily(family)[source]

Set the main application font family to the given family.

gui.guimain.setAppFontSize(size)[source]

Set the main application font size to the given point size.

gui.guimain.setAppearance()[source]

Set all the GUI appearance elements.

Sets the GUI appearance from the current configuration values ‘gui/style’, ‘gui/font’, ‘gui/fontfamily’, ‘gui/fontsize’.

gui.guimain.exitDialog()[source]

Show the exit dialog to the user.

gui.guimain.xwininfo(*, windowid=None, name=None)[source]

Get information about an X window.

Returns the information about an X11 window as obtained from the xwininfo command, but parsed as a dict. The window can be specified by its id or by its name. If neither is provided, the user needs to interactively select a window by clicking the mouse in that window.

Parameters
  • windowid (str, optional) – A hex string with the window id.

  • name (str) – The window name, usually displayed in the top border decoration.

  • check_only (bool) – If True, only check whether the window exists, but do not return the info.

Returns

dict – Return all the information obtained from calling xwininfo for the specified or picked window. If a window id or name is specified that does not exist, an empty dict is returned.

Notes

The window id of the pyFormex main window can be obtained from pf.GUI.winId(). The name of the window is pf.Version().

gui.guimain.pidofxwin(windowid)[source]

Returns the PID of the process that has created the window.

Remark: Not all processes store the PID information in the way it is retrieved here. In many cases (X over network) the PID can not be retrieved. However, the intent of this function is just to find a dangling pyFormex process, and should probably work on a normal desktop configuration.

gui.guimain.findOldProcesses(max=16)[source]

Find old pyFormex GUI processes still running.

There is a maximum to the number of processes that can be detected. 16 will suffice largely, because there is no sane reason to open that many pyFormex GUI’s on the same screen.

Returns the next available main window name, and a list of running pyFormex GUI processes, if any.

gui.guimain.killProcesses(pids)[source]

Kill the processes in the pids list.

gui.guimain.showSplash()[source]

Show the splash screen

gui.guimain.startGUI(args)[source]

Create the Qt application and GUI.

A (possibly empty) list of command line options should be provided. Qt wil remove the recognized Qt and X11 options.

gui.guimain.createDatabases()[source]

Create unified database objects for all menus.

gui.guimain.runGUI()[source]

Go into interactive mode