Example #1
0
 def __init__(self, command, index=0, units='Metric'):
     self._indices = len(SENSORS[command[2:4]])
     self._imperial_units = None
     self._metric_units = None
     self._decoder = None
     Command.__init__(self, command)
     PropertyObject.__init__(self, command=command, index=index)
Example #2
0
    def __init__(self, app):
        OBDDevice.__init__(self)
        PropertyObject.__init__(self)

        # TODO: ignore for the moment (see request_baudrate)
        # self._current_baudrate = self.initial_baudrate
        # self._requested_baudrate = None

        self.app = app
        self._connected = False
        self._serial = None
        self._watch_id = None
        
        self._supported_pids = []
        
        self._sent_command = None
        self._cleanup_command = True
        self._ret_cb = None
        self._err_cb = None
        self._cb_args = None

        self.app.prefs.register('device.port', '/dev/ttyUSB0')
        self.app.prefs.register('device.baudrate', 38400)
        self.app.prefs.register('device.ignore-keywords', False)

        fname = os.path.join(garmon.dirs.UI, 'device_prefs.ui')
        self.app.builder.add_from_file(fname)
        
        combo = self.app.builder.get_object('preference;combo;int;device.baudrate')
        cell = gtk.CellRendererText()
        combo.pack_start(cell, True)
        combo.add_attribute(cell, 'text', 0)
        
        self.app.prefs.add_dialog_page('device_prefs_vbox', _('Device'))
Example #3
0
    def __init__(self, plugin, frame):
        GObject.__init__(self)
        PropertyObject.__init__(self)
        log.debug('Initializing FreezeFrame ' + frame)
        
        self.plugin = plugin 
        self._frame = frame
		
        self._pref_cbs = []
        self._app_cbs = []
        self._notebook_cbs = []
        self._queue_cbs = []
        self._obd_cbs = []
        
        if plugin.app.prefs.get('imperial', False):
            self._unit_standard = 'Imperial'
        else:
            self._unit_standard = 'Metric'
            
        cb_id = plugin.app.prefs.add_watch('imperial', 
                                    self._notify_units_cb)
        self._pref_cbs.append(('imperial', cb_id))
        
        self._setup_gui()
        self._setup_sensors()
        self._get_supported_pids()
Example #4
0
    def __init__(self, device):
        """ @param device: the OBDDevice to send commands
            @param timeout: the time between two commands
        """
        GObject.__init__(self)
        PropertyObject.__init__(self, device=device)
        self._queue = []

        self._working = False
Example #5
0
 def __init__(self, queue):
     GObject.__init__(self)
     PropertyObject.__init__(self)
     
     self._rate = 0
     self._samples = []
     self.set_text(_('command rate: N/A'))
     
     queue.connect('command_executed', self._queue_command_executed_cb)
     queue.connect('notify::working', self._queue_notify_working_cb)
Example #6
0
    def __init__(self, builder):
        GObject.__init__(self)
        PropertyObject.__init__(self)

        self._code_label = builder.get_object('code_label')
        self._class_label = builder.get_object('class_label')
        self._description_label = builder.get_object('description_label')
        self._additional_textview = builder.get_object('additional_textview')
    
        self._additional_buffer = gtk.TextBuffer()
        self._additional_textview.set_buffer(self._additional_buffer)
Example #7
0
    def __init__(self, app):
        gtk.Entry.__init__(self, 3)
        self.command = Sensor('0101', 1)
        PropertyObject.__init__(self)

        self._pref_cbs = []
        
        self.app = app
        self.set_text('MIL')
        self.set_property('editable', False)
        self.set_property('width-chars', 3)
Example #8
0
 def __init__(self, pid, index=0, units='Metric',
                    active_widget=None, name_widget=None,
                    value_widget=None, units_widget=None,
                    helper=None):
     
     self.command = Sensor(pid, index)
     self.command.connect('notify::data', self._data_changed_cb)
     
     BaseView.__init__(self, active_widget, name_widget,
                             value_widget, helper)
     PropertyObject.__init__(self, active_widget=active_widget,
                                   name_widget=name_widget,
                                   value_widget=value_widget,
                                   units_widget=units_widget,
                                   unit_standard=units,
                                   helper=helper)
Example #9
0
    def __init__(self, app):
        Plugin.__init__(self)
        PropertyObject.__init__(self)

        self.app = app
	
        self._pref_cbs = []
        self._app_cbs = []
        self._notebook_cbs = []
        self._queue_cbs = []
        self._obd_cbs = []

        self.status = STATUS_STOP

        self._frames = []

        self._setup_gui()
Example #10
0
    def __init__(self, app):
        """ @param app: GarmonApp
        """
        gtk.Dialog.__init__(self, _("Garmon Plugin Manager"),
                                  app.window, gtk.DIALOG_DESTROY_WITH_PARENT,
                                  (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE,))
        PropertyObject.__init__(self)
                                  
        self.app = app

        
        self._active_plugins = []
        
        self.resize(550, 300)
        
        hbox = gtk.HBox(False, 10)
        self.vbox.pack_start(hbox)
        hbox.show()
        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        hbox.pack_start(sw, False, False, 0)

        # create tree model
        self._treemodel = self._create_treemodel()

        # create tree view
        listview = gtk.TreeView(self._treemodel)
        listview.set_rules_hint(True)
        listview.set_headers_visible(False)
        listview.set_search_column(COLUMN_NAME)
        
        selection = listview.get_selection()
        selection.set_mode(gtk.SELECTION_SINGLE)

        selection.connect("changed", self._selection_changed)
        
        sw.add(listview)
        
        # add columns to the tree view
        self._add_columns(listview)
        
        self._info_box = PluginInfoBox()
        hbox.pack_start(self._info_box, False)
        
        self._load_available_plugins()
Example #11
0
 def __init__(self, pid, index=0,
                    min_value=0, max_value=100,
                    active_widget=None, name_widget=None,
                    value_widget=None,
                    helper=None, progress_widget=None):
     
     self.command = Sensor(pid, index)
     self.command.connect('notify::data', self._data_changed_cb)
     
     BaseView.__init__(self, active_widget, name_widget,
                               value_widget, helper)
     PropertyObject.__init__(self, active_widget=active_widget,
                                   name_widget=name_widget,
                                   value_widget=value_widget,
                                   helper=helper,
                                   progress_widget=progress_widget,
                                   min_value=min_value,
                                   max_value=max_value)
Example #12
0
 def __init__(self, active_widget=None, name_widget=None,
                    value_widget=None, helper=None):
                    
     GObject.__init__(self)
     PropertyObject.__init__(self, active_widget=active_widget,
                                   name_widget=name_widget,
                                   value_widget=value_widget,
                                   helper=helper)
     
     self._toggleable = False
     if active_widget:
         if isinstance(active_widget, gtk.ToggleButton):
             self._toggleable = True
             self.active = active_widget.get_active()
             active_widget.connect('toggled', self._active_toggled_cb)
         elif isinstance(active_widget, gtk.Button):
             self._togglable = False
             active_widget.connect('clicked', self._active_clicked_cb)
         else:
             raise ValueError, 'active_widget should be gtk.Button or gtk.ToggleButton'
Example #13
0
 def __init__(self):
     GObject.__init__(self)
     PropertyObject.__init__(self)
Example #14
0
 def __init__(self, command):
     GObject.__init__(self)
     PropertyObject.__init__(self, command=command)