Skip to content

Commit

Permalink
Merge branch 'jopohl:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jpacov authored Oct 24, 2023
2 parents 40ac018 + 26f99e1 commit 53f1bd1
Show file tree
Hide file tree
Showing 37 changed files with 673 additions and 175 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-2019, macos-10.15]
os: [ubuntu-latest, windows-2019, macos-11]
python-version: ['3.7', '3.8', '3.9', '3.10']
architecture: [x64]
include:
Expand All @@ -29,11 +29,11 @@ jobs:
python-version: '3.9'
- os: windows-2019
python-version: '3.10'
- os: macOS-10.15
- os: macOS-11
python-version: '3.7'
- os: macOS-10.15
- os: macOS-11
python-version: '3.8'
- os: macOS-10.15
- os: macOS-11
python-version: '3.10'

fail-fast: false
Expand Down Expand Up @@ -69,8 +69,7 @@ jobs:
pip install PyVirtualDisplay==0.2.5
elif [[ $OS == windows* ]]
then
pip install pywin32 pipwin
pipwin install pyaudio
pip install pywin32 pyaudio
elif [[ $OS == mac* ]]
then
brew tap pothosware/homebrew-pothos
Expand Down Expand Up @@ -193,3 +192,4 @@ jobs:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/"
OS: ${{ matrix.os }}
2 changes: 1 addition & 1 deletion data/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy
pyqt5
psutil
cython!=0.29.18
cython<3.0.0
162 changes: 86 additions & 76 deletions data/ui/generator.ui
Original file line number Diff line number Diff line change
Expand Up @@ -524,39 +524,7 @@ image: url(:/icons/icons/splitter_handle_vertical.svg);
<property name="bottomMargin">
<number>11</number>
</property>
<item row="2" column="6">
<widget class="QComboBox" name="cbViewType">
<item>
<property name="text">
<string>Bit</string>
</property>
</item>
<item>
<property name="text">
<string>Hex</string>
</property>
</item>
<item>
<property name="text">
<string>ASCII</string>
</property>
</item>
</widget>
</item>
<item row="2" column="5">
<widget class="QLabel" name="lViewType">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Viewtype:</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="7">
<item row="1" column="0" colspan="8">
<widget class="GeneratorTableView" name="tableMessages">
<property name="acceptDrops">
<bool>true</bool>
Expand Down Expand Up @@ -599,7 +567,83 @@ image: url(:/icons/icons/splitter_handle_vertical.svg);
</attribute>
</widget>
</item>
<item row="0" column="0" colspan="7">
<item row="2" column="0">
<widget class="QPushButton" name="btnNetworkSDRSend">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Send encoded data to your external application via TCP.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Send via Network</string>
</property>
<property name="icon">
<iconset theme="network-wired">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="4" colspan="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>38</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="7">
<widget class="QComboBox" name="cbViewType">
<item>
<property name="text">
<string>Bit</string>
</property>
</item>
<item>
<property name="text">
<string>Hex</string>
</property>
</item>
<item>
<property name="text">
<string>ASCII</string>
</property>
</item>
</widget>
</item>
<item row="2" column="6">
<widget class="QLabel" name="lViewType">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Viewtype:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="btnRfCatSend">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Send encoded data via RfCat. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Hit again for stopping the sending process. Note that you can set the number of repetitions (from 1 to infinite) in:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Edit-&amp;gt;Options-&amp;gt;Device-&amp;gt;'Device sending repetitions'&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Send via RfCat</string>
</property>
<property name="icon">
<iconset theme="network-wireless">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
<item row="0" column="0" colspan="8">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>0</number>
Expand Down Expand Up @@ -671,38 +715,7 @@ image: url(:/icons/icons/splitter_handle_vertical.svg);
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="btnNetworkSDRSend">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Send encoded data to your external application via TCP.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Send via Network</string>
</property>
<property name="icon">
<iconset theme="network-wired">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="btnRfCatSend">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Send encoded data via RfCat. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Hit again for stopping the sending process. Note that you can set the number of repetitions (from 1 to infinite) in:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Edit-&amp;gt;Options-&amp;gt;Device-&amp;gt;'Device sending repetitions'&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Send via RfCat</string>
</property>
<property name="icon">
<iconset theme="network-wireless">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="2" column="3">
<widget class="QLabel" name="lEstimatedTime">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The estimated average time is based on the average number of bits per message and average sample rate, you set for the modulations.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
Expand All @@ -712,18 +725,15 @@ image: url(:/icons/icons/splitter_handle_vertical.svg);
</property>
</widget>
</item>
<item row="2" column="3" colspan="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="2" column="2">
<widget class="QPushButton" name="btnFZSave">
<property name="text">
<string>Save as FlipperZero SubGHz</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>38</width>
<height>22</height>
</size>
<property name="icon">
<iconset theme="document-save-as"/>
</property>
</spacer>
</widget>
</item>
</layout>
</widget>
Expand Down
12 changes: 3 additions & 9 deletions data/ui/options.ui
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,12 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxFontSize">
<widget class="QDoubleSpinBox" name="doubleSpinBoxFontSize">
<property name="suffix">
<string>pt</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>120</number>
</property>
<property name="value">
<number>10</number>
<double>1.000000000000000</double>
</property>
</widget>
</item>
Expand Down Expand Up @@ -282,7 +276,7 @@
<x>0</x>
<y>0</y>
<width>762</width>
<height>397</height>
<height>466</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4"/>
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def read_long_description():
return ""


install_requires = ["numpy", "psutil", "cython"]
install_requires = ["numpy", "psutil", "cython<3.0.0"]
if IS_RELEASE:
install_requires.append("pyqt5")
else:
Expand Down
28 changes: 27 additions & 1 deletion src/urh/controller/GeneratorTabController.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np
from PyQt5.QtCore import Qt, pyqtSlot
from PyQt5.QtGui import QFontMetrics
from PyQt5.QtWidgets import QInputDialog, QWidget, QUndoStack, QApplication
from PyQt5.QtWidgets import QInputDialog, QWidget, QUndoStack, QApplication, QFileDialog

from urh import settings
from urh.controller.CompareFrameController import CompareFrameController
Expand All @@ -18,6 +18,7 @@
from urh.plugins.NetworkSDRInterface.NetworkSDRInterfacePlugin import NetworkSDRInterfacePlugin
from urh.plugins.PluginManager import PluginManager
from urh.plugins.RfCat.RfCatPlugin import RfCatPlugin
from urh.plugins.FlipperZeroSub.FlipperZeroSubPlugin import FlipperZeroSubPlugin
from urh.signalprocessing.IQArray import IQArray
from urh.signalprocessing.Message import Message
from urh.signalprocessing.MessageType import MessageType
Expand Down Expand Up @@ -63,6 +64,10 @@ def __init__(self, compare_frame_controller: CompareFrameController, project_man
self.rfcat_plugin = RfCatPlugin()
self.init_rfcat_plugin()

# Flipper Zero Sub Plugin
self.set_FZSave_button_visibility()
self.flipperzerosub_plugin = FlipperZeroSubPlugin()

self.modulation_msg_indices = []

self.refresh_modulators()
Expand Down Expand Up @@ -156,6 +161,9 @@ def create_connects(self, compare_frame_controller):
self.network_sdr_plugin.sending_stop_requested.connect(self.on_network_sdr_sending_stop_requested)
self.network_sdr_plugin.current_send_message_changed.connect(self.on_send_message_changed)

# Flipper Zero
self.ui.btnFZSave.clicked.connect(self.on_btn_FZSave_clicked)

@pyqtSlot()
def refresh_tree(self):
self.tree_model.beginResetModel()
Expand Down Expand Up @@ -647,6 +655,24 @@ def set_rfcat_button_visibility(self):
is_plugin_enabled = PluginManager().is_plugin_enabled("RfCat")
self.ui.btnRfCatSend.setVisible(is_plugin_enabled)

def set_FZSave_button_visibility(self):
is_plugin_enabled = PluginManager().is_plugin_enabled("FlipperZeroSub")
self.ui.btnFZSave.setVisible(is_plugin_enabled)

@pyqtSlot()
def on_btn_FZSave_clicked(self):
filename, _ = QFileDialog.getSaveFileName(self, self.tr("Choose file"), directory=FileOperator.RECENT_PATH,
filter="SUB files (*.sub);;All files (*.*)")
if len(filename) > 0:
if not filename.endswith(".sub"):
filename = filename+".sub"

messages = self.table_model.protocol.messages
sample_rates = [self.__get_modulator_of_message(msg).sample_rate for msg in messages]
self.flipperzerosub_plugin.write_sub_file(filename, messages, sample_rates, self.modulators, self.project_manager)
else:
logger.debug("Filename was empty!")

@pyqtSlot()
def on_btn_network_sdr_clicked(self):
if not self.network_sdr_plugin.is_sending:
Expand Down
2 changes: 2 additions & 0 deletions src/urh/controller/MainController.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,8 @@ def on_options_changed(self, changed_options: dict):
self.generator_tab_controller.init_rfcat_plugin()
self.generator_tab_controller.set_modulation_profile_status()
self.simulator_tab_controller.refresh_field_types_for_labels()
# Flipper Zero
self.generator_tab_controller.set_FZSave_button_visibility()

if "num_sending_repeats" in changed_options:
self.project_manager.device_conf["num_sending_repeats"] = changed_options["num_sending_repeats"]
Expand Down
8 changes: 4 additions & 4 deletions src/urh/controller/dialogs/OptionsDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __init__(self, installed_plugins, highlighted_plugins=None, parent=None):
completer.setModel(QDirModel(completer))
self.ui.lineEditGRPythonInterpreter.setCompleter(completer)

self.ui.spinBoxFontSize.setValue(qApp.font().pointSize())
self.ui.doubleSpinBoxFontSize.setValue(qApp.font().pointSizeF())

self.refresh_device_tab()

Expand Down Expand Up @@ -242,7 +242,7 @@ def create_connects(self):
self.ui.checkBoxMultipleModulations.clicked.connect(self.on_checkbox_multiple_modulations_clicked)
self.ui.btnViewBuildLog.clicked.connect(self.on_btn_view_build_log_clicked)
self.ui.labelDeviceMissingInfo.linkActivated.connect(self.on_label_device_missing_info_link_activated)
self.ui.spinBoxFontSize.editingFinished.connect(self.on_spin_box_font_size_editing_finished)
self.ui.doubleSpinBoxFontSize.editingFinished.connect(self.on_spin_box_font_size_editing_finished)

def show_gnuradio_infos(self):
self.ui.lineEditGRPythonInterpreter.setText(self.backend_handler.gr_python_interpreter)
Expand Down Expand Up @@ -468,9 +468,9 @@ def on_label_device_missing_info_link_activated(self, link: str):

@pyqtSlot()
def on_spin_box_font_size_editing_finished(self):
settings.write("font_size", self.ui.spinBoxFontSize.value())
settings.write("font_size", self.ui.doubleSpinBoxFontSize.value())
font = qApp.font()
font.setPointSize(self.ui.spinBoxFontSize.value())
font.setPointSizeF(self.ui.doubleSpinBoxFontSize.value())
qApp.setFont(font)

@pyqtSlot(bool)
Expand Down
5 changes: 5 additions & 0 deletions src/urh/controller/widgets/SignalFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@ def show_protocol(self, old_view=-1, refresh=False):
return

if not self.ui.chkBoxShowProtocol.isChecked():
if refresh:
self.update_protocol()
return

if old_view == -1:
Expand Down Expand Up @@ -736,6 +738,9 @@ def set_protocol_visibility(self):
self.ui.chkBoxSyncSelection.hide()
self.ui.cbProtoView.setEnabled(False)

qApp.processEvents()
self.on_slider_y_scale_value_changed()

@pyqtSlot()
def on_cb_signal_view_index_changed(self):
self.setCursor(Qt.WaitCursor)
Expand Down
Loading

0 comments on commit 53f1bd1

Please sign in to comment.