def doDialog(self, parentWidgetPtr): log.debug('CalcyPy::doDialog ...') parentWidget = wrapInstance(parentWidgetPtr, QWidget) self.widget = CalcyGui.CalcyOption(parentWidget, self.setting_dir, self.settings) self.widget.show() return getCppPointer(self.widget)[0]
def shouldBeVisible(self, view_frame): if not view_frame: return False if USING_PYSIDE6: import shiboken6 as shiboken else: import shiboken2 as shiboken vf_ptr = shiboken.getCppPointer(view_frame)[0] return self._visible_for_view[vf_ptr]
def series_to_polyline(xdata, ydata): #inspired from https://github.com/PierreRaybaut/plotpy/wiki/Using-Qt-Charts-(PyQtChart)-to-plot-curves-efficiently-in-Python! size = len(xdata) polyline = QPolygonF() polyline.resize(size) address = shiboken6.getCppPointer(polyline.data())[0] buffer = (2 * size * ctypes.c_double).from_address( address) #QPolygonF float type is qreal, which is double memory = np.frombuffer(buffer, xdata.dtype) memory[:(size - 1) * 2 + 1:2] = xdata memory[1:(size - 1) * 2 + 2:2] = ydata return polyline
def notifyViewChanged(self, view_frame): if not view_frame: self._active_view = None return if USING_PYSIDE6: import shiboken6 as shiboken else: import shiboken2 as shiboken self._active_view = shiboken.getCppPointer(view_frame)[0] if self.visible: dock_handler = DockHandler.getActiveDockHandler() dock_handler.setVisible(self.m_name, True)
def get_data_buffer(self, size: int): self.resize(size) if API == "pyside6": import shiboken6 address = shiboken6.getCppPointer(self.data()) buffer = (ctypes.c_long * 2 * self.size()).from_address(address[0]) elif API == "pyside2": import shiboken2 address = shiboken2.getCppPointer(self.data()) buffer = (ctypes.c_long * 2 * self.size()).from_address(address) else: buffer = self.data() buffer.setsize(8 * self.size()) return buffer