mirror of
https://github.com/jopohl/urh.git
synced 2026-03-24 17:07:01 +01:00
* show getting start hint in interpretation * add test for creating spectrogram * add spectrogram page to signal frame remove parent frame property from epic graphic view * prototype for spectrogram drawing (has performance issues) * enable yscale for spectrogram * regen file * enhance spectrogram performance by using QImage * enable y scale for spectrogram * add initial legend to spectrogram * fix colormap location * remove colormap legend * add more colormaps * make colormap configurable via ini * make colormap configurable in settings * make fft window size configurable * rescale Y on signal frame resize * adapt unittest to new api * allow y move with drag for spectrogram view * refactor painting backend * enable vertical selection in spectrogram graphic view * spectrum: fix order of y values * use fliplr for compat * add bandpass filter function * add narrowband iir filter * set lower bandwidth for test * add windowed sinc to filter class and adapt unittest * change default of hold shift to drag This way making a selection does not require a key modifier by default * add fft convolution * add performance test for fft convolution * speed up performance test * fix error for small data sets * add test for filtering channels * use astype for compatibility with old numpy versions * refactor context menu of graphic views * remove fft convolve performance test to avoid random fails on CI * fix spectrogram calculation * fix spectrogram calculation * improve stft performance * show samples in view for spectrogram and allow deeper zoom * enable zoom to selection for spectrogram * enable start end and selection infos for spectrogram selection * enable bandpass filtering from spectrogram * fix selection start end behavior for spectrogram * update spectrogram infos in start end edited * add unittest for channel separation * enhance architecture of spectrogram management * add class SpectrogramSceneManager * cache spectrogram * fix x axis orientation * move scene managers to painting * redraw on fft size update * add lod slider for spectrogram * remove unused stuff * add tooltip for lod slider * update selected bandwidth on sample rate changed * add update for gv signal on resize * fix fftshift parameter * remove xflip as this is corrected by fftshift now * remove lod slider as it leads to confusion and low lods are hard to see * clip f_low and f_high * update spectrogram images on colormap change * set loading cursor right before bandpass filtering signal * add select all action with ctrl+a to graphic views * use parameters from original signal for newly created signals * fix noise level in unittest * improve spectrogram performance by splitting image into segments * avoid division by zero * fix unittest * improve signal redraw on resize * add created signal right under original signal * adapt unittest to filtered frame created under original signal * add dialog for configure bandwidth and display default values * make bandwidth configurable * fix spectrogram scene rect for small signals * make data min and data max for spectrogram configurable * use object names for indexing settings as texts are not reliable Some OSes insert & before texts probably for shortcuts * use heuristic to choose normal or FFT convolution * suggest a filename for unsaved signals based on their name * fix subpath range calculation * use window for subpath drawing to avoid flickering colors
70 lines
2.2 KiB
Python
70 lines
2.2 KiB
Python
import os
|
|
import sys
|
|
import unittest
|
|
|
|
import sip
|
|
|
|
from PyQt5.QtCore import Qt
|
|
from PyQt5.QtTest import QTest
|
|
from PyQt5.QtWidgets import QApplication
|
|
|
|
from tests.utils_testing import write_settings, get_path_for_data_file
|
|
from urh.controller.MainController import MainController
|
|
|
|
import faulthandler
|
|
|
|
faulthandler.enable()
|
|
|
|
|
|
class QtTestCase(unittest.TestCase):
|
|
CLOSE_TIMEOUT = 10
|
|
WAIT_TIMEOUT_BEFORE_NEW = 10
|
|
SHOW = os.path.exists(os.path.join(os.path.dirname(os.path.realpath(__file__)), "show_gui"))
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
write_settings()
|
|
cls.app = QApplication(sys.argv)
|
|
|
|
@classmethod
|
|
def tearDownClass(cls):
|
|
cls.app.quit()
|
|
sip.delete(cls.app)
|
|
cls.app = None
|
|
|
|
def setUp(self):
|
|
self.form = MainController()
|
|
if self.SHOW:
|
|
self.form.show()
|
|
|
|
def wait_before_new_file(self):
|
|
QApplication.instance().processEvents()
|
|
QTest.qWait(self.WAIT_TIMEOUT_BEFORE_NEW)
|
|
|
|
def add_signal_to_form(self, filename: str):
|
|
self.wait_before_new_file()
|
|
self.form.add_signalfile(get_path_for_data_file(filename))
|
|
|
|
def get_path_for_filename(self, filename) -> str:
|
|
return get_path_for_data_file(filename)
|
|
|
|
def add_signal_to_generator(self, signal_index: int):
|
|
gframe = self.form.generator_tab_controller
|
|
item = gframe.tree_model.rootItem.children[0].children[signal_index]
|
|
index = gframe.tree_model.createIndex(signal_index, 0, item)
|
|
rect = gframe.ui.treeProtocols.visualRect(index)
|
|
QTest.mousePress(gframe.ui.treeProtocols.viewport(), Qt.LeftButton, pos=rect.center())
|
|
self.assertEqual(gframe.ui.treeProtocols.selectedIndexes()[0], index)
|
|
mimedata = gframe.tree_model.mimeData(gframe.ui.treeProtocols.selectedIndexes())
|
|
gframe.table_model.dropMimeData(mimedata, 1, -1, -1, gframe.table_model.createIndex(0, 0))
|
|
|
|
def tearDown(self):
|
|
if hasattr(self, "dialog"):
|
|
self.dialog.close()
|
|
if hasattr(self, "form"):
|
|
self.form.close_all()
|
|
if self.SHOW:
|
|
self.form.close()
|
|
QApplication.instance().processEvents()
|
|
QTest.qWait(self.CLOSE_TIMEOUT)
|