Ejemplo n.º 1
0
 def document(self, filename, load=False):
     """Get the document with the specified filename.
     
     If load is True, the document is loaded if it wasn't already.
     Also takes scratchdir into account for unnamed or non-local documents.
     
     """
     doc = scratchdir.findDocument(filename)
     if not doc and load:
         doc = app.openUrl(QUrl.fromLocalFile(filename))
     return doc
Ejemplo n.º 2
0
    def document(self, filename, load=False):
        """Get the document with the specified filename.

        If load is True, the document is loaded if it wasn't already.
        Also takes scratchdir into account for unnamed or non-local documents.

        """
        doc = scratchdir.findDocument(filename)
        if not doc and load:
            doc = app.openUrl(QUrl.fromLocalFile(filename))
        return doc
Ejemplo n.º 3
0
    def finish(self):
        """Call this when you are done with adding links.

        This method tries to bind() already loaded documents and starts
        monitoring document open/close events.

        You can also use the links as a context manager and then add links.
        On exit, finish() is automatically called.

        """
        for filename in self._links:
            d = scratchdir.findDocument(filename)
            if d:
                self.bind(filename, d)
        app.documentLoaded.connect(self.slotDocumentLoaded)
        app.documentClosed.connect(self.slotDocumentClosed)
Ejemplo n.º 4
0
 def finish(self):
     """Call this when you are done with adding links.
     
     This method tries to bind() already loaded documents and starts
     monitoring document open/close events.
     
     You can also use the links as a context manager and then add links.
     On exit, finish() is automatically called.
     
     """
     for filename in self._links:
         d = scratchdir.findDocument(filename)
         if d:
             self.bind(filename, d)
     app.documentLoaded.connect(self.slotDocumentLoaded)
     app.documentClosed.connect(self.slotDocumentClosed)
Ejemplo n.º 5
0
    def __init__(self, filename, line, column):
        """Creates the reference to filename, line and column.

        lines start numbering with 1, columns with 0 (LilyPond convention).

        If a document with the given filename is already loaded (or the filename
        refers to the scratchdir for a document) a QTextCursor is created immediately.

        Otherwise, when a Document is loaded later with our filename, a QTextCursor
        is created then (by the bind() method).

        """
        self._filename = filename
        self._line = line
        self._column = column
        self._cursor = None

        app.documentLoaded.connect(self.trybind)
        d = scratchdir.findDocument(filename)
        if d:
            self.bind(d)
Ejemplo n.º 6
0
    def __init__(self, filename, line, column):
        """Creates the reference to filename, line and column.

        lines start numbering with 1, columns with 0 (LilyPond convention).

        If a document with the given filename is already loaded (or the filename
        refers to the scratchdir for a document) a QTextCursor is created immediately.

        Otherwise, when a Document is loaded later with our filename, a QTextCursor
        is created then (by the bind() method).

        """
        self._filename = filename
        self._line = line
        self._column = column
        self._cursor = None

        app.documentLoaded.connect(self.trybind)
        d = scratchdir.findDocument(filename)
        if d:
            self.bind(d)