Skip to content
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

Closed
5 tasks done
mgrojo opened this issue Sep 5, 2018 · 17 comments
Closed
5 tasks done

Printing support #1525

mgrojo opened this issue Sep 5, 2018 · 17 comments
Assignees
Labels
enhancement Feature requests. item for release note There is something in this issue which we need to include in the next release notes

Comments

@mgrojo
Copy link
Member

mgrojo commented Sep 5, 2018

Describe the new feature

Paper is dead, long live PDF!

Printing support in:

  • SQL/XML/JSON editor widgets
  • Plot
  • Table data in Data Browser and Execute SQL results
  • DB Structure
  • Other Edit Database Cell widgets

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.

@mgrojo mgrojo self-assigned this Sep 5, 2018
@mgrojo mgrojo added the enhancement Feature requests. label Sep 5, 2018
@justinclift
Copy link
Member

Interesting idea. Seems like it'd be useful. 😄

@mgrojo
Copy link
Member Author

mgrojo commented Sep 15, 2018

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.

@justinclift
Copy link
Member

Using Ctrl+P for printing sounds reasonable. And we should definitely note the key change bit in our release notes. 😄

@justinclift justinclift added the item for release note There is something in this issue which we need to include in the next release notes label Sep 15, 2018
@justinclift
Copy link
Member

Just created a new "item for release note" label, which might help us not miss this bit for the next release's info. 😄

mgrojo added a commit that referenced this issue Sep 16, 2018
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.
mgrojo added a commit that referenced this issue Sep 16, 2018
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.
@mgrojo
Copy link
Member Author

mgrojo commented Sep 16, 2018

Ok. I've commited the changes. The first bullet is now already implemented.

mgrojo added a commit that referenced this issue Sep 23, 2018
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.
mgrojo added a commit that referenced this issue Sep 25, 2018
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.
@mgrojo mgrojo mentioned this issue Sep 26, 2018
13 tasks
mgrojo added a commit that referenced this issue Sep 27, 2018
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.
mgrojo added a commit that referenced this issue Sep 29, 2018
Add shortcut and entry in context menu for printing a plot.
mgrojo added a commit that referenced this issue Sep 29, 2018
Print shortcuts are added in the context of the text and hex editors of
the Edit Database Cell dock.
mgrojo added a commit that referenced this issue Sep 29, 2018
Print shortcuts are added in the context of the text and hex editors of
the Edit Database Cell dock.
mgrojo added a commit that referenced this issue Sep 30, 2018
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.
@mgrojo
Copy link
Member Author

mgrojo commented Sep 30, 2018

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?

@justinclift
Copy link
Member

Good idea. 😄

I don't presently have a printer though, so this bit isn't something I can help with.

@chrisjlocke
Copy link
Member

You can install a PDF printer ... you can't get out of it so easily! 😆

@SilvioGrosso
Copy link

Hello @mgrojo

Just tested this new feature on Windows Xp - professional through this installer (Version 3.10.99 - Oct 1 2018):
DB.Browser.for.SQLite-win32 (nightly builds)

I have also tested on Windows 10 - 64 bit this installer (Version 3.10.99 - Oct 1 2018):
DB.Browser.for.SQLite-win64 (nightly builds)

Both work fine in that I can successfully print my PDF :-)

Just two very minor personal remarks:
1)
On the Browse Data window there is no visual way, for a casual user, to guess the presence of this option. No print icon is available in the GUI, in short.
Needless to say, this feature works fine when you press CTR+P

On the Execut SQL window you can now print your SQL code as PDF.
However, it looks like you can not print the result of your query as PDF. It looks like you can only export this result as CSV (or copy-paste your data into Excel, for instance).

Aside from that, GREAT feature indeed!
THANKS a lot for your hard work: Sqlite Browser has improved dramatically compared to the stable release :-)

@mgrojo
Copy link
Member Author

mgrojo commented Oct 1, 2018

You can install a PDF printer ... you can't get out of it so easily!

I think you don't even need that. I'm not sure, but I think that the PDF printer is actually implemented by Qt.

Both work fine in that I can successfully print my PDF :-)

@SilvioGrosso, thanks for reporting. Did the physical printer appear too as an option? Provided that you had one, of course.

  1. On the Browse Data window there is no visual way, for a casual user, to guess the presence of this option. No print icon is available in the GUI, in short.
    Needless to say, this feature works fine when you press CTR+P

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.

  1. On the Execut SQL window you can now print your SQL code as PDF.
    However, it looks like you can not print the result of your query as PDF. It looks like you can only export this result as CSV (or copy-paste your data into Excel, for instance).

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?

Aside from that, GREAT feature indeed!
THANKS a lot for your hard work: Sqlite Browser has improved dramatically compared to the stable release :-)

My pleasure 😄

@SilvioGrosso
Copy link

Hello @mgrojo,

Nevertheless, do you all think it should be an icon in the Browse Data "toolbar"? It should be easy to add one there.

Yep!
This way this icon would be present in this window as well (Browse Data).
At present, it is "only" available in the Database structure and in the Execute SQL.
IMHO, It is "strange" (that is, not consistent) not having the icon (print) in the Browse Data when it is available in the other 2 windows :-)

The Edit Database Cell has also a print action in the contextual menu. Should it be added to the dock "toolbar" too?

Yep. My bad!
I didn't notice this additional option.
I think it is fine like this as regards this feature.

Again: I really appreciate your efforts.
In the past, I have always worked with SqliteStudio.
It has lot on common with Sqlite Browser (QT Gui; C++; Github - Open source code).
At present, in my view, Sqlite Browser is better (even though SqliteStudio has some features not currently available with Sqlite Browser)

mgrojo added a commit that referenced this issue Oct 1, 2018
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.
@mgrojo
Copy link
Member Author

mgrojo commented Oct 1, 2018

Yep!
This way this icon would be present in this window as well (Browse Data).
At present, it is "only" available in the Database structure and in the Execute SQL.
IMHO, It is "strange" (that is, not consistent) not having the icon (print) in the Browse Data when it is available in the other 2 windows :-)

You've convinced me! I've added the print button to the Browse Data tab. There is currently enough free space.

Again: I really appreciate your efforts.
In the past, I have always worked with SqliteStudio.
It has lot on common with Sqlite Browser (QT Gui; C++; Github - Open source code).
At present, in my view, Sqlite Browser is better (even though SqliteStudio has some features not currently available with Sqlite Browser)

Nice tool too.

@justinclift
Copy link
Member

Would it make sense to add some main menu option for the Print ability too? 😄

Not sure which section it'd go under though. 😉

@chrisjlocke
Copy link
Member

chrisjlocke commented Oct 2, 2018

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.

image

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! 💋

You've convinced me! I've added the print button to the Browse Data tab.

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! ;)

image

image

This is different to the margins in the 'Execute SQL' tab - margins seem to work there?

image

@mgrojo
Copy link
Member Author

mgrojo commented Oct 3, 2018

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.

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.

imagen

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!)

I tried adding the icon but had problems. To-do for the next release.

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! ;)

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.

mgrojo added a commit that referenced this issue Oct 3, 2018
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.
@chrisjlocke
Copy link
Member

Excellent tweaks - thanks @mgrojo ❤️

@mgrojo
Copy link
Member Author

mgrojo commented Feb 8, 2019

Closing this as done for the v3.11.0 release. Any further improvements should be done through new issues.

@mgrojo mgrojo closed this as completed Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests. item for release note There is something in this issue which we need to include in the next release notes
Projects
None yet
Development

No branches or pull requests

4 participants