示例#1
0
class Ui_ProblemSeries(object):
    def setupUi(self, ProblemSeries):
        ProblemSeries.setObjectName("ProblemSeries")
        ProblemSeries.resize(865, 460)
        self.verticalLayout = QtWidgets.QVBoxLayout(ProblemSeries)
        self.verticalLayout.setObjectName("verticalLayout")
        self.title = QtWidgets.QLabel(ProblemSeries)
        font = QtGui.QFont()
        font.setPointSize(28)
        font.setBold(False)
        font.setWeight(50)
        font.setKerning(True)
        self.title.setFont(font)
        self.title.setAlignment(QtCore.Qt.AlignCenter)
        self.title.setObjectName("title")
        self.verticalLayout.addWidget(self.title)
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.score = QtWidgets.QLabel(ProblemSeries)
        self.score.setObjectName("score")
        self.horizontalLayout_5.addWidget(self.score)
        self.score_percent = QtWidgets.QLabel(ProblemSeries)
        self.score_percent.setAlignment(QtCore.Qt.AlignRight
                                        | QtCore.Qt.AlignTrailing
                                        | QtCore.Qt.AlignVCenter)
        self.score_percent.setObjectName("score_percent")
        self.horizontalLayout_5.addWidget(self.score_percent)
        self.verticalLayout.addLayout(self.horizontalLayout_5)
        self.frame = QtWidgets.QFrame(ProblemSeries)
        self.frame.setStyleSheet(
            "QWidget#frame {background-color: rgb(192, 192, 192);}")
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Plain)
        self.frame.setLineWidth(3)
        self.frame.setObjectName("frame")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.problem_frame = QtWidgets.QFrame(self.frame)
        self.problem_frame.setStyleSheet(
            "background-color: rgb(255, 255, 255);")
        self.problem_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.problem_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.problem_frame.setObjectName("problem_frame")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.problem_frame)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.problem = QSvgWidget(self.problem_frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.problem.sizePolicy().hasHeightForWidth())
        self.problem.setSizePolicy(sizePolicy)
        self.problem.setObjectName("problem")
        self.verticalLayout_4.addWidget(self.problem)
        self.verticalLayout_2.addWidget(self.problem_frame)
        self.answer_frame = QtWidgets.QFrame(self.frame)
        self.answer_frame.setStyleSheet(
            "background-color: rgb(255, 255, 255);")
        self.answer_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.answer_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.answer_frame.setObjectName("answer_frame")
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.answer_frame)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.button_converge = QtWidgets.QRadioButton(self.answer_frame)
        self.button_converge.setChecked(True)
        self.button_converge.setObjectName("button_converge")
        self.horizontalLayout_3.addWidget(self.button_converge)
        self.button_diverge = QtWidgets.QRadioButton(self.answer_frame)
        self.button_diverge.setObjectName("button_diverge")
        self.horizontalLayout_3.addWidget(self.button_diverge)
        self.horizontalLayout_4.addLayout(self.horizontalLayout_3)
        self.verticalLayout_2.addWidget(self.answer_frame)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.button_new = QtWidgets.QPushButton(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.button_new.sizePolicy().hasHeightForWidth())
        self.button_new.setSizePolicy(sizePolicy)
        self.button_new.setObjectName("button_new")
        self.horizontalLayout.addWidget(self.button_new)
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.button_check = QtWidgets.QPushButton(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.button_check.sizePolicy().hasHeightForWidth())
        self.button_check.setSizePolicy(sizePolicy)
        self.button_check.setObjectName("button_check")
        self.horizontalLayout.addWidget(self.button_check)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.verticalLayout_2.setStretch(0, 1)
        self.verticalLayout.addWidget(self.frame)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.button_back = QtWidgets.QPushButton(ProblemSeries)
        self.button_back.setObjectName("button_back")
        self.horizontalLayout_2.addWidget(self.button_back)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem1)
        self.button_help = QtWidgets.QPushButton(ProblemSeries)
        self.button_help.setObjectName("button_help")
        self.horizontalLayout_2.addWidget(self.button_help)
        spacerItem2 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem2)
        self.button_home = QtWidgets.QPushButton(ProblemSeries)
        self.button_home.setObjectName("button_home")
        self.horizontalLayout_2.addWidget(self.button_home)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(ProblemSeries)
        QtCore.QMetaObject.connectSlotsByName(ProblemSeries)

    def retranslateUi(self, ProblemSeries):
        _translate = QtCore.QCoreApplication.translate
        ProblemSeries.setWindowTitle(_translate("ProblemSeries", "Form"))
        self.title.setText(_translate("ProblemSeries", "Problems"))
        self.score.setText(_translate("ProblemSeries", "Score: 0/0"))
        self.score_percent.setText(_translate("ProblemSeries", "0%"))
        self.button_converge.setText(_translate("ProblemSeries", "Converges"))
        self.button_diverge.setText(_translate("ProblemSeries", "Diverges"))
        self.button_new.setText(_translate("ProblemSeries", "New"))
        self.button_check.setText(_translate("ProblemSeries", "Check"))
        self.button_back.setText(_translate("ProblemSeries", "Back"))
        self.button_help.setText(_translate("ProblemSeries", "Help"))
        self.button_home.setText(_translate("ProblemSeries", "Home"))
示例#2
0
class Ui_Graph(object):
    def setupUi(self, Graph):
        Graph.setObjectName("Graph")
        Graph.resize(780, 467)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(Graph)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.title = QtWidgets.QLabel(Graph)
        font = QtGui.QFont()
        font.setPointSize(28)
        font.setBold(False)
        font.setWeight(50)
        font.setKerning(True)
        self.title.setFont(font)
        self.title.setAlignment(QtCore.Qt.AlignCenter)
        self.title.setObjectName("title")
        self.verticalLayout.addWidget(self.title)
        self.frame = QtWidgets.QFrame(Graph)
        self.frame.setStyleSheet("QWidget#frame {background-color: rgb(192, 192, 192);}")
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Plain)
        self.frame.setLineWidth(3)
        self.frame.setObjectName("frame")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.frame_2 = QtWidgets.QFrame(self.frame)
        self.frame_2.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_2.setObjectName("frame_2")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.frame_2)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.graph = QSvgWidget(self.frame_2)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.graph.sizePolicy().hasHeightForWidth())
        self.graph.setSizePolicy(sizePolicy)
        self.graph.setObjectName("graph")
        self.verticalLayout_4.addWidget(self.graph)
        self.verticalLayout_2.addWidget(self.frame_2)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.label = QtWidgets.QLabel(self.frame)
        self.label.setObjectName("label")
        self.horizontalLayout_3.addWidget(self.label)
        self.function_entry = QtWidgets.QLineEdit(self.frame)
        self.function_entry.setObjectName("function_entry")
        self.horizontalLayout_3.addWidget(self.function_entry)
        self.button_window = QtWidgets.QPushButton(self.frame)
        self.button_window.setObjectName("button_window")
        self.horizontalLayout_3.addWidget(self.button_window)
        self.verticalLayout_2.addLayout(self.horizontalLayout_3)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.check_zeroes = QtWidgets.QCheckBox(self.frame)
        self.check_zeroes.setObjectName("check_zeroes")
        self.horizontalLayout.addWidget(self.check_zeroes)
        self.check_extrema = QtWidgets.QCheckBox(self.frame)
        self.check_extrema.setObjectName("check_extrema")
        self.horizontalLayout.addWidget(self.check_extrema)
        self.check_inflection = QtWidgets.QCheckBox(self.frame)
        self.check_inflection.setObjectName("check_inflection")
        self.horizontalLayout.addWidget(self.check_inflection)
        self.check_derivative = QtWidgets.QCheckBox(self.frame)
        self.check_derivative.setObjectName("check_derivative")
        self.horizontalLayout.addWidget(self.check_derivative)
        self.check_integral = QtWidgets.QCheckBox(self.frame)
        self.check_integral.setObjectName("check_integral")
        self.horizontalLayout.addWidget(self.check_integral)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.verticalLayout_2.setStretch(0, 1)
        self.verticalLayout.addWidget(self.frame)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.button_back = QtWidgets.QPushButton(Graph)
        self.button_back.setObjectName("button_back")
        self.horizontalLayout_2.addWidget(self.button_back)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem)
        self.button_help = QtWidgets.QPushButton(Graph)
        self.button_help.setObjectName("button_help")
        self.horizontalLayout_2.addWidget(self.button_help)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem1)
        self.button_home = QtWidgets.QPushButton(Graph)
        self.button_home.setObjectName("button_home")
        self.horizontalLayout_2.addWidget(self.button_home)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.verticalLayout_3.addLayout(self.verticalLayout)

        self.retranslateUi(Graph)
        QtCore.QMetaObject.connectSlotsByName(Graph)

    def retranslateUi(self, Graph):
        _translate = QtCore.QCoreApplication.translate
        Graph.setWindowTitle(_translate("Graph", "Form"))
        self.title.setText(_translate("Graph", "Graph"))
        self.label.setText(_translate("Graph", "f(x)="))
        self.button_window.setText(_translate("Graph", "Set Window"))
        self.check_zeroes.setText(_translate("Graph", "Zeroes"))
        self.check_extrema.setText(_translate("Graph", "Extrema"))
        self.check_inflection.setText(_translate("Graph", "Inflection Points"))
        self.check_derivative.setText(_translate("Graph", "Derivative"))
        self.check_integral.setText(_translate("Graph", "Integral"))
        self.button_back.setText(_translate("Graph", "Back"))
        self.button_help.setText(_translate("Graph", "Help"))
        self.button_home.setText(_translate("Graph", "Home"))
示例#3
0
class SvgDiagram(E5MainWindow):
    """
    Class implementing a dialog showing a SVG graphic.
    """
    ZoomLevels = [
        1, 3, 5, 7, 9,
        10, 20, 30, 50, 67, 80, 90,
        100,
        110, 120, 133, 150, 170, 200, 240, 300, 400,
        500, 600, 700, 800, 900, 1000,
    ]
    ZoomLevelDefault = 100
    
    def __init__(self, svgFile, parent=None, name=None):
        """
        Constructor
        
        @param svgFile filename of a SVG graphics file to show (string)
        @param parent parent widget of the view (QWidget)
        @param name name of the view widget (string)
        """
        super(SvgDiagram, self).__init__(parent)
        if name:
            self.setObjectName(name)
        else:
            self.setObjectName("SvgDiagram")
        self.setWindowTitle(self.tr("SVG-Viewer"))
        
        self.svgWidget = QSvgWidget()
        self.svgWidget.setObjectName("svgWidget")
        self.svgWidget.setBackgroundRole(QPalette.Base)
        self.svgWidget.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        
        self.svgView = QScrollArea()
        self.svgView.setObjectName("svgView")
        self.svgView.setBackgroundRole(QPalette.Dark)
        self.svgView.setWidget(self.svgWidget)
        
        self.setCentralWidget(self.svgView)
        
        self.__zoomWidget = E5ZoomWidget(
            UI.PixmapCache.getPixmap("zoomOut.png"),
            UI.PixmapCache.getPixmap("zoomIn.png"),
            UI.PixmapCache.getPixmap("zoomReset.png"), self)
        self.statusBar().addPermanentWidget(self.__zoomWidget)
        self.__zoomWidget.setMapping(
            SvgDiagram.ZoomLevels, SvgDiagram.ZoomLevelDefault)
        self.__zoomWidget.valueChanged.connect(self.__doZoom)
        
        # polish up the dialog
        self.resize(QSize(800, 600).expandedTo(self.minimumSizeHint()))
        
        self.zoom = 1.0
        self.svgFile = svgFile
        self.svgWidget.load(self.svgFile)
        self.svgWidget.resize(self.svgWidget.renderer().defaultSize())
        
        self.__initActions()
        self.__initContextMenu()
        self.__initToolBars()
        
        self.grabGesture(Qt.PinchGesture)
        
    def __initActions(self):
        """
        Private method to initialize the view actions.
        """
        self.closeAct = \
            QAction(UI.PixmapCache.getIcon("close.png"),
                    self.tr("Close"), self)
        self.closeAct.triggered.connect(self.close)
        
        self.printAct = \
            QAction(UI.PixmapCache.getIcon("print.png"),
                    self.tr("Print"), self)
        self.printAct.triggered.connect(self.__printDiagram)
        
        self.printPreviewAct = \
            QAction(UI.PixmapCache.getIcon("printPreview.png"),
                    self.tr("Print Preview"), self)
        self.printPreviewAct.triggered.connect(self.__printPreviewDiagram)
        
    def __initContextMenu(self):
        """
        Private method to initialize the context menu.
        """
        self.__menu = QMenu(self)
        self.__menu.addAction(self.closeAct)
        self.__menu.addSeparator()
        self.__menu.addAction(self.printPreviewAct)
        self.__menu.addAction(self.printAct)
        
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.__showContextMenu)
        
    def __showContextMenu(self, coord):
        """
        Private slot to show the context menu of the listview.
        
        @param coord the position of the mouse pointer (QPoint)
        """
        self.__menu.popup(self.mapToGlobal(coord))
        
    def __initToolBars(self):
        """
        Private method to populate the toolbars with our actions.
        """
        self.windowToolBar = QToolBar(self.tr("Window"), self)
        self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize)
        self.windowToolBar.addAction(self.closeAct)
        
        self.graphicsToolBar = QToolBar(self.tr("Graphics"), self)
        self.graphicsToolBar.setIconSize(UI.Config.ToolBarIconSize)
        self.graphicsToolBar.addAction(self.printPreviewAct)
        self.graphicsToolBar.addAction(self.printAct)
        
        self.addToolBar(Qt.TopToolBarArea, self.windowToolBar)
        self.addToolBar(Qt.TopToolBarArea, self.graphicsToolBar)
        
    def getDiagramName(self):
        """
        Public method to retrieve a name for the diagram.
        
        @return name for the diagram
        """
        return self.svgFile
    
    def wheelEvent(self, evt):
        """
        Protected method to handle wheel events.
        
        @param evt reference to the wheel event (QWheelEvent)
        """
        if evt.modifiers() & Qt.ControlModifier:
            if qVersion() >= "5.0.0":
                delta = evt.angleDelta().y()
            else:
                delta = evt.delta()
            if delta < 0:
                self.__zoomOut()
            else:
                self.__zoomIn()
            evt.accept()
            return
        
        super(SvgDiagram, self).wheelEvent(evt)
    
    def event(self, evt):
        """
        Public method handling events.
        
        @param evt reference to the event (QEvent)
        @return flag indicating, if the event was handled (boolean)
        """
        if evt.type() == QEvent.Gesture:
            self.gestureEvent(evt)
            return True
        
        return super(SvgDiagram, self).event(evt)
    
    def gestureEvent(self, evt):
        """
        Protected method handling gesture events.
        
        @param evt reference to the gesture event (QGestureEvent
        """
        pinch = evt.gesture(Qt.PinchGesture)
        if pinch:
            if pinch.state() == Qt.GestureStarted:
                pinch.setScaleFactor(self.__zoom() / 100)
            else:
                self.__doZoom(int(pinch.scaleFactor() * 100))
            evt.accept()
    
    ###########################################################################
    ## Private menu handling methods below.
    ###########################################################################
    
    def __adjustScrollBar(self, scrollBar, factor):
        """
        Private method to adjust a scrollbar by a certain factor.
        
        @param scrollBar reference to the scrollbar object (QScrollBar)
        @param factor factor to adjust by (float)
        """
        scrollBar.setValue(
            int(factor * scrollBar.value() +
                ((factor - 1) * scrollBar.pageStep() / 2)))
        
    def __levelForZoom(self, zoom):
        """
        Private method determining the zoom level index given a zoom factor.
        
        @param zoom zoom factor (integer)
        @return index of zoom factor (integer)
        """
        try:
            index = SvgDiagram.ZoomLevels.index(zoom)
        except ValueError:
            for index in range(len(SvgDiagram.ZoomLevels)):
                if zoom <= SvgDiagram.ZoomLevels[index]:
                    break
        return index
    
    def __doZoom(self, value):
        """
        Private method to set the zoom value in percent.
        
        @param value zoom value in percent (integer)
        """
        oldValue = self.__zoom()
        if value != oldValue:
            self.svgWidget.resize(value / 100 * self.svgWidget.sizeHint())
            
            factor = value / oldValue
            self.__adjustScrollBar(self.svgView.horizontalScrollBar(), factor)
            self.__adjustScrollBar(self.svgView.verticalScrollBar(), factor)
            
            self.__zoomWidget.setValue(value)
        
    def __zoomIn(self):
        """
        Private method to zoom into the SVG.
        """
        index = self.__levelForZoom(self.__zoom())
        if index < len(SvgDiagram.ZoomLevels) - 1:
            self.__doZoom(SvgDiagram.ZoomLevels[index + 1])
        
    def __zoomOut(self):
        """
        Private method to zoom out of the SVG.
        """
        index = self.__levelForZoom(self.__zoom())
        if index > 0:
            self.__doZoom(SvgDiagram.ZoomLevels[index - 1])
        
    def __zoomReset(self):
        """
        Private method to reset the zoom value.
        """
        self.__doZoom(SvgDiagram.ZoomLevels[SvgDiagram.ZoomLevelDefault])
        
    def __zoom(self):
        """
        Private method to get the current zoom factor in percent.
        
        @return current zoom factor in percent (integer)
        """
        return int(self.svgWidget.width() /
                   self.svgWidget.sizeHint().width() * 100.0)
        
    def __printDiagram(self):
        """
        Private slot called to print the diagram.
        """
        printer = QPrinter(mode=QPrinter.ScreenResolution)
        printer.setFullPage(True)
        if Preferences.getPrinter("ColorMode"):
            printer.setColorMode(QPrinter.Color)
        else:
            printer.setColorMode(QPrinter.GrayScale)
        if Preferences.getPrinter("FirstPageFirst"):
            printer.setPageOrder(QPrinter.FirstPageFirst)
        else:
            printer.setPageOrder(QPrinter.LastPageFirst)
        printerName = Preferences.getPrinter("PrinterName")
        if printerName:
            printer.setPrinterName(printerName)
        
        printDialog = QPrintDialog(printer, self)
        if printDialog.exec_():
            self.__print(printer)
        
    def __printPreviewDiagram(self):
        """
        Private slot called to show a print preview of the diagram.
        """
        from PyQt5.QtPrintSupport import QPrintPreviewDialog
        
        printer = QPrinter(mode=QPrinter.ScreenResolution)
        printer.setFullPage(True)
        if Preferences.getPrinter("ColorMode"):
            printer.setColorMode(QPrinter.Color)
        else:
            printer.setColorMode(QPrinter.GrayScale)
        if Preferences.getPrinter("FirstPageFirst"):
            printer.setPageOrder(QPrinter.FirstPageFirst)
        else:
            printer.setPageOrder(QPrinter.LastPageFirst)
        printer.setPageMargins(
            Preferences.getPrinter("LeftMargin") * 10,
            Preferences.getPrinter("TopMargin") * 10,
            Preferences.getPrinter("RightMargin") * 10,
            Preferences.getPrinter("BottomMargin") * 10,
            QPrinter.Millimeter
        )
        printerName = Preferences.getPrinter("PrinterName")
        if printerName:
            printer.setPrinterName(printerName)
        
        preview = QPrintPreviewDialog(printer, self)
        preview.paintRequested[QPrinter].connect(self.__print)
        preview.exec_()
        
    def __print(self, printer):
        """
        Private slot to the actual printing.
        
        @param printer reference to the printer object (QPrinter)
        """
        painter = QPainter()
        painter.begin(printer)

        # calculate margin and width of printout
        font = QFont("times", 10)
        painter.setFont(font)
        fm = painter.fontMetrics()
        fontHeight = fm.lineSpacing()
        marginX = printer.pageRect().x() - printer.paperRect().x()
        marginX = Preferences.getPrinter("LeftMargin") * \
            int(printer.resolution() / 2.54) - marginX
        marginY = printer.pageRect().y() - printer.paperRect().y()
        marginY = Preferences.getPrinter("TopMargin") * \
            int(printer.resolution() / 2.54) - marginY

        width = printer.width() - marginX - \
            Preferences.getPrinter("RightMargin") * \
            int(printer.resolution() / 2.54)
        height = printer.height() - fontHeight - 4 - marginY - \
            Preferences.getPrinter("BottomMargin") * \
            int(printer.resolution() / 2.54)

        # write a foot note
        s = self.tr("Diagram: {0}").format(self.getDiagramName())
        tc = QColor(50, 50, 50)
        painter.setPen(tc)
        painter.drawRect(marginX, marginY, width, height)
        painter.drawLine(marginX, marginY + height + 2,
                         marginX + width, marginY + height + 2)
        painter.setFont(font)
        painter.drawText(marginX, marginY + height + 4, width,
                         fontHeight, Qt.AlignRight, s)

        # render the diagram
        painter.setViewport(marginX, marginY, width, height)
        self.svgWidget.renderer().render(painter)
        painter.end()
class Ui_Flashcards(object):
    def setupUi(self, Flashcards):
        Flashcards.setObjectName("Flashcards")
        Flashcards.resize(763, 383)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(Flashcards)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.title = QtWidgets.QLabel(Flashcards)
        font = QtGui.QFont()
        font.setPointSize(28)
        font.setBold(False)
        font.setWeight(50)
        font.setKerning(True)
        self.title.setFont(font)
        self.title.setAlignment(QtCore.Qt.AlignCenter)
        self.title.setObjectName("title")
        self.verticalLayout.addWidget(self.title)
        self.frame = QtWidgets.QFrame(Flashcards)
        self.frame.setStyleSheet(
            "QWidget#frame {background-color: rgb(192, 192, 192);}")
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Plain)
        self.frame.setLineWidth(3)
        self.frame.setObjectName("frame")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.frame_2 = QtWidgets.QFrame(self.frame)
        self.frame_2.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_2.setObjectName("frame_2")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.frame_2)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.flashcard = QSvgWidget(self.frame_2)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.flashcard.sizePolicy().hasHeightForWidth())
        self.flashcard.setSizePolicy(sizePolicy)
        self.flashcard.setObjectName("flashcard")
        self.verticalLayout_4.addWidget(self.flashcard)
        self.verticalLayout_2.addWidget(self.frame_2)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.button_previous = QtWidgets.QPushButton(self.frame)
        self.button_previous.setObjectName("button_previous")
        self.horizontalLayout_3.addWidget(self.button_previous)
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem)
        self.button_edit = QtWidgets.QPushButton(self.frame)
        self.button_edit.setObjectName("button_edit")
        self.horizontalLayout_3.addWidget(self.button_edit)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem1)
        self.check_random = QtWidgets.QCheckBox(self.frame)
        self.check_random.setObjectName("check_random")
        self.horizontalLayout_3.addWidget(self.check_random)
        spacerItem2 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem2)
        self.button_flip = QtWidgets.QPushButton(self.frame)
        self.button_flip.setObjectName("button_flip")
        self.horizontalLayout_3.addWidget(self.button_flip)
        spacerItem3 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem3)
        self.button_next = QtWidgets.QPushButton(self.frame)
        self.button_next.setObjectName("button_next")
        self.horizontalLayout_3.addWidget(self.button_next)
        self.verticalLayout_2.addLayout(self.horizontalLayout_3)
        self.verticalLayout_2.setStretch(0, 1)
        self.verticalLayout.addWidget(self.frame)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.button_back = QtWidgets.QPushButton(Flashcards)
        self.button_back.setObjectName("button_back")
        self.horizontalLayout_2.addWidget(self.button_back)
        spacerItem4 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem4)
        self.button_help = QtWidgets.QPushButton(Flashcards)
        self.button_help.setObjectName("button_help")
        self.horizontalLayout_2.addWidget(self.button_help)
        spacerItem5 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem5)
        self.button_home = QtWidgets.QPushButton(Flashcards)
        self.button_home.setObjectName("button_home")
        self.horizontalLayout_2.addWidget(self.button_home)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.verticalLayout_3.addLayout(self.verticalLayout)

        self.retranslateUi(Flashcards)
        QtCore.QMetaObject.connectSlotsByName(Flashcards)

    def retranslateUi(self, Flashcards):
        _translate = QtCore.QCoreApplication.translate
        Flashcards.setWindowTitle(_translate("Flashcards", "Form"))
        self.title.setText(_translate("Flashcards", "Flashcards"))
        self.button_previous.setText(_translate("Flashcards", "Previous"))
        self.button_edit.setText(_translate("Flashcards", "Edit Set"))
        self.check_random.setText(_translate("Flashcards", "Random Order"))
        self.button_flip.setText(_translate("Flashcards", "Flip Card"))
        self.button_next.setText(_translate("Flashcards", "Next"))
        self.button_back.setText(_translate("Flashcards", "Back"))
        self.button_help.setText(_translate("Flashcards", "Help"))
        self.button_home.setText(_translate("Flashcards", "Home"))
示例#5
0
class SvgDiagram(E5MainWindow):
    """
    Class implementing a dialog showing a SVG graphic.
    """
    ZoomLevels = [
        1,
        3,
        5,
        7,
        9,
        10,
        20,
        30,
        50,
        67,
        80,
        90,
        100,
        110,
        120,
        133,
        150,
        170,
        200,
        240,
        300,
        400,
        500,
        600,
        700,
        800,
        900,
        1000,
    ]
    ZoomLevelDefault = 100

    def __init__(self, svgFile, parent=None, name=None):
        """
        Constructor
        
        @param svgFile filename of a SVG graphics file to show (string)
        @param parent parent widget of the view (QWidget)
        @param name name of the view widget (string)
        """
        super(SvgDiagram, self).__init__(parent)
        if name:
            self.setObjectName(name)
        else:
            self.setObjectName("SvgDiagram")
        self.setWindowTitle(self.tr("SVG-Viewer"))

        self.svgWidget = QSvgWidget()
        self.svgWidget.setObjectName("svgWidget")
        self.svgWidget.setBackgroundRole(QPalette.Base)
        self.svgWidget.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)

        self.svgView = QScrollArea()
        self.svgView.setObjectName("svgView")
        self.svgView.setBackgroundRole(QPalette.Dark)
        self.svgView.setWidget(self.svgWidget)

        self.setCentralWidget(self.svgView)

        self.__zoomWidget = E5ZoomWidget(
            UI.PixmapCache.getPixmap("zoomOut.png"),
            UI.PixmapCache.getPixmap("zoomIn.png"),
            UI.PixmapCache.getPixmap("zoomReset.png"), self)
        self.statusBar().addPermanentWidget(self.__zoomWidget)
        self.__zoomWidget.setMapping(SvgDiagram.ZoomLevels,
                                     SvgDiagram.ZoomLevelDefault)
        self.__zoomWidget.valueChanged.connect(self.__doZoom)

        # polish up the dialog
        self.resize(QSize(800, 600).expandedTo(self.minimumSizeHint()))

        self.zoom = 1.0
        self.svgFile = svgFile
        self.svgWidget.load(self.svgFile)
        self.svgWidget.resize(self.svgWidget.renderer().defaultSize())

        self.__initActions()
        self.__initContextMenu()
        self.__initToolBars()

        self.grabGesture(Qt.PinchGesture)

    def __initActions(self):
        """
        Private method to initialize the view actions.
        """
        self.closeAct = \
            QAction(UI.PixmapCache.getIcon("close.png"),
                    self.tr("Close"), self)
        self.closeAct.triggered.connect(self.close)

        self.printAct = \
            QAction(UI.PixmapCache.getIcon("print.png"),
                    self.tr("Print"), self)
        self.printAct.triggered.connect(self.__printDiagram)

        self.printPreviewAct = \
            QAction(UI.PixmapCache.getIcon("printPreview.png"),
                    self.tr("Print Preview"), self)
        self.printPreviewAct.triggered.connect(self.__printPreviewDiagram)

    def __initContextMenu(self):
        """
        Private method to initialize the context menu.
        """
        self.__menu = QMenu(self)
        self.__menu.addAction(self.closeAct)
        self.__menu.addSeparator()
        self.__menu.addAction(self.printPreviewAct)
        self.__menu.addAction(self.printAct)

        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.__showContextMenu)

    def __showContextMenu(self, coord):
        """
        Private slot to show the context menu of the listview.
        
        @param coord the position of the mouse pointer (QPoint)
        """
        self.__menu.popup(self.mapToGlobal(coord))

    def __initToolBars(self):
        """
        Private method to populate the toolbars with our actions.
        """
        self.windowToolBar = QToolBar(self.tr("Window"), self)
        self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize)
        self.windowToolBar.addAction(self.closeAct)

        self.graphicsToolBar = QToolBar(self.tr("Graphics"), self)
        self.graphicsToolBar.setIconSize(UI.Config.ToolBarIconSize)
        self.graphicsToolBar.addAction(self.printPreviewAct)
        self.graphicsToolBar.addAction(self.printAct)

        self.addToolBar(Qt.TopToolBarArea, self.windowToolBar)
        self.addToolBar(Qt.TopToolBarArea, self.graphicsToolBar)

    def getDiagramName(self):
        """
        Public method to retrieve a name for the diagram.
        
        @return name for the diagram
        """
        return self.svgFile

    def wheelEvent(self, evt):
        """
        Protected method to handle wheel events.
        
        @param evt reference to the wheel event (QWheelEvent)
        """
        if evt.modifiers() & Qt.ControlModifier:
            if qVersion() >= "5.0.0":
                delta = evt.angleDelta().y()
            else:
                delta = evt.delta()
            if delta < 0:
                self.__zoomOut()
            else:
                self.__zoomIn()
            evt.accept()
            return

        super(SvgDiagram, self).wheelEvent(evt)

    def event(self, evt):
        """
        Public method handling events.
        
        @param evt reference to the event (QEvent)
        @return flag indicating, if the event was handled (boolean)
        """
        if evt.type() == QEvent.Gesture:
            self.gestureEvent(evt)
            return True

        return super(SvgDiagram, self).event(evt)

    def gestureEvent(self, evt):
        """
        Protected method handling gesture events.
        
        @param evt reference to the gesture event (QGestureEvent
        """
        pinch = evt.gesture(Qt.PinchGesture)
        if pinch:
            if pinch.state() == Qt.GestureStarted:
                pinch.setScaleFactor(self.__zoom() / 100)
            else:
                self.__doZoom(int(pinch.scaleFactor() * 100))
            evt.accept()

    ###########################################################################
    ## Private menu handling methods below.
    ###########################################################################

    def __adjustScrollBar(self, scrollBar, factor):
        """
        Private method to adjust a scrollbar by a certain factor.
        
        @param scrollBar reference to the scrollbar object (QScrollBar)
        @param factor factor to adjust by (float)
        """
        scrollBar.setValue(
            int(factor * scrollBar.value() +
                ((factor - 1) * scrollBar.pageStep() / 2)))

    def __levelForZoom(self, zoom):
        """
        Private method determining the zoom level index given a zoom factor.
        
        @param zoom zoom factor (integer)
        @return index of zoom factor (integer)
        """
        try:
            index = SvgDiagram.ZoomLevels.index(zoom)
        except ValueError:
            for index in range(len(SvgDiagram.ZoomLevels)):
                if zoom <= SvgDiagram.ZoomLevels[index]:
                    break
        return index

    def __doZoom(self, value):
        """
        Private method to set the zoom value in percent.
        
        @param value zoom value in percent (integer)
        """
        oldValue = self.__zoom()
        if value != oldValue:
            self.svgWidget.resize(value / 100 * self.svgWidget.sizeHint())

            factor = value / oldValue
            self.__adjustScrollBar(self.svgView.horizontalScrollBar(), factor)
            self.__adjustScrollBar(self.svgView.verticalScrollBar(), factor)

            self.__zoomWidget.setValue(value)

    def __zoomIn(self):
        """
        Private method to zoom into the SVG.
        """
        index = self.__levelForZoom(self.__zoom())
        if index < len(SvgDiagram.ZoomLevels) - 1:
            self.__doZoom(SvgDiagram.ZoomLevels[index + 1])

    def __zoomOut(self):
        """
        Private method to zoom out of the SVG.
        """
        index = self.__levelForZoom(self.__zoom())
        if index > 0:
            self.__doZoom(SvgDiagram.ZoomLevels[index - 1])

    def __zoomReset(self):
        """
        Private method to reset the zoom value.
        """
        self.__doZoom(SvgDiagram.ZoomLevels[SvgDiagram.ZoomLevelDefault])

    def __zoom(self):
        """
        Private method to get the current zoom factor in percent.
        
        @return current zoom factor in percent (integer)
        """
        return int(self.svgWidget.width() / self.svgWidget.sizeHint().width() *
                   100.0)

    def __printDiagram(self):
        """
        Private slot called to print the diagram.
        """
        printer = QPrinter(mode=QPrinter.ScreenResolution)
        printer.setFullPage(True)
        if Preferences.getPrinter("ColorMode"):
            printer.setColorMode(QPrinter.Color)
        else:
            printer.setColorMode(QPrinter.GrayScale)
        if Preferences.getPrinter("FirstPageFirst"):
            printer.setPageOrder(QPrinter.FirstPageFirst)
        else:
            printer.setPageOrder(QPrinter.LastPageFirst)
        printerName = Preferences.getPrinter("PrinterName")
        if printerName:
            printer.setPrinterName(printerName)

        printDialog = QPrintDialog(printer, self)
        if printDialog.exec_():
            self.__print(printer)

    def __printPreviewDiagram(self):
        """
        Private slot called to show a print preview of the diagram.
        """
        from PyQt5.QtPrintSupport import QPrintPreviewDialog

        printer = QPrinter(mode=QPrinter.ScreenResolution)
        printer.setFullPage(True)
        if Preferences.getPrinter("ColorMode"):
            printer.setColorMode(QPrinter.Color)
        else:
            printer.setColorMode(QPrinter.GrayScale)
        if Preferences.getPrinter("FirstPageFirst"):
            printer.setPageOrder(QPrinter.FirstPageFirst)
        else:
            printer.setPageOrder(QPrinter.LastPageFirst)
        printer.setPageMargins(
            Preferences.getPrinter("LeftMargin") * 10,
            Preferences.getPrinter("TopMargin") * 10,
            Preferences.getPrinter("RightMargin") * 10,
            Preferences.getPrinter("BottomMargin") * 10, QPrinter.Millimeter)
        printerName = Preferences.getPrinter("PrinterName")
        if printerName:
            printer.setPrinterName(printerName)

        preview = QPrintPreviewDialog(printer, self)
        preview.paintRequested[QPrinter].connect(self.__print)
        preview.exec_()

    def __print(self, printer):
        """
        Private slot to the actual printing.
        
        @param printer reference to the printer object (QPrinter)
        """
        painter = QPainter()
        painter.begin(printer)

        # calculate margin and width of printout
        font = QFont("times", 10)
        painter.setFont(font)
        fm = painter.fontMetrics()
        fontHeight = fm.lineSpacing()
        marginX = printer.pageRect().x() - printer.paperRect().x()
        marginX = Preferences.getPrinter("LeftMargin") * \
            int(printer.resolution() / 2.54) - marginX
        marginY = printer.pageRect().y() - printer.paperRect().y()
        marginY = Preferences.getPrinter("TopMargin") * \
            int(printer.resolution() / 2.54) - marginY

        width = printer.width() - marginX - \
            Preferences.getPrinter("RightMargin") * \
            int(printer.resolution() / 2.54)
        height = printer.height() - fontHeight - 4 - marginY - \
            Preferences.getPrinter("BottomMargin") * \
            int(printer.resolution() / 2.54)

        # write a foot note
        s = self.tr("Diagram: {0}").format(self.getDiagramName())
        tc = QColor(50, 50, 50)
        painter.setPen(tc)
        painter.drawRect(marginX, marginY, width, height)
        painter.drawLine(marginX, marginY + height + 2, marginX + width,
                         marginY + height + 2)
        painter.setFont(font)
        painter.drawText(marginX, marginY + height + 4, width, fontHeight,
                         Qt.AlignRight, s)

        # render the diagram
        painter.setViewport(marginX, marginY, width, height)
        self.svgWidget.renderer().render(painter)
        painter.end()
示例#6
0
class Ui_Calculator(object):
    def setupUi(self, Calculator):
        Calculator.setObjectName("Calculator")
        Calculator.resize(1147, 654)
        self.verticalLayout = QtWidgets.QVBoxLayout(Calculator)
        self.verticalLayout.setObjectName("verticalLayout")
        self.title = QtWidgets.QLabel(Calculator)
        font = QtGui.QFont()
        font.setPointSize(28)
        font.setBold(False)
        font.setWeight(50)
        font.setKerning(True)
        self.title.setFont(font)
        self.title.setAlignment(QtCore.Qt.AlignCenter)
        self.title.setObjectName("title")
        self.verticalLayout.addWidget(self.title)
        self.frame = QtWidgets.QFrame(Calculator)
        self.frame.setStyleSheet(
            "QWidget#frame {background-color: rgb(192, 192, 192);}")
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Plain)
        self.frame.setLineWidth(3)
        self.frame.setObjectName("frame")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.output_frame = QtWidgets.QFrame(self.frame)
        self.output_frame.setStyleSheet(
            "background-color: rgb(255, 255, 255);")
        self.output_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.output_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.output_frame.setObjectName("output_frame")
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.output_frame)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.input = QSvgWidget(self.output_frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.input.sizePolicy().hasHeightForWidth())
        self.input.setSizePolicy(sizePolicy)
        self.input.setObjectName("input")
        self.verticalLayout_3.addWidget(self.input)
        self.verticalLayout_2.addWidget(self.output_frame)
        self.input_frame = QtWidgets.QFrame(self.frame)
        self.input_frame.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.input_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.input_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.input_frame.setObjectName("input_frame")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.input_frame)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.output = QSvgWidget(self.input_frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.output.sizePolicy().hasHeightForWidth())
        self.output.setSizePolicy(sizePolicy)
        self.output.setObjectName("output")
        self.verticalLayout_4.addWidget(self.output)
        self.verticalLayout_2.addWidget(self.input_frame)
        self.verticalLayout_10 = QtWidgets.QVBoxLayout()
        self.verticalLayout_10.setSizeConstraint(
            QtWidgets.QLayout.SetDefaultConstraint)
        self.verticalLayout_10.setObjectName("verticalLayout_10")
        self.layout_d = QtWidgets.QHBoxLayout()
        self.layout_d.setObjectName("layout_d")
        self.radio_d = QtWidgets.QRadioButton(self.frame)
        self.radio_d.setText("")
        self.radio_d.setCheckable(True)
        self.radio_d.setChecked(False)
        self.radio_d.setObjectName("radio_d")
        self.layout_d.addWidget(self.radio_d)
        self.verticalLayout_6 = QtWidgets.QVBoxLayout()
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        spacerItem = QtWidgets.QSpacerItem(20, 40,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Preferred)
        self.verticalLayout_6.addItem(spacerItem)
        self.label_3 = QtWidgets.QLabel(self.frame)
        self.label_3.setAlignment(QtCore.Qt.AlignBottom
                                  | QtCore.Qt.AlignHCenter)
        self.label_3.setObjectName("label_3")
        self.verticalLayout_6.addWidget(self.label_3)
        self.line_2 = QtWidgets.QFrame(self.frame)
        font = QtGui.QFont()
        font.setPointSize(8)
        self.line_2.setFont(font)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line_2.setLineWidth(1)
        self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_2.setObjectName("line_2")
        self.verticalLayout_6.addWidget(self.line_2)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.label_4 = QtWidgets.QLabel(self.frame)
        self.label_4.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft
                                  | QtCore.Qt.AlignTop)
        self.label_4.setObjectName("label_4")
        self.horizontalLayout_4.addWidget(self.label_4)
        self.variable_d = QtWidgets.QComboBox(self.frame)
        self.variable_d.setObjectName("variable_d")
        self.variable_d.addItem("")
        self.variable_d.addItem("")
        self.variable_d.addItem("")
        self.variable_d.addItem("")
        self.horizontalLayout_4.addWidget(self.variable_d)
        self.verticalLayout_6.addLayout(self.horizontalLayout_4)
        spacerItem1 = QtWidgets.QSpacerItem(20, 40,
                                            QtWidgets.QSizePolicy.Minimum,
                                            QtWidgets.QSizePolicy.Preferred)
        self.verticalLayout_6.addItem(spacerItem1)
        self.layout_d.addLayout(self.verticalLayout_6)
        self.text_entry_d = QtWidgets.QLineEdit(self.frame)
        self.text_entry_d.setObjectName("text_entry_d")
        self.layout_d.addWidget(self.text_entry_d)
        self.verticalLayout_10.addLayout(self.layout_d)
        self.line_3 = QtWidgets.QFrame(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.line_3.sizePolicy().hasHeightForWidth())
        self.line_3.setSizePolicy(sizePolicy)
        self.line_3.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_3.setObjectName("line_3")
        self.verticalLayout_10.addWidget(self.line_3)
        self.layout_i = QtWidgets.QHBoxLayout()
        self.layout_i.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
        self.layout_i.setObjectName("layout_i")
        self.radio_i = QtWidgets.QRadioButton(self.frame)
        self.radio_i.setText("")
        self.radio_i.setCheckable(True)
        self.radio_i.setChecked(False)
        self.radio_i.setObjectName("radio_i")
        self.layout_i.addWidget(self.radio_i)
        self.verticalLayout_9 = QtWidgets.QVBoxLayout()
        self.verticalLayout_9.setObjectName("verticalLayout_9")
        self.upper_bound = QtWidgets.QLineEdit(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.upper_bound.sizePolicy().hasHeightForWidth())
        self.upper_bound.setSizePolicy(sizePolicy)
        self.upper_bound.setMaximumSize(QtCore.QSize(24, 16777215))
        self.upper_bound.setObjectName("upper_bound")
        self.verticalLayout_9.addWidget(self.upper_bound)
        self.label_5 = QtWidgets.QLabel(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_5.sizePolicy().hasHeightForWidth())
        self.label_5.setSizePolicy(sizePolicy)
        self.label_5.setMaximumSize(QtCore.QSize(16777215, 32))
        font = QtGui.QFont()
        font.setFamily("Cambria Math")
        font.setPointSize(16)
        font.setBold(False)
        font.setWeight(50)
        self.label_5.setFont(font)
        self.label_5.setTextFormat(QtCore.Qt.AutoText)
        self.label_5.setAlignment(QtCore.Qt.AlignCenter)
        self.label_5.setObjectName("label_5")
        self.verticalLayout_9.addWidget(self.label_5)
        self.lower_bound = QtWidgets.QLineEdit(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.lower_bound.sizePolicy().hasHeightForWidth())
        self.lower_bound.setSizePolicy(sizePolicy)
        self.lower_bound.setMaximumSize(QtCore.QSize(24, 16777215))
        self.lower_bound.setObjectName("lower_bound")
        self.verticalLayout_9.addWidget(self.lower_bound)
        self.layout_i.addLayout(self.verticalLayout_9)
        self.text_entry_i = QtWidgets.QLineEdit(self.frame)
        self.text_entry_i.setObjectName("text_entry_i")
        self.layout_i.addWidget(self.text_entry_i)
        self.label_6 = QtWidgets.QLabel(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_6.sizePolicy().hasHeightForWidth())
        self.label_6.setSizePolicy(sizePolicy)
        self.label_6.setObjectName("label_6")
        self.layout_i.addWidget(self.label_6)
        self.variable_i = QtWidgets.QComboBox(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.variable_i.sizePolicy().hasHeightForWidth())
        self.variable_i.setSizePolicy(sizePolicy)
        self.variable_i.setObjectName("variable_i")
        self.variable_i.addItem("")
        self.variable_i.addItem("")
        self.variable_i.addItem("")
        self.variable_i.addItem("")
        self.layout_i.addWidget(self.variable_i)
        self.verticalLayout_10.addLayout(self.layout_i)
        self.line_4 = QtWidgets.QFrame(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.line_4.sizePolicy().hasHeightForWidth())
        self.line_4.setSizePolicy(sizePolicy)
        self.line_4.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_4.setObjectName("line_4")
        self.verticalLayout_10.addWidget(self.line_4)
        self.layout_s = QtWidgets.QHBoxLayout()
        self.layout_s.setObjectName("layout_s")
        self.radio_s = QtWidgets.QRadioButton(self.frame)
        self.radio_s.setText("")
        self.radio_s.setCheckable(True)
        self.radio_s.setChecked(False)
        self.radio_s.setObjectName("radio_s")
        self.layout_s.addWidget(self.radio_s)
        self.verticalLayout_7 = QtWidgets.QVBoxLayout()
        self.verticalLayout_7.setObjectName("verticalLayout_7")
        spacerItem2 = QtWidgets.QSpacerItem(20, 40,
                                            QtWidgets.QSizePolicy.Minimum,
                                            QtWidgets.QSizePolicy.Preferred)
        self.verticalLayout_7.addItem(spacerItem2)
        self.label_7 = QtWidgets.QLabel(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_7.sizePolicy().hasHeightForWidth())
        self.label_7.setSizePolicy(sizePolicy)
        self.label_7.setAlignment(QtCore.Qt.AlignBottom
                                  | QtCore.Qt.AlignHCenter)
        self.label_7.setObjectName("label_7")
        self.verticalLayout_7.addWidget(self.label_7)
        self.label_8 = QtWidgets.QLabel(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_8.sizePolicy().hasHeightForWidth())
        self.label_8.setSizePolicy(sizePolicy)
        self.label_8.setMaximumSize(QtCore.QSize(16777215, 32))
        font = QtGui.QFont()
        font.setFamily("Cambria Math")
        font.setPointSize(32)
        self.label_8.setFont(font)
        self.label_8.setAlignment(QtCore.Qt.AlignCenter)
        self.label_8.setObjectName("label_8")
        self.verticalLayout_7.addWidget(self.label_8)
        self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.variable_s = QtWidgets.QComboBox(self.frame)
        self.variable_s.setObjectName("variable_s")
        self.variable_s.addItem("")
        self.variable_s.addItem("")
        self.variable_s.addItem("")
        self.horizontalLayout_7.addWidget(self.variable_s)
        self.label_9 = QtWidgets.QLabel(self.frame)
        self.label_9.setObjectName("label_9")
        self.horizontalLayout_7.addWidget(self.label_9)
        self.value_s = QtWidgets.QLineEdit(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.value_s.sizePolicy().hasHeightForWidth())
        self.value_s.setSizePolicy(sizePolicy)
        self.value_s.setMaximumSize(QtCore.QSize(24, 16777215))
        self.value_s.setInputMethodHints(QtCore.Qt.ImhNone)
        self.value_s.setObjectName("value_s")
        self.horizontalLayout_7.addWidget(self.value_s)
        self.verticalLayout_7.addLayout(self.horizontalLayout_7)
        spacerItem3 = QtWidgets.QSpacerItem(20, 40,
                                            QtWidgets.QSizePolicy.Minimum,
                                            QtWidgets.QSizePolicy.Preferred)
        self.verticalLayout_7.addItem(spacerItem3)
        self.layout_s.addLayout(self.verticalLayout_7)
        self.text_entry_s = QtWidgets.QLineEdit(self.frame)
        self.text_entry_s.setObjectName("text_entry_s")
        self.layout_s.addWidget(self.text_entry_s)
        self.groupBox = QtWidgets.QGroupBox(self.frame)
        self.groupBox.setTitle("")
        self.groupBox.setFlat(False)
        self.groupBox.setObjectName("groupBox")
        self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.groupBox)
        self.verticalLayout_8.setObjectName("verticalLayout_8")
        self.button_convergence = QtWidgets.QRadioButton(self.groupBox)
        self.button_convergence.setCheckable(True)
        self.button_convergence.setChecked(True)
        self.button_convergence.setObjectName("button_convergence")
        self.verticalLayout_8.addWidget(self.button_convergence)
        self.button_value = QtWidgets.QRadioButton(self.groupBox)
        self.button_value.setCheckable(True)
        self.button_value.setChecked(False)
        self.button_value.setObjectName("button_value")
        self.verticalLayout_8.addWidget(self.button_value)
        self.layout_s.addWidget(self.groupBox)
        self.verticalLayout_5 = QtWidgets.QVBoxLayout()
        self.verticalLayout_5.setObjectName("verticalLayout_5")
        self.layout_s.addLayout(self.verticalLayout_5)
        self.verticalLayout_10.addLayout(self.layout_s)
        self.verticalLayout_2.addLayout(self.verticalLayout_10)
        self.verticalLayout_2.setStretch(0, 1)
        self.verticalLayout_2.setStretch(1, 1)
        self.verticalLayout.addWidget(self.frame)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.button_back = QtWidgets.QPushButton(Calculator)
        self.button_back.setObjectName("button_back")
        self.horizontalLayout_2.addWidget(self.button_back)
        spacerItem4 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem4)
        self.button_help = QtWidgets.QPushButton(Calculator)
        self.button_help.setObjectName("button_help")
        self.horizontalLayout_2.addWidget(self.button_help)
        spacerItem5 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem5)
        self.button_home = QtWidgets.QPushButton(Calculator)
        self.button_home.setObjectName("button_home")
        self.horizontalLayout_2.addWidget(self.button_home)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(Calculator)
        self.variable_d.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(Calculator)

    def retranslateUi(self, Calculator):
        _translate = QtCore.QCoreApplication.translate
        Calculator.setWindowTitle(_translate("Calculator", "Form"))
        self.title.setText(_translate("Calculator", "Calculator"))
        self.label_3.setText(_translate("Calculator", "d"))
        self.label_4.setText(_translate("Calculator", "d"))
        self.variable_d.setItemText(0, _translate("Calculator", "x"))
        self.variable_d.setItemText(1, _translate("Calculator", "t"))
        self.variable_d.setItemText(2, _translate("Calculator", "u"))
        self.variable_d.setItemText(3, _translate("Calculator", "y"))
        self.label_5.setText(_translate("Calculator", "∫"))
        self.label_6.setText(_translate("Calculator", "d"))
        self.variable_i.setItemText(0, _translate("Calculator", "x"))
        self.variable_i.setItemText(1, _translate("Calculator", "u"))
        self.variable_i.setItemText(2, _translate("Calculator", "t"))
        self.variable_i.setItemText(3, _translate("Calculator", "y"))
        self.label_7.setText(_translate("Calculator", "∞"))
        self.label_8.setText(_translate("Calculator", "Σ"))
        self.variable_s.setItemText(0, _translate("Calculator", "n"))
        self.variable_s.setItemText(1, _translate("Calculator", "k"))
        self.variable_s.setItemText(2, _translate("Calculator", "i"))
        self.label_9.setText(_translate("Calculator", "="))
        self.value_s.setText(_translate("Calculator", "0"))
        self.button_convergence.setText(_translate("Calculator",
                                                   "Convergence"))
        self.button_value.setText(_translate("Calculator", "Value"))
        self.button_back.setText(_translate("Calculator", "Back"))
        self.button_help.setText(_translate("Calculator", "Help"))
        self.button_home.setText(_translate("Calculator", "Home"))
class Ui_FlashcardEditLine(object):
    def setupUi(self, FlashcardEditLine):
        FlashcardEditLine.setObjectName("FlashcardEditLine")
        FlashcardEditLine.resize(924, 70)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout(FlashcardEditLine)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.frame = QtWidgets.QFrame(FlashcardEditLine)
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Plain)
        self.frame.setObjectName("frame")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.frame)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.edit_question_button = QtWidgets.QPushButton(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.edit_question_button.sizePolicy().hasHeightForWidth())
        self.edit_question_button.setSizePolicy(sizePolicy)
        self.edit_question_button.setObjectName("edit_question_button")
        self.horizontalLayout_3.addWidget(self.edit_question_button)
        self.question_image = QSvgWidget(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.question_image.sizePolicy().hasHeightForWidth())
        self.question_image.setSizePolicy(sizePolicy)
        self.question_image.setMinimumSize(QtCore.QSize(0, 50))
        self.question_image.setObjectName("question_image")
        self.horizontalLayout_3.addWidget(self.question_image)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem)
        self.edit_answer_button = QtWidgets.QPushButton(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.edit_answer_button.sizePolicy().hasHeightForWidth())
        self.edit_answer_button.setSizePolicy(sizePolicy)
        self.edit_answer_button.setObjectName("edit_answer_button")
        self.horizontalLayout_3.addWidget(self.edit_answer_button)
        self.answer_image = QSvgWidget(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.answer_image.sizePolicy().hasHeightForWidth())
        self.answer_image.setSizePolicy(sizePolicy)
        self.answer_image.setMinimumSize(QtCore.QSize(0, 50))
        self.answer_image.setObjectName("answer_image")
        self.horizontalLayout_3.addWidget(self.answer_image)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem1)
        self.remove_button = QtWidgets.QPushButton(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.remove_button.sizePolicy().hasHeightForWidth())
        self.remove_button.setSizePolicy(sizePolicy)
        self.remove_button.setObjectName("remove_button")
        self.horizontalLayout_3.addWidget(self.remove_button)
        self.horizontalLayout_2.addWidget(self.frame)

        self.retranslateUi(FlashcardEditLine)
        QtCore.QMetaObject.connectSlotsByName(FlashcardEditLine)

    def retranslateUi(self, FlashcardEditLine):
        _translate = QtCore.QCoreApplication.translate
        FlashcardEditLine.setWindowTitle(_translate("FlashcardEditLine", "Form"))
        self.edit_question_button.setText(_translate("FlashcardEditLine", "Edit"))
        self.edit_answer_button.setText(_translate("FlashcardEditLine", "Edit"))
        self.remove_button.setText(_translate("FlashcardEditLine", "Remove"))
示例#8
0
class Ui_Problem(object):
    def setupUi(self, Problem):
        Problem.setObjectName("Problem")
        Problem.resize(959, 514)
        self.verticalLayout = QtWidgets.QVBoxLayout(Problem)
        self.verticalLayout.setObjectName("verticalLayout")
        self.title = QtWidgets.QLabel(Problem)
        font = QtGui.QFont()
        font.setPointSize(28)
        font.setBold(False)
        font.setWeight(50)
        font.setKerning(True)
        self.title.setFont(font)
        self.title.setAlignment(QtCore.Qt.AlignCenter)
        self.title.setObjectName("title")
        self.verticalLayout.addWidget(self.title)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.score = QtWidgets.QLabel(Problem)
        self.score.setObjectName("score")
        self.horizontalLayout_3.addWidget(self.score)
        self.score_percent = QtWidgets.QLabel(Problem)
        self.score_percent.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.score_percent.setObjectName("score_percent")
        self.horizontalLayout_3.addWidget(self.score_percent)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.frame = QtWidgets.QFrame(Problem)
        self.frame.setStyleSheet("QWidget#frame {background-color: rgb(192, 192, 192);}")
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Plain)
        self.frame.setLineWidth(3)
        self.frame.setObjectName("frame")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.problem_frame = QtWidgets.QFrame(self.frame)
        self.problem_frame.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.problem_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.problem_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.problem_frame.setObjectName("problem_frame")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.problem_frame)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.problem = QSvgWidget(self.problem_frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.problem.sizePolicy().hasHeightForWidth())
        self.problem.setSizePolicy(sizePolicy)
        self.problem.setObjectName("problem")
        self.verticalLayout_4.addWidget(self.problem)
        self.verticalLayout_2.addWidget(self.problem_frame)
        self.answer_frame = QtWidgets.QFrame(self.frame)
        self.answer_frame.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.answer_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.answer_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.answer_frame.setObjectName("answer_frame")
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.answer_frame)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.answer = QSvgWidget(self.answer_frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.answer.sizePolicy().hasHeightForWidth())
        self.answer.setSizePolicy(sizePolicy)
        self.answer.setObjectName("answer")
        self.verticalLayout_3.addWidget(self.answer)
        self.verticalLayout_2.addWidget(self.answer_frame)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.button_new = QtWidgets.QPushButton(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.button_new.sizePolicy().hasHeightForWidth())
        self.button_new.setSizePolicy(sizePolicy)
        self.button_new.setObjectName("button_new")
        self.horizontalLayout.addWidget(self.button_new)
        self.text_entry = QtWidgets.QLineEdit(self.frame)
        self.text_entry.setObjectName("text_entry")
        self.horizontalLayout.addWidget(self.text_entry)
        self.button_check = QtWidgets.QPushButton(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.button_check.sizePolicy().hasHeightForWidth())
        self.button_check.setSizePolicy(sizePolicy)
        self.button_check.setObjectName("button_check")
        self.horizontalLayout.addWidget(self.button_check)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.verticalLayout_2.setStretch(0, 1)
        self.verticalLayout_2.setStretch(1, 1)
        self.verticalLayout.addWidget(self.frame)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.button_back = QtWidgets.QPushButton(Problem)
        self.button_back.setObjectName("button_back")
        self.horizontalLayout_2.addWidget(self.button_back)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem)
        self.button_help = QtWidgets.QPushButton(Problem)
        self.button_help.setObjectName("button_help")
        self.horizontalLayout_2.addWidget(self.button_help)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem1)
        self.button_home = QtWidgets.QPushButton(Problem)
        self.button_home.setObjectName("button_home")
        self.horizontalLayout_2.addWidget(self.button_home)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(Problem)
        QtCore.QMetaObject.connectSlotsByName(Problem)

    def retranslateUi(self, Problem):
        _translate = QtCore.QCoreApplication.translate
        Problem.setWindowTitle(_translate("Problem", "Form"))
        self.title.setText(_translate("Problem", "Problems"))
        self.score.setText(_translate("Problem", "Score: 0/0"))
        self.score_percent.setText(_translate("Problem", "0%"))
        self.button_new.setText(_translate("Problem", "New"))
        self.button_check.setToolTip(_translate("Problem", "<html><head/><body><p>Please note that your answer is checked by a computer which lacks the intuition of a human and may be incorrect</p></body></html>"))
        self.button_check.setText(_translate("Problem", "Check"))
        self.button_back.setText(_translate("Problem", "Back"))
        self.button_help.setText(_translate("Problem", "Help"))
        self.button_home.setText(_translate("Problem", "Home"))