add default value to read settings for backward compatibility

This commit is contained in:
Johannes Pohl
2017-02-05 16:16:37 +01:00
parent b09c4328d9
commit cded63cd57
3 changed files with 9 additions and 10 deletions

View File

@@ -104,11 +104,11 @@ class SignalTabController(QWidget):
@pyqtSlot(bool)
def set_shift_statuslabel(self, shift_pressed):
if shift_pressed and constants.SETTINGS.value('hold_shift_to_drag', type=bool):
if shift_pressed and constants.SETTINGS.value('hold_shift_to_drag', False, type=bool):
self.ui.lShiftStatus.setText("[SHIFT] Use Mouse to scroll signal.")
self.ui.lCtrlStatus.clear()
elif shift_pressed and not constants.SETTINGS.value('hold_shift_to_drag', type=bool):
elif shift_pressed and not constants.SETTINGS.value('hold_shift_to_drag', False, type=bool):
self.ui.lShiftStatus.setText("[SHIFT] Use mouse to create a selection.")
self.ui.lCtrlStatus.clear()
else:
@@ -135,7 +135,7 @@ class SignalTabController(QWidget):
# Neues Signal aus "Create Signal from Selection"
sig_frame.ui.btnSaveSignal.show()
sig_frame.hold_shift = constants.SETTINGS.value('hold_shift_to_drag', type=bool)
sig_frame.hold_shift = constants.SETTINGS.value('hold_shift_to_drag', False, type=bool)
sig_frame.closed.connect(self.close_frame)
sig_frame.signal_created.connect(self.signal_created.emit)
sig_frame.drag_started.connect(self.frame_dragged)
@@ -182,7 +182,7 @@ class SignalTabController(QWidget):
sig_frame.files_dropped.connect(self.handle_files_dropped)
sig_frame.setMinimumHeight(sig_frame.height())
sig_frame.closed.connect(self.close_frame)
sig_frame.hold_shift = constants.SETTINGS.value('hold_shift_to_drag', type=bool)
sig_frame.hold_shift = constants.SETTINGS.value('hold_shift_to_drag', False, type=bool)
sig_frame.set_empty_frame_visibilities()
@@ -282,4 +282,4 @@ class SignalTabController(QWidget):
def refresh_participant_information(self):
for sframe in self.signal_frames:
sframe.on_participant_changed()
sframe.on_participant_changed()

View File

@@ -320,7 +320,7 @@ class Message(object):
@property
def decoded_bits_buffer(self) -> bytes:
bits = [b if isinstance(b, bool) else True if b.pulsetype == 1 else False for b in self.decoded_bits]
bits = [int(b) if isinstance(b, bool) else 1 if b.pulsetype == 1 else 0 for b in self.decoded_bits]
return np.packbits(bits).tobytes()
@property
@@ -328,7 +328,6 @@ class Message(object):
padded_bitchains = self.split(decode=False)
return self.__bitchains_to_hex(padded_bitchains)
@property
def plain_ascii_str(self) -> str:
padded_bitchains = self.split(decode=False)
@@ -578,4 +577,4 @@ class Message(object):
def get_label_range(self, lbl: ProtocolLabel, view: int, decode: bool):
start = self.convert_index(index=lbl.start, from_view=0, to_view=view, decoded=decode)[0]
end = self.convert_index(index=lbl.end, from_view=0, to_view=view, decoded=decode)[1]
return int(start), int(end)
return int(start), int(end)

View File

@@ -49,7 +49,7 @@ class SelectableGraphicView(QGraphicsView):
@property
def hold_shift_to_drag(self) -> bool:
return constants.SETTINGS.value('hold_shift_to_drag', type=bool)
return constants.SETTINGS.value('hold_shift_to_drag', False, type=bool)
def is_pos_in_separea(self, pos: QPoint):
"""
@@ -253,4 +253,4 @@ class SelectableGraphicView(QGraphicsView):
"""
topLeft = self.mapToScene(0, 0)
bottomRight = self.mapToScene(self.viewport().width() - 1, self.viewport().height() - 1 )
return QRectF(topLeft, bottomRight)
return QRectF(topLeft, bottomRight)