class CommandView(BaseView): __gtype_name__ = 'CommandView' def __init__(self, command, name, active_widget=None, name_widget=None, value_widget=None, units_widget=None, helper=None): self.command = Command(command) self.command.connect('data-changed', self._data_changed_cb) BaseView.__init__(self, active_widget, name_widget, value_widget, helper) def _do_sensitize_widgets(self): pass def _do_update_view(self): data = self.command.data if not data: data = '' if self.value_widget: self.value_widget.set_text(data)
def data_changed_cb(cmd, pspec): offset = int(cmd.command[2:4]) self._supported_pids += decode_pids_from_bitstring(cmd.data, offset, self._frame) next = '%d' % (offset + 20) if '02' + next in self._supported_pids: command = Command('02' + next + self._frame) command.connect('notify::data', data_changed_cb) self.plugin.app.queue.add(command, True) else: self._update_supported_views()
def __init__(self, command, name, active_widget=None, name_widget=None, value_widget=None, units_widget=None, helper=None): self.command = Command(command) self.command.connect('data-changed', self._data_changed_cb) BaseView.__init__(self, active_widget, name_widget, value_widget, helper)
def __init__(self, command, name, active_widget=None, name_widget=None, value_widget=None, units_widget=None, helper=None): self.command = Command(command) self.command.connect('notify::data', self._data_changed_cb) BaseView.__init__(self, active_widget, name_widget, value_widget, helper)
def _get_supported_pids(self): def data_changed_cb(cmd, pspec): offset = int(cmd.command[2:4]) self._supported_pids += decode_pids_from_bitstring(cmd.data, offset, self._frame) next = '%d' % (offset + 20) if '02' + next in self._supported_pids: command = Command('02' + next + self._frame) command.connect('notify::data', data_changed_cb) self.plugin.app.queue.add(command, True) else: self._update_supported_views() def error_cb(cmd, msg, args): log.error('error reading supported pids, msg is: %s' % msg) raise OBDPortError('OpenPortFailed', _('could not read supported pids\n\n' + msg)) self._supported_pids = [] command = Command('0200' + self._frame) command.connect('notify::data', data_changed_cb) self.plugin.app.queue.add(command, True)
class CommandView(BaseView): __gtype_name__ = 'CommandView' def __init__(self, command, name, active_widget=None, name_widget=None, value_widget=None, units_widget=None, helper=None): self.command = Command(command) self.command.connect('notify::data', self._data_changed_cb) BaseView.__init__(self, active_widget, name_widget, value_widget, helper) def _do_sensitize_widgets(self): pass def _do_update_view(self): data = self.command.data if not data: data = '' if self.value_widget: self.value_widget.set_text(data)