eric3.Tools.TRPreviewer

Module implementing the TR Previewer main window.

Classes

TRPreviewer Class implementing the UI Previewer main window.
Translation Class to store the properties of a translation
TranslationsDict Class to store all loaded translations.
WidgetView Class to show a dynamically loaded widget (or dialog).
WidgetWorkspace Specialized workspace to show the loaded widgets.

Functions

_filename Private module function to chop off the path.


TRPreviewer

Class implementing the UI Previewer main window.

Derived from

QMainWindow

Methods

TRPreviewer Constructor
closeEvent Private event handler for the close event.
handleAbout Private slot to show the about information.
handleAboutQt Private slot to show info about Qt.
handleOpenTranslation Private slot to handle the Open Translation action.
handleOpenWidget Private slot to handle the Open Dialog action.
handleShowWindowMenu Private slot to handle the aboutToShow signal of the window menu.
initActions Private method to define the user interface actions.
initMenus Private method to create the menus.
initToolbars Private method to create the toolbars.
reloadTranslations Public slot to reload all translations.
setTranslation Public slot to activate a translation.
show Public slot to show this dialog.
updateActions Private slot to update the actions state.

TRPreviewer (Constructor)

TRPreviewer(filenames = [], parent = None, name = None)

Constructor

filenames
filenames of form and/or translation files to load
parent
parent widget of this window (QWidget)
name
name of this window (string or QString)

TRPreviewer.closeEvent

closeEvent(event)

Private event handler for the close event. This event handler saves the preferences.

event
close event (QCloseEvent)

TRPreviewer.handleAbout

handleAbout()

Private slot to show the about information.

TRPreviewer.handleAboutQt

handleAboutQt()

Private slot to show info about Qt.

TRPreviewer.handleOpenTranslation

handleOpenTranslation()

Private slot to handle the Open Translation action.

TRPreviewer.handleOpenWidget

handleOpenWidget()

Private slot to handle the Open Dialog action.

TRPreviewer.handleShowWindowMenu

handleShowWindowMenu()

Private slot to handle the aboutToShow signal of the window menu.

TRPreviewer.initActions

initActions()

Private method to define the user interface actions.

TRPreviewer.initMenus

initMenus()

Private method to create the menus.

TRPreviewer.initToolbars

initToolbars()

Private method to create the toolbars.

TRPreviewer.reloadTranslations

reloadTranslations()

Public slot to reload all translations.

TRPreviewer.setTranslation

setTranslation(name)

Public slot to activate a translation.

name
name (language) of the translation (string or QString)

TRPreviewer.show

show()

Public slot to show this dialog. This overloaded slot loads a UI file to be previewed after the main window has been shown. This way, previewing a dialog doesn't interfere with showing the main window.

TRPreviewer.updateActions

updateActions()

Private slot to update the actions state.

Up


Translation

Class to store the properties of a translation

Derived from

None

Methods

Translation Constructor

Translation (Constructor)

Translation()

Constructor

Up


TranslationsDict

Class to store all loaded translations.

Signals

translationChanged()
emit after a translator was set

Derived from

QObject

Methods

TranslationsDict Constructor
__del Private method to delete a translator from the list of available translators.
__findFileName Private method to find a translation by file name.
__findName Private method to find a translation by name.
__haveFileName Private method to check for the presence of a translation.
__haveName Private method to check for the presence of a named translation.
__uniqueName Private method to generate a unique name.
add Public method to add a translation to the list.
hasTranslations Public method to check for loaded translations.
loadTransFile Public slot to load a translation file.
reload Public method to reload all translators.
set Public slot to set a translator by name.

TranslationsDict (Constructor)

TranslationsDict(selector, parent)

Constructor

selector
reference to the QComboBox used to show the available languages (QComboBox)
parent
parent widget (QWidget)

TranslationsDict.__del

__del(name)

Private method to delete a translator from the list of available translators.

name
name of the translator to delete (string or QString)

TranslationsDict.__findFileName

__findFileName(transFileName)

Private method to find a translation by file name.

transFileName
file name of the translation file (string or QString)
Returns:
reference to a translation object or None

TranslationsDict.__findName

__findName(name)

Private method to find a translation by name.

name
name (language) of the translation (string or QString)
Returns:
reference to a translation object or None

TranslationsDict.__haveFileName

__haveFileName(transFileName)

Private method to check for the presence of a translation.

transFileName
file name of the translation file (string or QString)
Returns:
flag indicating the presence of the translation (boolean)

TranslationsDict.__haveName

__haveName(name)

Private method to check for the presence of a named translation.

name
name (language) of the translation (string or QString)
Returns:
flag indicating the presence of the translation (boolean)

TranslationsDict.__uniqueName

__uniqueName(transFileName)

Private method to generate a unique name.

transFileName
file name of the translation file (string or QString)
Returns:
unique name (QString)

TranslationsDict.add

add(transFileName, setTranslation = 1)

Public method to add a translation to the list. If the translation file (*.qm) has not been loaded yet, it will be loaded automatically.

transFileName
name of the translation file to be added (string or QString)
setTranslation
flag indicating, if this should be set as the active translation (boolean)

TranslationsDict.hasTranslations

hasTranslations()

Public method to check for loaded translations.

Returns:
flag signaling if any translation was loaded (boolean)

TranslationsDict.loadTransFile

loadTransFile(transFileName)

Public slot to load a translation file.

transFileName
file name of the translation file (string or QString)
Returns:
reference to the new translator object (QTranslator)

TranslationsDict.reload

reload()

Public method to reload all translators.

TranslationsDict.set

set(name)

Public slot to set a translator by name.

name
name (language) of the translator to set (string or QString)

Up


WidgetView

Class to show a dynamically loaded widget (or dialog).

Derived from

QWidget

Methods

WidgetView Constructor
__rebuildWidget Private method to schedule a rebuild of the widget.
buildWidget Public slot to load a UI file.
eventFilter Protected method called to filter an event.
isValid Public method to return the validity of this widget view.
uiFileName Public method to retrieve the name of the UI file.

WidgetView (Constructor)

WidgetView(uiFileName, parent = None, name = None)

Constructor

uiFileName
name of the UI file to load (string or QString)
parent
parent widget (QWidget)
name
name of this widget (string)

WidgetView.__rebuildWidget

__rebuildWidget()

Private method to schedule a rebuild of the widget.

WidgetView.buildWidget

buildWidget()

Public slot to load a UI file.

WidgetView.eventFilter

eventFilter(obj, ev)

Protected method called to filter an event.

object
object, that generated the event (QObject)
event
the event, that was generated by object (QEvent)
Returns:
flag indicating if event was filtered out

WidgetView.isValid

isValid()

Public method to return the validity of this widget view.

Returns:
flag indicating the validity (boolean)

WidgetView.uiFileName

uiFileName()

Public method to retrieve the name of the UI file.

Returns:
filename of the loaded UI file (QString)

Up


WidgetWorkspace

Specialized workspace to show the loaded widgets.

Derived from

QWorkspace

Methods

WidgetWorkspace Constructor
__findWidget Private method to find a specific widget view.
eventFilter Protected method called to filter an event.
handleClose Public slot to close the active window.
handleCloseAll Public slot to close all windows.
handleShowWindowMenu Public method to set up the widgets part of the Window menu.
handleWidget Private method to handle the toggle of a window.
hasWidgets Public method to check for loaded widgets.
loadWidget Public slot to load a UI file.
toggleWidget Private method to toggle a workspace window.

WidgetWorkspace (Constructor)

WidgetWorkspace(parent = None, name = None)

Constructor

parent
parent widget (QWidget)
name
name of this widget (string)

WidgetWorkspace.__findWidget

__findWidget(uiFileName)

Private method to find a specific widget view.

uiFileName
filename of the loaded UI file (string or QString)
Returns:
reference to the widget (WidgetView) or None

WidgetWorkspace.eventFilter

eventFilter(obj, ev)

Protected method called to filter an event.

object
object, that generated the event (QObject)
event
the event, that was generated by object (QEvent)
Returns:
flag indicating if event was filtered out

WidgetWorkspace.handleClose

handleClose()

Public slot to close the active window.

WidgetWorkspace.handleCloseAll

handleCloseAll()

Public slot to close all windows.

WidgetWorkspace.handleShowWindowMenu

handleShowWindowMenu(windowMenu)

Public method to set up the widgets part of the Window menu.

windowMenu
reference to the window menu

WidgetWorkspace.handleWidget

handleWidget(idx)

Private method to handle the toggle of a window.

idx
index of the window to toggle (int)

WidgetWorkspace.hasWidgets

hasWidgets()

Public method to check for loaded widgets.

Returns:
flag signaling if any widget was loaded (boolean)

WidgetWorkspace.loadWidget

loadWidget(uiFileName)

Public slot to load a UI file.

uiFileName
name of the UI file to load (string or QString)

WidgetWorkspace.toggleWidget

toggleWidget(w)

Private method to toggle a workspace window.

w
window to be toggled

Up


_filename

_filename(path)

Private module function to chop off the path.

path
path to extract the filename from (string or QString)
Returns:
extracted filename (QString)
Up