mirror of
https://github.com/jopohl/urh.git
synced 2026-03-24 17:07:01 +01:00
draw anti aliased preview of signal
This commit is contained in:
@@ -15,7 +15,7 @@ class InsertSinePlugin(SignalEditorPlugin):
|
||||
self.dialog_ui = uic.loadUi(os.path.realpath(os.path.join(dirname, "insert_sine_dialog.ui"))) # type: QDialog
|
||||
|
||||
self.amplitude = 1
|
||||
self.frequency = 1e6
|
||||
self.frequency = 10
|
||||
self.phase = 0
|
||||
self.sample_rate = 1e6
|
||||
self.num_samples = 1e6
|
||||
@@ -42,6 +42,7 @@ class InsertSinePlugin(SignalEditorPlugin):
|
||||
def show_insert_sine_dialog(self):
|
||||
self.dialog_ui.show()
|
||||
self.__create_dialog_connects()
|
||||
self.draw_sine_wave()
|
||||
|
||||
def draw_sine_wave(self):
|
||||
self.complex_wave = np.empty(int(self.num_samples), dtype=np.complex64)
|
||||
@@ -50,6 +51,7 @@ class InsertSinePlugin(SignalEditorPlugin):
|
||||
self.complex_wave.imag = self.amplitude * np.sin(2 * np.pi * self.frequency * t + self.phase)
|
||||
|
||||
self.dialog_ui.graphicsViewSineWave.plot_data(self.complex_wave.imag.astype(np.float32))
|
||||
self.dialog_ui.graphicsViewSineWave.draw_full()
|
||||
|
||||
@pyqtSlot(float)
|
||||
def on_double_spin_box_amplitude_value_changed(self, value: float):
|
||||
|
||||
@@ -160,7 +160,11 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="ZoomableGraphicView" name="graphicsViewSineWave"/>
|
||||
<widget class="ZoomableGraphicView" name="graphicsViewSineWave">
|
||||
<property name="renderHints">
|
||||
<set>QPainter::Antialiasing|QPainter::HighQualityAntialiasing|QPainter::TextAntialiasing</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from PyQt5.QtCore import pyqtSignal, QRectF
|
||||
from PyQt5.QtGui import QResizeEvent
|
||||
from PyQt5.QtGui import QWheelEvent
|
||||
from PyQt5.QtWidgets import QGraphicsScene
|
||||
|
||||
@@ -71,4 +72,8 @@ class ZoomableGraphicView(SelectableGraphicView):
|
||||
if self.scene_creator is not None:
|
||||
x1 = self.view_rect().x()
|
||||
x2 = x1 + self.view_rect().width()
|
||||
self.scene_creator.show_scene_section(x1, x2)
|
||||
self.scene_creator.show_scene_section(x1, x2)
|
||||
|
||||
def resizeEvent(self, event: QResizeEvent):
|
||||
self.draw_full()
|
||||
event.accept()
|
||||
Reference in New Issue
Block a user