avoid changes in project files if no changes in project happened

This commit is contained in:
Johannes Pohl
2018-11-12 10:49:11 +01:00
parent 892b77aaa5
commit f50d4714fc
4 changed files with 15 additions and 8 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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