-
Notifications
You must be signed in to change notification settings - Fork 208
Fix #148 - Open documents into new tab rather than new window #476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some general comments:
-
The window is briefly shown and then closed. I think the new code should be moved before
window.show()line. -
We also support Windows, macOS and other platforms where D-Bus is not available. ReText should continue working on those platforms.
-
I think some people would like to still be able to create multiple windows. Maybe add a command-line option to start a new window? (And ideally expose it in the
.desktopfile).
Otherwise thanks for your pull request!
ReText/__main__.py
Outdated
| sys.exit(1) | ||
|
|
||
| connection = QDBusConnection.sessionBus() | ||
| connection.registerObject('/', window, QDBusConnection.ExportAllSlots) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also exports some slots on org.qtproject.Qt.QWidget interface that should not be exposed publicly. Like setWindowModified and setWindowTitle. Is there any way to avoid that?
|
Right now is missing:
|
|
Thanks for your work! I am on a vacation now, will finish the implementation myself next week. |
|
No problem @mitya57 :-) |
|
Merged now, thank you! |
| parser.addVersionOption() | ||
| previewOption = QCommandLineOption('preview', | ||
| QApplication.translate('main', 'Open the files in preview mode')) | ||
| newWindowOption = QCommandLineOption('new-window', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know of this class in Qt, my fault
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also Python's argparse module, but Qt's is better, as it supports passing some standard flags (like -style or -platform) to Qt.
In this way if there is already ReText instance, the second one send the file to the other and kill himself.