def evt_fileOpened(self, buf_id, pathname, arg_list): """A file was opened by the user.""" unused = arg_list if pathname: clewnbuf = vimbuffer.is_clewnbuf(pathname) if os.path.isabs(pathname) or clewnbuf: if clewnbuf: buf = self._bset[os.path.basename(pathname)] if buf.editport is not None: buf.editport.visible = True else: buf = self._bset[pathname] if buf.buf_id != buf_id: if buf_id == 0: self.send_cmd(buf, 'putBufferNumber', misc.quote(pathname)) self.send_cmd(buf, 'stopDocumentListen') buf.registered = True buf.update() else: warning('got fileOpened with wrong bufId') elif clewnbuf and not isinstance(buf.editport, Console): self.send_function(buf, 'getLength') else: warning('absolute pathname required') else: self.show_balloon( '\nYou cannot use netbeans on a "[No Name]" file.\n' 'Please, edit a file.\n' )
def full_pathname(name): """Return the full pathname or None if name is a clewn buffer name.""" if vimbuffer.is_clewnbuf(name): name = None elif not os.path.isabs(name): name = os.path.abspath(name) return name
def __init__(self, name, nbsock): """Constructor.""" assert vimbuffer.is_clewnbuf(name) self.buf = nbsock._bset[name] self.buf.registered = False self.buf.editport = self self.nbsock = nbsock self.visible = False self.editing = False self.nonempty_last = False self.len = 0 self.dirty = False self.getLength_count = 0