mirror of
https://github.com/jopohl/urh.git
synced 2026-03-10 18:26:48 +01:00
avoid changes in project files if no changes in project happened
This commit is contained in:
@@ -61,7 +61,7 @@ class Participant(object):
|
||||
root.set("color_index", str(self.color_index))
|
||||
root.set("id", str(self.__id))
|
||||
root.set("relative_rssi", str(self.relative_rssi))
|
||||
root.set("simulate", str(int(self.simulate)))
|
||||
root.set("simulate", str(int(bool(self.simulate))))
|
||||
|
||||
return root
|
||||
|
||||
|
||||
@@ -10,9 +10,12 @@ from urh.util.Formatter import Formatter
|
||||
|
||||
class SimulatorMessage(Message, SimulatorItem):
|
||||
def __init__(self, destination: Participant, plain_bits,
|
||||
pause: int, message_type: MessageType, decoder=None, source=None):
|
||||
pause: int, message_type: MessageType, decoder=None, source=None, timestamp=None):
|
||||
Message.__init__(self, plain_bits, pause, message_type, decoder=decoder, participant=source)
|
||||
SimulatorItem.__init__(self)
|
||||
if timestamp is not None:
|
||||
self.timestamp = timestamp
|
||||
|
||||
self.destination = destination
|
||||
self.send_recv_messages = []
|
||||
self.repeat = 1
|
||||
@@ -81,4 +84,5 @@ class SimulatorMessage(Message, SimulatorItem):
|
||||
decoders=decoders,
|
||||
message_types=message_types)
|
||||
destination = Participant.find_matching(tag.get("destination_id", ""), participants)
|
||||
return SimulatorMessage(destination, msg.plain_bits, msg.pause, msg.message_type, msg.decoder, msg.participant)
|
||||
return SimulatorMessage(destination, msg.plain_bits, msg.pause, msg.message_type, msg.decoder, msg.participant,
|
||||
timestamp=msg.timestamp)
|
||||
|
||||
@@ -484,13 +484,14 @@ class SimulatorScene(QGraphicsScene):
|
||||
for protocol in protocols_to_add:
|
||||
for msg in protocol.messages:
|
||||
source, destination = self.detect_source_destination(msg)
|
||||
|
||||
messages.append(self.create_message(destination=destination,
|
||||
simulator_msg = self.create_message(destination=destination,
|
||||
plain_bits=copy.copy(msg.decoded_bits),
|
||||
pause=0,
|
||||
message_type=msg.message_type,
|
||||
decoder=msg.decoder,
|
||||
source=source))
|
||||
source=source)
|
||||
simulator_msg.timestamp = msg.timestamp
|
||||
messages.append(simulator_msg)
|
||||
|
||||
self.simulator_config.add_items(messages, pos, parent)
|
||||
|
||||
|
||||
@@ -153,7 +153,6 @@ class ProjectManager(QObject):
|
||||
|
||||
self.decodings = decodings if decodings else fallback
|
||||
|
||||
|
||||
@staticmethod
|
||||
def read_device_conf_dict(tag: ET.Element, target_dict):
|
||||
if tag is None:
|
||||
@@ -161,7 +160,10 @@ class ProjectManager(QObject):
|
||||
|
||||
for dev_tag in tag:
|
||||
try:
|
||||
value = float(dev_tag.text)
|
||||
try:
|
||||
value = int(dev_tag.text)
|
||||
except ValueError:
|
||||
value = float(dev_tag.text)
|
||||
except ValueError:
|
||||
value = dev_tag.text
|
||||
target_dict[dev_tag.tag] = value
|
||||
|
||||
Reference in New Issue
Block a user