Coverage for modules/org/openteacher/interfaces/qt/testMode/teacher/teacher : 51%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#! /usr/bin/env python3 # -*- coding: utf-8 -*-
# Copyright 2011-2012, Milan Boers # Copyright 2011-2012, Marten de Vries # Copyright 2011, Cas Widdershoven # # This file is part of OpenTeacher. # # OpenTeacher is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenTeacher is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with OpenTeacher. If not, see <http://www.gnu.org/licenses/>.
global TeachWidget
super().__init__(*args, **kwargs)
self._mm = moduleManager self._modules = set(self._mm.mods(type="modules")).pop() self._composer = self._modules.default("active", type="wordsStringComposer")
layout = QtWidgets.QVBoxLayout()
self.title = QtWidgets.QLabel() self.title.setStyleSheet("font-size: 18px;") layout.addWidget(self.title)
scrollArea = QtWidgets.QScrollArea()
self.questions = QtWidgets.QFormLayout()
scrollArea.setLayout(self.questions)
layout.addWidget(scrollArea)
self.handInButton = QtWidgets.QPushButton() self.handInButton.clicked.connect(self.lessonDone.emit) layout.addWidget(self.handInButton)
self.setLayout(layout)
self.retranslate()
self.handInButton.setText(_("Hand in answers"))
self.list = list
# Set title self.title.setText(self.list["title"])
self.answerWidgets = []
for item in self.list["items"]: answerWidget = QtWidgets.QLineEdit() self.questions.addRow(self._composer.compose(item["questions"]), answerWidget) self.answerWidgets.append(answerWidget)
# Make copy of list answeredList = copy.copy(self.list)
# Iterate through the answer widgets i = 0; for answerWidget in self.answerWidgets: self.list["items"][i]["answer"] = answerWidget.text()
i += 1
return answeredList
"default": 520, } self._mm.mods(type="translator"), ) self._mm.mods(type="ui"), self._mm.mods(type="wordsStringComposer"), )
tw = TeachWidget(self._mm) self._activeWidgets.add(weakref.ref(tw)) self._retranslate()
return tw
global QtCore, QtWidgets except ImportError: return
else:
#Translations global _ global ngettext
else: self._mm.resourcePath("translations") )
r = widget() if r is not None: r.retranslate()
|