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 - 14 y = rect.top() + (rect.bottom() - rect.top()) / 2 y = y - dlg.height() / 2 - 3 pos = QPoint(x, y) pos = self.calculate_real_position(pos) 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()
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()
def botarray(qtbot): dialog = NumpyArrayDialog(inline=False) qtbot.addWidget(dialog) dialog.show() return qtbot, dialog, dialog.array_widget
def botinlinefloat(qtbot): dialog = NumpyArrayDialog(inline=True, force_float=True) qtbot.addWidget(dialog) dialog.show() return qtbot, dialog, dialog.array_widget