-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Printing support #1525
Comments
Interesting idea. Seems like it'd be useful. 😄 |
I have an implementation for the SQL editor. There is a problem, though. The keyboard shortcut for Ctrl+P is assigned to show/hide the plot dock and it's conflicting with the new print shortcut. I'd remove the Ctrl+P shortcut for the plot dock, and leave there only the other shortcut that it already has: Ctrl+D (it's the only dock having two of them). Any opinions? I never use these shortcuts for hiding/showing the docks. |
Using Ctrl+P for printing sounds reasonable. And we should definitely note the key change bit in our release notes. 😄 |
Just created a new "item for release note" label, which might help us not miss this bit for the next release's info. 😄 |
Add printing support for QScintilla widgets (SQL, JSON and XML). It can be access through the contextual menu, shortcut (Ctrl+P) or (in the case of the "Execute SQL" tab) from a button in the toolbar. Ctrl+P was previously assigned to Plot Dock since 63c338c but, as it was foreseen in that commit, it should be assign to print is ever supported. This change must be mentioned in release notes. First part of printing support. See issue #1525.
Add printing support for QScintilla widgets (SQL, JSON and XML). It can be access through the contextual menu, shortcut (Ctrl+P) or (in the case of the "Execute SQL" tab) from a button in the toolbar. Ctrl+P was previously assigned to Plot Dock since 63c338c but, as it was foreseen in that commit, it should be assign to print is ever supported. This change must be mentioned in release notes. First part of printing support. See issue #1525.
Ok. I've commited the changes. The first bullet is now already implemented. |
Added contextual menu entry and keyboard shortcut for printing the browsed table with headers. If a region is selected, print those cells data. Otherwise, print the entire table. The HTML conversion used for clipboard is reused. Borders are added for better visual output.
New action and button for printing the database structure. The data in the Database Structure tree widget is converted to HTML and set in a document that can then be printed, opening the dialog as done for other components.
This adds a print preview step before printing in the Database Structure tab. This is nice to have, but it also aims to work around the problem found in Windows, reported at issue #760.
Add shortcut and entry in context menu for printing a plot.
Print shortcuts are added in the context of the text and hex editors of the Edit Database Cell dock.
Print shortcuts are added in the context of the text and hex editors of the Edit Database Cell dock.
Added support for printing images in the Editor Dialog. A new action added that can be activated through the context menu or shortcut for printing. The same approach is applied to the hex editor, which also lacked a context menu. Consequently the specific shortcut can be deleted.
I consider the printing support finished and ready for the release. Is anyone interested on testing it in different OS and confirm that it's working OK? |
Good idea. 😄 I don't presently have a printer though, so this bit isn't something I can help with. |
You can install a PDF printer ... you can't get out of it so easily! 😆 |
Hello @mgrojo Just tested this new feature on Windows Xp - professional through this installer (Version 3.10.99 - Oct 1 2018): I have also tested on Windows 10 - 64 bit this installer (Version 3.10.99 - Oct 1 2018): Both work fine in that I can successfully print my PDF :-) Just two very minor personal remarks: On the Execut SQL window you can now print your SQL code as PDF. Aside from that, GREAT feature indeed! |
I think you don't even need that. I'm not sure, but I think that the PDF printer is actually implemented by Qt.
@SilvioGrosso, thanks for reporting. Did the physical printer appear too as an option? Provided that you had one, of course.
There is a print icon in the contextual menu. Would users miss that? I hope that sooner or later they discover the icon. Nevertheless, do you all think it should be an icon in the Browse Data "toolbar"? It should be easy to add one there.
It's possible. Again, that can be done with the contextual menu of the results table. This time I don't know how this could be made more visible. There isn't a clear location for that action. The Edit Database Cell has also a print action in the contextual menu. Should it be added to the dock "toolbar" too?
My pleasure 😄 |
Hello @mgrojo,
Yep!
Yep. My bad! Again: I really appreciate your efforts. |
For consistency for the other application tabs, a print button is added to the Data Browse Tab for printing the currently browsed table or selection of cells.
You've convinced me! I've added the print button to the Browse Data tab. There is currently enough free space.
Nice tool too. |
Would it make sense to add some main menu option for the Print ability too? 😄 Not sure which section it'd go under though. 😉 |
Printing the schema is fantastic. A nice layout. The ability to 'lose' the 'create' statement would be handy - especially for views - as it can take up a lot of paper. Or lose the bold. Having the primary key in bold would be handy - it would highlight if a table is missing a primary key (something I do a lot! lol!) But overall, the feature is great - really love it. Well done! 💋
Definitely a good move. The menu options should hold everything the program can do, with the toolbar holding 'frequently used' items, then the right click menu holding 'context' items. Items shouldn't solely be in right click menus (just my thought) otherwise the feature can get overlooked. I'm not 100% sure the margins are correct though? I've gone into the print setup, and it says 20mm margins all round, but .... DB4S millimetres are bigger than Chris millimetres! ;) This is different to the margins in the 'Execute SQL' tab - margins seem to work there? |
I've removed the bold (actually header) style from the Schema column and now it appears with preformatted so it has the same appearance as the application column. That is, if the "Remove line breaks in schema view" option is disabled, the line breaks appear also in the printed output.
I tried adding the icon but had problems. To-do for the next release.
Seems a Qt issue. I don't set any margin, but it seems that Qt adds a margin around the tables and then the printer margin. |
The schema column of objects is pre-formatted with wrapped style. In this way, if the "db.hideschemalinebreaks" setting is enabled, the printed output is formatted in the same way, but with a wrapping style, so long lines do not extend the Schema column too much. Added tooltip to Preferences dialog, so it isn't a so hidden feature. Translations updated accordingly for the release. The header style is not applied in that same case.
Excellent tweaks - thanks @mgrojo ❤️ |
Closing this as done for the v3.11.0 release. Any further improvements should be done through new issues. |
Describe the new feature
Paper is dead, long live PDF!
Printing support in:
Information for SQL/XML/JSON:
http://pyqt.sourceforge.net/Docs/QScintilla2/classQsciPrinter.html
Plot:
https://www.qcustomplot.com/index.php/support/forum/976
Table browser:
https://stackoverflow.com/questions/3147030/qtableview-printing
Maybe we can reuse the HTML clipboard.
The text was updated successfully, but these errors were encountered: