def handle_get_window_list_reply (self, window_list): if len(window_list) > 0: window_obj = EvinceWindowProxy.bus.get_object(self.dbus_name, window_list[0]) self.window = dbus.Interface(window_obj,EV_WINDOW_IFACE) else: #That should never happen. nvimr_warn("GetWindowList returned empty list")
def __init__(self, uri, spawn=False): self.uri = uri self.spawn = spawn self.status = CLOSED self.dbus_name = '' self._handler = None try: if EvinceWindowProxy.bus is None: EvinceWindowProxy.bus = dbus.SessionBus() if EvinceWindowProxy.daemon is None: EvinceWindowProxy.daemon = EvinceWindowProxy.bus.get_object( EV_DAEMON_NAME, EV_DAEMON_PATH, follow_name_owner_changes=True) EvinceWindowProxy.bus.add_signal_receiver( self._on_doc_loaded, signal_name="DocumentLoaded", dbus_interface=EV_WINDOW_IFACE, sender_keyword='sender') self._get_dbus_name(False) except dbus.DBusException: nvimr_warn("Could not connect to the Evince Daemon") loop.quit()
def SetBibfiles(self, d, bibls): """ Define which bib files each Rmarkdown document uses """ self.D[d] = [] for b in bibls: if b != '': if os.path.isfile(b): self._parse_bib(b) self.D[d].append(b) else: nvimr_warn('File "' + b + '" not found.')
def handle_get_window_list_reply(self, window_list): if len(window_list) > 0: window_obj = EvinceWindowProxy.bus.get_object( self.dbus_name, window_list[0]) self.window = dbus.Interface(window_obj, EV_WINDOW_IFACE) self.window.connect_to_signal("Closed", self.on_window_close) self.window.connect_to_signal("SyncSource", self.on_sync_source) else: #That should never happen. nvimr_warn("GetWindowList returned empty list")
def _parse_bib(self, b): self.M[b] = os.path.getmtime(b) self.E[b] = {} try: bib = parse_file(b) except Exception as ERR: nvimr_warn('Error parsing ' + b + ': ' + str(ERR)) return for k in bib.entries: self.E[b][k] = {'citekey': k, 'title': '', 'year': '????'} self.E[b][k]['author'] = self._get_authors(bib.entries[k].persons) if 'title' in bib.entries[k].fields: self.E[b][k]['title'] = bib.entries[k].fields['title'] if 'year' in bib.entries[k].fields: self.E[b][k]['year'] = bib.entries[k].fields['year'] if 'file' in bib.entries[k].fields: self.E[b][k]['file'] = bib.entries[k].fields['file']
def handle_get_window_list_error (self, e): nvimr_warn("GetWindowList DBus call has failed: " + str(e))
def handle_find_document_error(self, error): nvimr_warn("FindDocument DBus call has failed: " + str(error))