Esempio n. 1
0
    def _enter_array(self, inline):
        """ """
        offset = self.get_position('cursor') - self.get_position('sol')
        rect = self.cursorRect()
        dlg = NumpyArrayDialog(self, inline, offset)

        # TODO: adapt to font size
        x = rect.left()
        x = x + self.get_linenumberarea_width() - 14
        y = rect.top() + (rect.bottom() - rect.top())/2
        y = y - dlg.height()/2 - 3

        pos = QPoint(x, y)
        dlg.move(self.mapToGlobal(pos))

        # called from editor
        if self.is_editor():
            python_like_check = self.is_python_like()
            suffix = '\n'
        # called from a console
        else:
            python_like_check = True
            suffix = ''

        if python_like_check and dlg.exec_():
            text = dlg.text() + suffix
            if text != '':
                cursor = self.textCursor()
                cursor.beginEditBlock()
                cursor.insertText(text)
                cursor.endEditBlock()
Esempio n. 2
0
def botarray(qtbot):
    dialog = NumpyArrayDialog(inline=False)
    qtbot.addWidget(dialog)
    dialog.show()
    return qtbot, dialog, dialog.array_widget
Esempio n. 3
0
def botarray(qtbot):
    dialog = NumpyArrayDialog(inline=False)
    qtbot.addWidget(dialog)
    dialog.show()
    return qtbot, dialog, dialog.array_widget
Esempio n. 4
0
def botinlinefloat(qtbot):
    dialog = NumpyArrayDialog(inline=True, force_float=True)
    qtbot.addWidget(dialog)
    dialog.show()
    return qtbot, dialog, dialog.array_widget
Esempio n. 5
0
def botinlinefloat(qtbot):
    dialog = NumpyArrayDialog(inline=True, force_float=True)
    qtbot.addWidget(dialog)
    dialog.show()
    return qtbot, dialog, dialog.array_widget