Exemple #1
0
        def __init__(self,
                     parent,
                     grid,
                     bounding_box=None,
                     vmin=None,
                     vmax=None,
                     codim=2,
                     dpi=100):
            assert grid.reference_element in (triangle, square)
            assert grid.dim == 2
            assert codim in (0, 2)

            self.figure = Figure(dpi=dpi)
            super().__init__(self.figure)

            subentities, coordinates, entity_map = flatten_grid(grid)
            self.subentities = subentities if grid.reference_element is triangle \
                else np.vstack((subentities[:, 0:3], subentities[:, [2, 3, 0]]))
            self.coordinates = coordinates
            self.entity_map = entity_map
            self.reference_element = grid.reference_element
            self.vmin = vmin
            self.vmax = vmax
            self.codim = codim
            self.setParent(parent)
            self.setMinimumSize(300, 300)
            self.setSizePolicy(
                QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
    def getParameterWidget(self):
        matrixLayout = QGridLayout()
        matrixLayout.setAlignment(Qt.AlignTop)
        matrixLayout.setContentsMargins(0, 0, 0, 0)
        matrixLayout.setSpacing(5)
        matrixLayout.addWidget(QLabel("Transformation matrix:"), 0, 0, 1, 4)
        self.m1Edits = [QLineEdit() for _ in range(4)]
        self.m2Edits = [QLineEdit() for _ in range(4)]
        self.m3Edits = [QLineEdit() for _ in range(4)]
        self.m4Edits = [QLineEdit() for _ in range(4)]
        self.initLineEdits(self.m1Edits, matrixLayout, 1, 0)
        self.initLineEdits(self.m2Edits, matrixLayout, 2, 0)
        self.initLineEdits(self.m3Edits, matrixLayout, 3, 0)
        self.initLineEdits(self.m4Edits, matrixLayout, 4, 0)
        expandingWidget = QWidget()
        expandingWidget.setSizePolicy(
            QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
        matrixLayout.addWidget(expandingWidget, 5, 0, 1, 4)

        matrixWidget = QWidget()
        matrixWidget.setLayout(matrixLayout)
        self.transformUpdated(
            self.renderWidget.transformations.completeTransform())

        return matrixWidget
    def __init__(self, *args, **kwargs):
        super(Widget_scriptPath, self).__init__(*args, **kwargs)
        self.installEventFilter(self)

        mainLayout = QHBoxLayout(self)
        mainLayout.setContentsMargins(0, 0, 0, 0)
        label = QLabel("Script Path : ")
        lineEdit = QLineEdit()
        button = QPushButton("...")
        button.setFixedWidth(40)
        button.clicked.connect(self.cmd_getPath)

        mainLayout.addWidget(label)
        mainLayout.addWidget(lineEdit)
        mainLayout.addWidget(button)

        self.lineEdit = lineEdit
        self.load_lineEdit_text(self.lineEdit, Widget_scriptPath.path_uiInfo)

        sizePolicy = QSizePolicy()
        sizePolicy.setVerticalPolicy(QSizePolicy.Fixed)
        sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding)
        self.setSizePolicy(sizePolicy)

        self.lineEdit = lineEdit
Exemple #4
0
        def __init__(self,
                     parent,
                     grid,
                     count,
                     vmin=None,
                     vmax=None,
                     legend=None,
                     codim=1,
                     separate_plots=False,
                     dpi=100):
            assert isinstance(grid, OnedGrid)
            assert codim in (0, 1)

            figure = Figure(dpi=dpi)
            if not separate_plots:
                axes = figure.gca()
                axes.hold(True)
            self.codim = codim
            lines = ()
            centers = grid.centers(1)
            if grid._identify_left_right:
                centers = np.concatenate((centers, [[grid._domain[1]]]),
                                         axis=0)
                self.periodic = True
            else:
                self.periodic = False
            if codim == 1:
                xs = centers
            else:
                xs = np.repeat(centers, 2)[1:-1]
            for i in range(count):
                if separate_plots:
                    figure.add_subplot(int(count / 2) + count % 2, 2, i + 1)
                    axes = figure.gca()
                    pad = (vmax[i] - vmin[i]) * 0.1
                    axes.set_ylim(vmin[i] - pad, vmax[i] + pad)
                l, = axes.plot(xs, np.zeros_like(xs))
                lines = lines + (l, )
                if legend and separate_plots:
                    axes.legend([legend[i]])
            if not separate_plots:
                pad = (max(vmax) - min(vmin)) * 0.1
                axes.set_ylim(min(vmin) - pad, max(vmax) + pad)
                if legend:
                    axes.legend(legend)
            self.lines = lines

            super().__init__(figure)
            self.setParent(parent)
            self.setMinimumSize(300, 300)
            self.setSizePolicy(
                QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
Exemple #5
0
    def __setupToolbar(self):
        widgetSpacer = QWidget()
        widgetSpacer.setSizePolicy(
            QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred))

        self._comboSerial = QComboBox()
        self._comboSerial.addItems(self._comm.getPorts())
        self._comboSerial.setToolTip('Serial port')

        self.toolbar.addWidget(widgetSpacer)
        self.toolbar.addWidget(self._comboSerial)

        icon = QIcon(getResource('record.png'))
        self.actionRecord.setIcon(icon)
        icon = QIcon(getResource('clear.png'))
        self.actionClear.setIcon(icon)
Exemple #6
0
    def __init__(self, parent, parent_frame, title=None):
        """Construct a ModuleFrame.

           parent
               The GUI parent of this window as necessary for Qt

           parent_frame
               The ModuleFrame that is the logical parent to this one.
        """
        super(ModuleFrame, self).__init__(parent)

        self.title = title
        self.parent_frame = parent_frame
        self.agent = None

        # Only realize if we have a parent and a parent frame
        if self.parent_frame is not None and self.parent() is not None:
            self.realize()

        self.acceptDocks = False  # Set to True to have child windows
        self.dragOverlay = False  # For having a drag overlay window
        self.overlay_dialog = None

        self.setAcceptDrops(True)
        self.setWindowFlags(Qt.Widget)  # Or else it will try to be a window

        # Makes color bar flush with top
        left, top, right, bottom = self.layout().getContentsMargins()
        self.layout().setContentsMargins(0, 0, right, bottom)

        # If we have a parent, set the height hint to be tall
        self.heightHint = self.size().height()
        if self.parent_frame is not None:
            self.heightHint = self.parent_frame.height() - 20

        self.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, \
            QSizePolicy.Preferred))

        # Yellow Boxfishy border
        self.setStyleSheet("QMainWindow::separator { background:"\
            + "rgb(240, 240, 120); width: 2px; height: 2px; }")
Exemple #7
0
    def __init__(self, orientation=Qt.Horizontal, parent=None):
        super().__init__(parent)
        self.setOrientation(orientation)
        policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed,
                             QSizePolicy.ButtonBox)
        policy.setHeightForWidth(True)
        policy.setWidthForHeight(True)
        self.setSizePolicy(policy)
        self.setFloatable(False)
        self.setToolTip("""<p><b>Goto Letter</b></p>
<p>Left-click a letter to navigate to the first entry starting with that
letter.</p>
<p>Right-click a letter to navigate to the first entry starting with the
most recently left-clicked letter, plus any subsequent right-clicked
letters, and this letter.</p>
<p>(One left-click or a fifth right-click clears the previous letters.)</p>
<p>For example, left-click <i>S</i> to go to the first “s” entry. Then
right-click <i>A</i> to go to the first “sa” entry, then right-click
<i>T</i> to go to the first “sat” entry.</p>""")
        self.timer = QTimer(self)
        self.timer.setSingleShot(True)
        self.timer.timeout.connect(self.onTimeout)
        size = self.font().pointSizeF()
        strategy = QFont.StyleStrategy(QFont.PreferOutline
                                       | QFont.PreferAntialias
                                       | QFont.PreferQuality)
        self.mainFont = QFont("courier new")
        self.mainFont.setFixedPitch(True)
        self.mainFont.setStyleStrategy(strategy)
        self.mainFont.setStyleHint(QFont.Monospace)
        self.mainFont.setPointSizeF(size * 1.5)
        self.mainFont.setBold(True)
        self.mainFont.setItalic(False)
        self.setFont(self.mainFont)
        self.smallFont = QFont("helvetica")
        self.smallFont.setStyleStrategy(strategy)
        self.smallFont.setStyleHint(QFont.Times)
        self.smallFont.setPointSizeF(size * 1.25)
        self.smallFont.setBold(False)
        self.smallFont.setItalic(False)
        self.letters = string.ascii_uppercase
        self.word = None
    def __init__(self, *args, **kwargs):

        super(Widget_textEdit_splitter, self).__init__(*args, **kwargs)
        self.installEventFilter(self)
        mainLayout = QVBoxLayout(self)

        w_convertButton = QWidget()
        lay_convertButton = QHBoxLayout(w_convertButton)
        label_orig = QLabel("Original")
        label_orig.setAlignment(QtCore.Qt.AlignCenter)
        label_convert = QLabel("Converted")
        label_convert.setAlignment(QtCore.Qt.AlignCenter)
        button = QPushButton(" >> ")
        lay_convertButton.addWidget(label_orig)
        lay_convertButton.addWidget(button)
        lay_convertButton.addWidget(label_convert)
        w_convertButton.setStyleSheet("font-size:13px")
        sizePolicy = QSizePolicy()
        sizePolicy.setVerticalPolicy(QSizePolicy.Fixed)
        sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding)
        w_convertButton.setSizePolicy(sizePolicy)

        splitter = QSplitter()
        splitter.setStretchFactor(1, 1)

        textEdit_left = QTextEdit()
        textEdit_right = QTextEdit()
        splitter.addWidget(textEdit_left)
        splitter.addWidget(textEdit_right)

        textEdit_left.setLineWrapMode(QTextEdit.NoWrap)
        textEdit_right.setLineWrapMode(QTextEdit.NoWrap)

        mainLayout.addWidget(w_convertButton)
        mainLayout.addWidget(splitter)

        self.textEdit_left = textEdit_left
        self.textEdit_right = textEdit_right

        button.clicked.connect(self.load_convertedText)
Exemple #9
0
    def __init__(self, parser_result):
        QWidget.__init__(self)
        self._parser_result = parser_result

        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSizeConstraint(QHBoxLayout.SetMinimumSize)

        self.table_widget = QTableWidget()
        self.table_widget.setSelectionMode(QAbstractItemView.NoSelection)
        self.table_widget.setRowCount(2)
        self.table_widget.setColumnCount(2)
        self.table_widget.horizontalHeader().setResizeMode(QHeaderView.Stretch)
        self.table_widget.setHorizontalHeaderLabels(["Dimension", "Choice"])
        self.table_widget.verticalHeader().setVisible(False)
        self.table_widget.verticalHeader().setResizeMode(QHeaderView.Fixed)
        self.table_widget.verticalHeader().setDefaultSectionSize(20)
        sp_table = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sp_table.setHorizontalStretch(1)
        self.table_widget.setSizePolicy(sp_table)

        layout.addWidget(self.table_widget)

        self.text_widget = QTextEdit()
        sp_text = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sp_text.setHorizontalStretch(4)
        self.text_widget.setReadOnly(True)
        self.text_widget.setSizePolicy(sp_text)
        self.text_widget.setStyleSheet('font: 9pt "Courier";')
        self.text_widget.setText(self._parser_result.get_text())

        layout.addWidget(self.text_widget)

        self.setLayout(layout)

        self._fill_table()
Exemple #10
0
        def __init__(self,
                     parent,
                     grid,
                     vmin=None,
                     vmax=None,
                     bounding_box=([0, 0], [1, 1]),
                     codim=2):
            assert grid.reference_element in (triangle, square)
            assert grid.dim == 2
            assert codim in (0, 2)
            super(GLPatchWidget, self).__init__(parent)
            self.setMinimumSize(300, 300)
            self.setSizePolicy(
                QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))

            subentities, coordinates, entity_map = flatten_grid(grid)

            self.subentities = subentities
            self.entity_map = entity_map
            self.reference_element = grid.reference_element
            self.vmin = vmin
            self.vmax = vmax
            self.bounding_box = bounding_box
            self.codim = codim
            self.update_vbo = False
            bb = self.bounding_box
            self.size = np.array([bb[1][0] - bb[0][0], bb[1][1] - bb[0][1]])
            self.scale = 2 / self.size
            self.shift = -np.array(bb[0]) - self.size / 2

            # setup buffers
            if self.reference_element == triangle:
                if codim == 2:
                    self.vertex_data = np.empty(len(coordinates),
                                                dtype=[('position', 'f4', 2),
                                                       ('color', 'f4', 1)])
                    self.indices = subentities
                else:
                    self.vertex_data = np.empty(len(subentities) * 3,
                                                dtype=[('position', 'f4', 2),
                                                       ('color', 'f4', 1)])
                    self.indices = np.arange(len(subentities) * 3,
                                             dtype=np.uint32)
            else:
                if codim == 2:
                    self.vertex_data = np.empty(len(coordinates),
                                                dtype=[('position', 'f4', 2),
                                                       ('color', 'f4', 1)])
                    self.indices = np.vstack(
                        (subentities[:, 0:3], subentities[:, [0, 2, 3]]))
                else:
                    self.vertex_data = np.empty(len(subentities) * 6,
                                                dtype=[('position', 'f4', 2),
                                                       ('color', 'f4', 1)])
                    self.indices = np.arange(len(subentities) * 6,
                                             dtype=np.uint32)

            self.vertex_data['color'] = 1

            self.set_coordinates(coordinates)
            self.set(np.zeros(grid.size(codim)))
Exemple #11
0
 def __init__(self, parent, U=None, vmin=None, vmax=None):
     super(ColorBarWidget, self).__init__(parent)
     self.setSizePolicy(
         QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding))
     self.setAutoFillBackground(False)
     self.set(U, vmin, vmax)
Exemple #12
0
    def __init__(self):
        super(QDiffConnector, self).__init__()

        self.color = QColor(0, 100, 0, 100)
        self.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Ignored))
        self.setFixedWidth(30)
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(560, 560)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
        Form.setSizePolicy(sizePolicy)
        Form.setMinimumSize(QtCore.QSize(0, 0))
        self.gridLayout_2 = QGridLayout(Form)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.editorGroupBox = QGroupBox(Form)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.editorGroupBox.sizePolicy().hasHeightForWidth())
        self.editorGroupBox.setSizePolicy(sizePolicy)
        self.editorGroupBox.setMinimumSize(QtCore.QSize(0, 0))
        self.editorGroupBox.setObjectName("editorGroupBox")
        self.gridLayout_3 = QGridLayout(self.editorGroupBox)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.gridLayout = QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.variable_verticalLayout_1 = QVBoxLayout()
        self.variable_verticalLayout_1.setObjectName(
            "variable_verticalLayout_1")
        self.listBox = QListWidget(self.editorGroupBox)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.listBox.sizePolicy().hasHeightForWidth())
        self.listBox.setSizePolicy(sizePolicy)
        self.listBox.setDragEnabled(True)
        self.listBox.setDragDropOverwriteMode(False)
        self.listBox.setDragDropMode(QAbstractItemView.InternalMove)
        self.listBox.setDefaultDropAction(QtCore.Qt.MoveAction)
        self.listBox.setAlternatingRowColors(True)
        self.listBox.setSelectionMode(QAbstractItemView.SingleSelection)
        self.listBox.setMovement(QListView.Snap)
        self.listBox.setResizeMode(QListView.Fixed)
        self.listBox.setSelectionRectVisible(False)
        self.listBox.setObjectName("listBox")
        self.variable_verticalLayout_1.addWidget(self.listBox)
        self.gridLayout.addLayout(self.variable_verticalLayout_1, 0, 0, 1, 1)
        self.variable_verticalLayout_2 = QVBoxLayout()
        self.variable_verticalLayout_2.setObjectName(
            "variable_verticalLayout_2")
        self.addButton = QPushButton(self.editorGroupBox)
        self.addButton.setObjectName("addButton")
        self.variable_verticalLayout_2.addWidget(self.addButton)
        self.editButton = QPushButton(self.editorGroupBox)
        self.editButton.setObjectName("editButton")
        self.variable_verticalLayout_2.addWidget(self.editButton)
        self.removeButton = QPushButton(self.editorGroupBox)
        self.removeButton.setObjectName("removeButton")
        self.variable_verticalLayout_2.addWidget(self.removeButton)
        spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                 QSizePolicy.Expanding)
        self.variable_verticalLayout_2.addItem(spacerItem)
        self.upButton = QPushButton(self.editorGroupBox)
        self.upButton.setObjectName("upButton")
        self.variable_verticalLayout_2.addWidget(self.upButton)
        self.downButton = QPushButton(self.editorGroupBox)
        self.downButton.setObjectName("downButton")
        self.variable_verticalLayout_2.addWidget(self.downButton)
        spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding)
        self.variable_verticalLayout_2.addItem(spacerItem1)
        self.variable_verticalLayout_2.setStretch(3, 1)
        self.variable_verticalLayout_2.setStretch(6, 1)
        self.gridLayout.addLayout(self.variable_verticalLayout_2, 0, 1, 1, 1)
        self.gridLayout.setColumnStretch(0, 1)
        self.gridLayout_3.addLayout(self.gridLayout, 0, 0, 1, 1)
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setContentsMargins(15, 15, 15, 15)
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem2 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem2)
        self.ok_pushButton = QPushButton(self.editorGroupBox)
        self.ok_pushButton.setObjectName("ok_pushButton")
        self.horizontalLayout.addWidget(self.ok_pushButton)
        self.cancel_pushButton = QPushButton(self.editorGroupBox)
        self.cancel_pushButton.setObjectName("cancel_pushButton")
        self.horizontalLayout.addWidget(self.cancel_pushButton)
        self.horizontalLayout.setStretch(0, 1)
        self.gridLayout_3.addLayout(self.horizontalLayout, 1, 0, 1, 1)
        self.gridLayout_2.addWidget(self.editorGroupBox, 0, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
Exemple #14
0
    def __init__(self, parent=None, **kw):
        # the current button
        self._ActiveButton = Qt.NoButton

        # private attributes
        self.__saveX = 0
        self.__saveY = 0
        self.__saveModifiers = Qt.NoModifier
        self.__saveButtons = Qt.NoButton
        self.__wheelDelta = 0

        # do special handling of some keywords:
        # stereo, rw

        try:
            stereo = bool(kw['stereo'])
        except KeyError:
            stereo = False

        try:
            rw = kw['rw']
        except KeyError:
            rw = None

        # create base qt-level widget
        if "wflags" in kw:
            wflags = kw['wflags']
        else:
            wflags = Qt.WindowFlags()
        QWidget.__init__(self, parent, wflags | Qt.MSWindowsOwnDC)

        if rw:  # user-supplied render window
            self._RenderWindow = rw
        else:
            self._RenderWindow = vtk.vtkRenderWindow()

        WId = self.winId()

        # Python2
        if type(WId).__name__ == 'PyCObject':
            from ctypes import pythonapi, c_void_p, py_object

            pythonapi.PyCObject_AsVoidPtr.restype = c_void_p
            pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object]

            WId = pythonapi.PyCObject_AsVoidPtr(WId)

        # Python3
        elif type(WId).__name__ == 'PyCapsule':
            from ctypes import pythonapi, c_void_p, py_object, c_char_p

            pythonapi.PyCapsule_GetName.restype = c_char_p
            pythonapi.PyCapsule_GetName.argtypes = [py_object]

            name = pythonapi.PyCapsule_GetName(WId)

            pythonapi.PyCapsule_GetPointer.restype = c_void_p
            pythonapi.PyCapsule_GetPointer.argtypes = [py_object, c_char_p]

            WId = pythonapi.PyCapsule_GetPointer(WId, name)

        self._RenderWindow.SetWindowInfo(str(int(WId)))

        if stereo:  # stereo mode
            self._RenderWindow.StereoCapableWindowOn()
            self._RenderWindow.SetStereoTypeToCrystalEyes()

        try:
            self._Iren = kw['iren']
        except KeyError:
            self._Iren = vtk.vtkGenericRenderWindowInteractor()
            self._Iren.SetRenderWindow(self._RenderWindow)

        # do all the necessary qt setup
        self.setAttribute(Qt.WA_OpaquePaintEvent)
        self.setAttribute(Qt.WA_PaintOnScreen)
        self.setMouseTracking(True)  # get all mouse events
        self.setFocusPolicy(Qt.WheelFocus)
        self.setSizePolicy(
            QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))

        self._Timer = QTimer(self)
        self._Timer.timeout.connect(self.TimerEvent)

        self._Iren.AddObserver('CreateTimerEvent', self.CreateTimer)
        self._Iren.AddObserver('DestroyTimerEvent', self.DestroyTimer)
        self._Iren.GetRenderWindow().AddObserver('CursorChangedEvent',
                                                 self.CursorChangedEvent)

        #Create a hidden child widget and connect its destroyed signal to its
        #parent ``Finalize`` slot. The hidden children will be destroyed before
        #its parent thus allowing cleanup of VTK elements.
        self._hidden = QWidget(self)
        self._hidden.hide()
        self._hidden.destroyed.connect(self.Finalize)
Exemple #15
0
 def initUI(self):
     """Met en place les éléments de l'interface."""
     # -+++++++------------------- main window -------------------+++++++- #
     self.setWindowTitle(u"Encodage / Décodage de Huffman")
     self.centerAndResize()
     centralwidget = QWidget(self)
     mainGrid = QGridLayout(centralwidget)
     mainGrid.setColumnMinimumWidth(0, 450)
     # -+++++++------------------ groupe analyse -----------------+++++++- #
     analysGroup = QGroupBox(u"Analyse", centralwidget)
     self.analysGrid = QGridLayout(analysGroup)
     #         ----------- groupe de la table des codes ----------         #
     codeTableGroup = QGroupBox(u"Table des codes", analysGroup)
     codeTableGrid = QGridLayout(codeTableGroup)
     # un tableau pour les codes
     self.codesTableModel = MyTableModel()
     self.codesTable = QTableView(codeTableGroup)
     self.codesTable.setModel(self.codesTableModel)
     self.codesTable.setFont(QFont("Mono", 8))
     self.codesTable.resizeColumnsToContents()
     self.codesTable.setSortingEnabled(True)
     codeTableGrid.addWidget(self.codesTable, 0, 0, 1, 1)
     self.analysGrid.addWidget(codeTableGroup, 1, 0, 1, 1)
     #        ----------- label du ratio de compression ----------         #
     self.ratioLab = QLabel(u"Ratio de compression: ", analysGroup)
     font = QFont()
     font.setBold(True)
     font.setWeight(75)
     font.setKerning(True)
     self.ratioLab.setFont(font)
     self.analysGrid.addWidget(self.ratioLab, 2, 0, 1, 1)
     # -+++++++-------- groupe de la table de comparaison --------+++++++- #
     self.compGroup = QGroupBox(analysGroup)
     self.compGroup.setTitle(u"Comparaisons")
     compGrid = QGridLayout(self.compGroup)
     # un tableau pour le ratio
     self.compTable = QTableWidget(self.compGroup)
     sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(
         self.compTable.sizePolicy().hasHeightForWidth())
     self.compTable.setSizePolicy(sizePolicy)
     self.compTable.setBaseSize(QSize(0, 0))
     font = QFont()
     font.setWeight(50)
     self.compTable.setFont(font)
     self.compTable.setEditTriggers(QAbstractItemView.NoEditTriggers)
     self.compTable.setShowGrid(True)
     self.compTable.setGridStyle(Qt.SolidLine)
     # lignes / colonnes
     self.compTable.setColumnCount(2)
     self.compTable.setRowCount(3)
     self.compTable.setVerticalHeaderItem(0, QTableWidgetItem("Taille (bits)"))
     self.compTable.setVerticalHeaderItem(1, QTableWidgetItem("Entropie"))
     self.compTable.setVerticalHeaderItem(2, QTableWidgetItem("Taille moy. (bits)"))
     for i in range(2):
         self.compTable.verticalHeaderItem(i).setTextAlignment(
             Qt.AlignRight)
     self.compTable.setHorizontalHeaderItem(0, QTableWidgetItem("ASCII"))
     self.compTable.setHorizontalHeaderItem(1, QTableWidgetItem("Huffman"))
     
     # nom des items
     self.compTabASCIIMem = QTableWidgetItem()
     self.compTable.setItem(0, 0, self.compTabASCIIMem)
     self.compTabASCIIEnt = QTableWidgetItem()
     self.compTable.setItem(1, 0, self.compTabASCIIEnt)
     self.compTabASCIIAvg = QTableWidgetItem()
     self.compTable.setItem(2, 0, self.compTabASCIIAvg)
     self.compTabHuffMem = QTableWidgetItem()
     self.compTable.setItem(0, 1, self.compTabHuffMem)
     self.compTabHuffEnt = QTableWidgetItem()
     self.compTable.setItem(1, 1, self.compTabHuffEnt)
     self.compTabHuffAvg = QTableWidgetItem()
     self.compTable.setItem(2, 1, self.compTabHuffAvg)
     # parem du tableau
     self.compTable.horizontalHeader().setCascadingSectionResizes(False)
     self.compTable.verticalHeader().setVisible(True)
     font = QFont("Mono", 8)
     self.compTable.setFont(font)
     compGrid.addWidget(self.compTable, 1, 0, 1, 1)
     self.analysGrid.addWidget(self.compGroup, 0, 0, 1, 1)
     mainGrid.addWidget(analysGroup, 0, 1, 1, 1)
     # -+++++++----------------- groupe du texte -----------------+++++++- #
     groupBox = QGroupBox(u"Texte", centralwidget)
     textGrid = QGridLayout(groupBox)
     # -+++++++------------- groupe du texte original ------------+++++++- #
     orgTextGroup = QGroupBox(u"Texte original (Ctrl+T)", groupBox)
     orgTextGrid = QGridLayout(orgTextGroup)
     self.orgText = QTextEdit(orgTextGroup)
     self.orgText.setPalette(self.defaultPalette)
     orgTextGrid.addWidget(self.orgText, 0, 0, 1, 1)
     textGrid.addWidget(orgTextGroup, 0, 0, 1, 2)
     # -+++++++------------ groupe du texte compressé ------------+++++++- #
     compressedTextGroup = QGroupBox(u"Texte compressé (Ctrl+H)", groupBox)
     compressedTextGrid = QGridLayout(compressedTextGroup)
     self.compressedText = QTextEdit(compressedTextGroup)
     self.compressedText.setPalette(self.defaultPalette)
     compressedTextGrid.addWidget(self.compressedText, 0, 0, 1, 1)
     textGrid.addWidget(compressedTextGroup, 1, 0, 1, 2)
     # -+++++++------------ groupe pour le texte ascii -----------+++++++- #
     asciiTextGroup = QGroupBox(u"Texte ASCII", groupBox)
     asciiTextGrid = QGridLayout(asciiTextGroup)
     self.asciiText = QTextBrowser(asciiTextGroup)
     self.asciiText.setPalette(self.defaultPalette)
     asciiTextGrid.addWidget(self.asciiText, 0, 0, 1, 1)
     textGrid.addWidget(asciiTextGroup, 2, 0, 1, 2)
     # -+++++++-------------------- label de log -----------------+++++++- #
     self.logLab = QLabel(analysGroup)
     textGrid.addWidget(self.logLab, 3, 0, 1, 2)
     # -+++++++----------- bouton pour encoder le texte ----------+++++++- #
     self.encodeBut = QPushButton(groupBox)
     self.encodeBut.setStatusTip(
         u"Cliquez sur ce bouton pour encoder le texte original.")
     self.encodeBut.setText(u"ENCODER")
     self.encodeBut.clicked.connect(self.encode_text)
     textGrid.addWidget(self.encodeBut, 4, 0, 1, 1)
     # -+++++++----------- bouton pour décoder le texte ----------+++++++- #
     self.decodeBut = QPushButton(groupBox)
     self.decodeBut.setStatusTip(
         u"Cliquez sur ce bouton pour décoder le texte compressé.")
     self.decodeBut.setText(u"DÉCODER")
     self.decodeBut.clicked.connect(self.decode_text)
     textGrid.addWidget(self.decodeBut, 4, 1, 1, 1)
     mainGrid.addWidget(groupBox, 0, 0, 1, 1)
     self.setCentralWidget(centralwidget)
     # -+++++++--------------- une barre de statut ---------------+++++++- #
     self.setStatusBar(QStatusBar(self))
     # -+++++++--------------------- le menu ---------------------+++++++- #
     self.fileMenu = QMenu(u"Fichier")
     self.fileMenu.addAction(u"Importer un texte...", self.open_text)
     self.fileMenu.addAction(
         u"Importer un texte encodé...", lambda: self.open_text(True))
     self.fileMenu.addAction(u"Importer un dictionnaire...", self.open_dict)
     self.fileMenu.addAction(u"Enregistrer le dictionnaire...", self.save_dict)
     self.fileMenu.addAction(u"Quitter", self.close)
     self.menuBar().addMenu(self.fileMenu)
     QMetaObject.connectSlotsByName(self)
    def createElements(self):
        """
		Creates the widgets and docks of which the
		main window is composed.
		"""
        self.mainWindow = QMainWindow()
        projectController = ProjectController.Instance()
        self.transformTool = None

        # Render widgets
        self.fixedDataWidget = RenderWidget()
        self.movingDataWidget = RenderWidget()
        self.multiDataWidget = MultiRenderWidget()

        self.fixedRenderController = RenderController(self.fixedDataWidget,
                                                      "fixed")
        self.movingRenderController = RenderController(self.movingDataWidget,
                                                       "moving")
        self.multiRenderController = MultiRenderController(
            self.multiDataWidget)

        # Give references of the render controllers to the project controller
        projectController.fixedRenderController = self.fixedRenderController
        projectController.movingRenderController = self.movingRenderController
        projectController.multiRenderController = self.multiRenderController

        # Render properties widgets
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)

        self.fixedPropWidget = RenderPropWidget(self.fixedRenderController,
                                                parent=self)
        self.fixedPropWidget.setSizePolicy(sizePolicy)
        self.fixedPropWidget.setFileChangedSignal(
            projectController.fixedFileChanged)
        self.fixedPropWidget.setLoadDataSlot(self.loadFixedDataSetFile)

        self.movingPropWidget = RenderPropWidget(self.movingRenderController,
                                                 parent=self)
        self.movingPropWidget.setSizePolicy(sizePolicy)
        self.movingPropWidget.setFileChangedSignal(
            projectController.movingFileChanged)
        self.movingPropWidget.setLoadDataSlot(self.loadMovingDataSetFile)

        self.multiPropWidget = MultiRenderPropWidget(
            self.multiRenderController, parent=self)
        self.multiPropWidget.setSizePolicy(sizePolicy)

        self.verticalSplitter = QSplitter()
        self.verticalSplitter.setOrientation(Qt.Vertical)

        # Create the layouts

        fixedDataTitleWidget = TitleWidget("Fixed volume")
        multiDataTitleWidget = TitleWidget("Fixed + Moving")
        movingDataTitleWidget = TitleWidget("Moving volume")

        fixedLayout = QGridLayout()
        fixedLayout.setSpacing(0)
        fixedLayout.setContentsMargins(0, 0, 0, 0)
        fixedLayout.addWidget(fixedDataTitleWidget)
        fixedLayout.addWidget(self.fixedDataWidget)
        fixedWidget = QWidget()
        fixedWidget.setLayout(fixedLayout)

        multiLayout = QGridLayout()
        multiLayout.setSpacing(0)
        multiLayout.setContentsMargins(0, 0, 0, 0)
        multiLayout.addWidget(multiDataTitleWidget)
        multiLayout.addWidget(self.multiDataWidget)
        multiWidget = QWidget()
        multiWidget.setLayout(multiLayout)

        movingLayout = QGridLayout()
        movingLayout.setSpacing(0)
        movingLayout.setContentsMargins(0, 0, 0, 0)
        movingLayout.addWidget(movingDataTitleWidget)
        movingLayout.addWidget(self.movingDataWidget)
        movingWidget = QWidget()
        movingWidget.setLayout(movingLayout)

        horizontalSplitter = QSplitter()
        horizontalSplitter.setOrientation(Qt.Horizontal)
        horizontalSplitter.addWidget(fixedWidget)
        horizontalSplitter.addWidget(multiWidget)
        horizontalSplitter.addWidget(movingWidget)

        propsLayout = QHBoxLayout()
        propsLayout.setSpacing(1)
        propsLayout.setContentsMargins(0, 0, 0, 0)
        propsLayout.addWidget(self.fixedPropWidget)
        propsLayout.addWidget(self.multiPropWidget)
        propsLayout.addWidget(self.movingPropWidget)

        propsWidget = QWidget()
        propsWidget.setMinimumHeight(245)
        propsWidget.setMaximumHeight(350)
        propsWidget.setLayout(propsLayout)

        self.verticalSplitter.addWidget(horizontalSplitter)
        self.verticalSplitter.addWidget(propsWidget)
        self.verticalSplitter.setStretchFactor(0, 2)
        self.verticalSplitter.setStretchFactor(1, 1)
        self.setCentralWidget(self.verticalSplitter)