• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

parley

  • Scripting
  • Lesson
Public Slots | Public Member Functions | List of all members
Scripting::Lesson Class Reference

#include <lesson.h>

Inheritance diagram for Scripting::Lesson:
Inheritance graph
[legend]

Public Slots

void appendChildLesson (Lesson *child)
 
void appendEntry (Expression *entry)
 
void appendNewEntry (QStringList translations)
 
QObject * childLesson (int row)
 
QObject * childLesson (const QString &name)
 
int childLessonCount () const
 
QVariantList childLessons (bool recursive=false)
 
void clearEntries ()
 
QVariantList entries (bool recursive=false) const
 
QObject * entry (int row, bool recursive=false)
 
int entryCount (bool recursive=false)
 
QObject * findChildLesson (const QString &name)
 
void insertChildLesson (int row, Lesson *child)
 
void insertEntry (int index, Expression *entry)
 
QObject * newEntry ()
 
QObject * newEntry (QStringList translations)
 
void removeChildLesson (int row)
 
void removeEntry (QObject *entry)
 
void setEntries (QVariantList entries)
 
- Public Slots inherited from Scripting::Container
double averageGrade (int translation, bool recursive)
 
int expressionsOfGrade (int translation, unsigned int grade, bool recursive)
 
void resetGrades (int translation, bool recursive)
 
int row () const
 

Public Member Functions

 Lesson (KEduVocLesson *lesson)
 
 Lesson (KEduVocContainer *container)
 
 Lesson (const QString &name)
 
 ~Lesson ()
 
- Public Member Functions inherited from Scripting::Container
 Container (KEduVocContainer *container=0)
 
 ~Container ()
 
void appendChildContainer (Container *child)
 
Container * childContainer (int row)
 
Container * childContainer (const QString &name)
 
int childContainerCount () const
 
QVariantList childContainers ()
 
KEduVocContainer * findContainer (const QString &name)
 
QString imageUrl ()
 
bool inPractice ()
 
void insertChildContainer (int row, Container *child)
 
KEduVocContainer * kEduVocContainer ()
 
QString name ()
 
void removeChildContainer (int row)
 
void removeTranslation (int translation)
 
void setImageUrl (const QString &url)
 
void setInPractice (bool inPractice)
 
void setName (const QString &name)
 
template<class T , class S >
QVariantList toVariantList (QList< T * > objList) const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Additional Inherited Members

- Static Public Member Functions inherited from Scripting::Container
static
KEduVocContainer::EnumEntriesRecursive 
boolToEnum (bool recursive)
 
static bool enumToBool (KEduVocContainer::EnumEntriesRecursive recursive)
 
static QList< KEduVocContainer * > flattenContainer (KEduVocContainer *root)
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Protected Attributes inherited from Scripting::Container
KEduVocContainer * m_container
 
- Properties inherited from Scripting::Container
QString imageUrl
 
bool inPractice
 
QString name
 
- Properties inherited from QObject
 objectName
 

Detailed Description

KEduVocLesson wrapping class for Kross scripts.

The Lesson class gives access to lesson properties, entries and child-lessons. The lesson properties documentation can be found in Container class as well as few function's documentation.

The main way of accessing the lesson entries is with the entries() function which allows you to iterate through all the lesson entries (recursively also) and access their properties and modifiy them (see entries() function example code). For individual entry access use the entry(int) function.

To add new entries to a lesson you can use the following ways:

  • newEntry() or newEntry(QStringList) with appendEntry() or insertEntry() function
  • appendNewEntry() function [easiest way]

To remove an entry use the removeEntry() function

Author
Avgoustinos Kadis avgou.nosp@m.stin.nosp@m.os.ka.nosp@m.dis@.nosp@m.kdema.nosp@m.il.n.nosp@m.et

Definition at line 47 of file lesson.h.

Constructor & Destructor Documentation

Scripting::Lesson::Lesson ( KEduVocLesson *  lesson)

Definition at line 24 of file lesson.cpp.

Scripting::Lesson::Lesson ( KEduVocContainer *  container)

Definition at line 29 of file lesson.cpp.

Scripting::Lesson::Lesson ( const QString &  name)

Definition at line 35 of file lesson.cpp.

Scripting::Lesson::~Lesson ( )

Definition at line 42 of file lesson.cpp.

Member Function Documentation

void Scripting::Lesson::appendChildLesson ( Lesson *  child)
inlineslot

Appends a child lesson under the current lesson.

Definition at line 177 of file lesson.h.

void Scripting::Lesson::appendEntry ( Expression *  entry)
slot

Appends an entry at the end of the lesson.

import Parley
lesson = Parley.doc.findLesson("Lesson 2")
if lesson != None:
new_entry = lesson.newEntry(["hello","bonjour"])
lesson.appendEntry(new_entry)
Parameters
entryThe entry to add the lesson

Definition at line 92 of file lesson.cpp.

void Scripting::Lesson::appendNewEntry ( QStringList  translations)
slot

Creates and appends a new entry with the given translations.

#how to add a new entry with appendNewEntry()
import Parley
lesson = Parley.doc.rootLesson
lesson.appendNewEntry(["good morning","bonjour"])
lesson.appendNewEntry(["play","jouer"])
Parameters
translationsA string list with the translations (in same order as their identifiers)

Definition at line 136 of file lesson.cpp.

QObject* Scripting::Lesson::childLesson ( int  row)
inlineslot

Return the child lesson with the corresponding row.

Definition at line 199 of file lesson.h.

QObject* Scripting::Lesson::childLesson ( const QString &  name)
inlineslot

Retrieve a child container by its name Returns 0 if no container is found.

Parameters
namelesson name
Returns
the child lesson

Definition at line 209 of file lesson.h.

int Scripting::Lesson::childLessonCount ( ) const
inlineslot

Returns how many child lessons exist under this lesson.

Definition at line 246 of file lesson.h.

QVariantList Scripting::Lesson::childLessons ( bool  recursive = false)
slot

Returns a list of all the child lessons.

#how to access the all the lessons
import Parley
for lesson in Parley.doc.rootLesson.childLessons(True):
print lesson.name
Parameters
recursiveIf true, then will return the child lessons recursively
Returns
A List with Lesson objects (child lessons)

Definition at line 57 of file lesson.cpp.

void Scripting::Lesson::clearEntries ( )
slot

Removes all the lesson entries (not recursively)

Definition at line 113 of file lesson.cpp.

QVariantList Scripting::Lesson::entries ( bool  recursive = false) const
slot

Returns a list of all the entries of a lesson.

import Parley
entries = Parley.doc.rootLesson.entries(True)
for entry in entries
print entry.translationTexts()
Parameters
recursiveIf true, then will return recursively all the entries below this lesson
Returns
A list of Expression objects (entries)

Definition at line 64 of file lesson.cpp.

QObject * Scripting::Lesson::entry ( int  row,
bool  recursive = false 
)
slot

Returns the entry of the given row.

If recursive is true then it considers all the entries of the sublessons too.

Definition at line 82 of file lesson.cpp.

int Scripting::Lesson::entryCount ( bool  recursive = false)
slot

Returns how many entries are in this lesson (or with sublessons if recursive is true)

Definition at line 87 of file lesson.cpp.

QObject * Scripting::Lesson::findChildLesson ( const QString &  name)
slot

Searches through all the child lessons (recursively) and returns the first lesson the specified name.

#how to search for a lesson
import Parley
lesson = Parley.doc.rootLesson.findChildLesson("Lesson 5")
if lesson != None:
print "found"
print lesson.name
else:
print "not found"
Parameters
nameName of the lesson to look for
Returns
A reference to a lesson if found. 0 otherwise

Definition at line 142 of file lesson.cpp.

void Scripting::Lesson::insertChildLesson ( int  row,
Lesson *  child 
)
inlineslot

Inserts a child lesson (child) on the specified row.

Definition at line 183 of file lesson.h.

void Scripting::Lesson::insertEntry ( int  index,
Expression *  entry 
)
slot

Insert an entry on a specific index.

Parameters
indexIndex where the entry will be added
entryThe entry to add (can be created by newEntry() function)

Definition at line 97 of file lesson.cpp.

QObject * Scripting::Lesson::newEntry ( )
slot

Creates and returns a new Expression Object.

#how to add a new entry
import Parley
lesson = Parley.doc.findLesson("Lesson 2")
if lesson != None:
new_entry = lesson.newEntry()
new_entry.setTranslation(0,"day")
new_entry.setTranslation(0,"jour")
lesson.appendEntry(new_entry)

Definition at line 121 of file lesson.cpp.

QObject * Scripting::Lesson::newEntry ( QStringList  translations)
slot

Creates and returns a new Expression Object.

import Parley
lesson = Parley.doc.findLesson("Lesson 2")
if lesson != None:
new_entry = lesson.newEntry(["hello","bonjour"])
lesson.appendEntry(new_entry)
Parameters
translationsA list with the translations of this entry (must be in correct order)
Returns
A new Expression object

Definition at line 131 of file lesson.cpp.

void Scripting::Lesson::removeChildLesson ( int  row)
inlineslot

Remove child lesson of the specified row.

Definition at line 193 of file lesson.h.

void Scripting::Lesson::removeEntry ( QObject *  entry)
slot

Removes an entry from this lesson.

#how to remove all the entries with the word "play" (from all lessons)
import Parley
for lesson in Parley.doc.allLessons():
for entry in lesson.entries():
for tr in entry.translations():
if tr.text == "play":
lesson.remove(entry)
Parameters
entryA reference to the entry to remove
Note
parameter has to be QObject (tried with Expression * entry but didn't work)

Definition at line 102 of file lesson.cpp.

void Scripting::Lesson::setEntries ( QVariantList  entries)
slot

Definition at line 69 of file lesson.cpp.


The documentation for this class was generated from the following files:
  • lesson.h
  • lesson.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:15:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

parley

Skip menu "parley"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal