Ticket #40139: patch-frescobaldi_app-main.py.diff
File patch-frescobaldi_app-main.py.diff, 2.0 KB (added by dliessi (Davide Liessi), 11 years ago) |
---|
-
frescobaldi_app/main.py
old new 143 143 import autocomplete # auto-complete input 144 144 import wordboundary # better wordboundary behaviour for the editor 145 145 146 # on Mac OS X, handle FileOpen requests (e.g. double-clicking a file in the 147 # Finder), these events also can occur right on application start. 148 # We do this just before creating the window, so that when multiple files 149 # are opened on startup (I don't know whether that really could happen), 150 # they are not made the current document, as that slows down loading 151 # multiple documents drastically. 152 if sys.platform.startswith('darwin'): 153 import file_open_eventhandler 154 146 155 if app.qApp.isSessionRestored(): 147 156 # Restore session, we are started by the session manager 148 157 session.restoreSession() 149 158 return 150 159 151 # load specified session 160 # load specified session? 152 161 doc = None 153 162 if options.session and options.session != "-": 154 163 doc = sessions.loadSession(options.session) 155 164 156 165 # Just create one MainWindow 157 166 win = mainwindow.MainWindow() 158 167 win.show() 159 168 160 if urls: 161 for u in urls: 162 doc = win.openUrl(u, options.encoding) 163 elif not options.session: 164 # no docs, load default session 165 doc = sessions.loadDefaultSession() 169 # load documents given as arguments 170 for u in urls: 171 doc = win.openUrl(u, options.encoding) 172 173 # were documents loaded? 174 if not doc: 175 if app.documents: 176 doc = app.documents[-1] 177 elif not options.session: 178 # no docs, load default session 179 doc = sessions.loadDefaultSession() 180 166 181 win.setCurrentDocument(doc or document.Document()) 182 167 183 if urls and options.line is not None: 168 184 # set the last loaded document active and apply navigation if requested 169 185 pos = doc.findBlockByNumber(options.line - 1).position() + options.column