Print orientation in ksnapshot cannot be selected. #8

Suljettu
5 vuotta sitten avasi MicheleC · 8 kommenttia
Omistaja

From user ML:

Trinity 14.0.6 preliminary.
Don't know if it is a feature of ksnapshot or a misconfiguration
somewhere from me, but it is getting absolutely annoying what happens.
I have a website, a document or whatsoever on my screen in full
A4-papersize. Now I want a printout of a small part of it. Call
ksnapshot, choose "region" "new snapshot" and then draw a border around
the desired part. Press "print" and then print it. Bull... I get a
print in landscape, useless and even worse not even the original layout
reappears.
Stop ksnapshot, restart it and same procedure with again the same
miserable result.
Stop, restart, same procedure but no actual printing, instead I look
into the printer properties. And there, big surprise, landscape was
marked as to be printed BUT all 4 orientations were grayed out, so I
couldn't change that.
Checked in tdeprint the printersettings, nothing wrong, in "instances"
"settings" all 4 orientations were available and portrait was marked as
to be applied in the default printer.
Checked kprinter and of course the settings of tdeprint were there also
valid.
But then I had an idea. If I selected in ksnapshot a larger part of the
screen, say more than half A4, what would happen?
Yes, some ugly words from me and there it was: portrait was marked but
still all 4 possibilities grayed out. 
So ksnapshot decides how it wants to print and doesn't leave the user a
chance to get a result, that he wants. Utterly bull....
Any suggestion, where I could look to alter this behaviour?
Phiebie.

Problem is confirmed.

From user ML: ``` Trinity 14.0.6 preliminary. Don't know if it is a feature of ksnapshot or a misconfiguration somewhere from me, but it is getting absolutely annoying what happens. I have a website, a document or whatsoever on my screen in full A4-papersize. Now I want a printout of a small part of it. Call ksnapshot, choose "region" "new snapshot" and then draw a border around the desired part. Press "print" and then print it. Bull... I get a print in landscape, useless and even worse not even the original layout reappears. Stop ksnapshot, restart it and same procedure with again the same miserable result. Stop, restart, same procedure but no actual printing, instead I look into the printer properties. And there, big surprise, landscape was marked as to be printed BUT all 4 orientations were grayed out, so I couldn't change that. Checked in tdeprint the printersettings, nothing wrong, in "instances" "settings" all 4 orientations were available and portrait was marked as to be applied in the default printer. Checked kprinter and of course the settings of tdeprint were there also valid. But then I had an idea. If I selected in ksnapshot a larger part of the screen, say more than half A4, what would happen? Yes, some ugly words from me and there it was: portrait was marked but still all 4 possibilities grayed out. So ksnapshot decides how it wants to print and doesn't leave the user a chance to get a result, that he wants. Utterly bull.... Any suggestion, where I could look to alter this behaviour? Phiebie. ``` Problem is confirmed.
MicheleC lisäsi tämän merkkipaaluun R14.2.0 release 5 vuotta sitten
Yhteistyökumppani

Hi Michele,
when looking into the code recently, I noticed that the orientation is automatically selected based on the size/ratio of the image snapped. It compares width/height and sets the orientation (see here). So it works more or less as designed.

Do you think it is relevant to keep this open or to fix it?

Hi Michele, when looking into the code recently, I noticed that the orientation is automatically selected based on the size/ratio of the image snapped. It compares width/height and sets the orientation ([see here](https://mirror.git.trinitydesktop.org/gitea/TDE/tdegraphics/src/commit/db379a2f50774d6ab871507356e95715cbf68a7b/ksnapshot/ksnapshot.cpp#L311)). So it works more or less as designed. Do you think it is relevant to keep this open or to fix it?
Yhteistyökumppani

Looks like the bug is actually about not being given an option to change (for whatever reason) the automatically picked orientation.

Looks like the bug is actually about not being given an option to change (for whatever reason) the automatically picked orientation.
Tekijä
Omistaja

I agree with Philippe, the user should be given the choice to select a specific orientation if he wants. Auto selection is a good initial choice, but there should be a way tooverwrite that if wanted.

I agree with Philippe, the user should be given the choice to select a specific orientation if he wants. Auto selection is a good initial choice, but there should be a way tooverwrite that if wanted.
Yhteistyökumppani

Looks like the bug is actually about not being given an option to change (for whatever reason) the automatically picked orientation.

I think it is the setOrientation() here. But I do not understand why.
Perhaps due to

605  d->m_impl->broadcastOption( "kde-orientation-fixed", "1" );

in kprinter.cpp

> Looks like the bug is actually about not being given an option to change (for whatever reason) the automatically picked orientation. I think it is the setOrientation() [here](https://mirror.git.trinitydesktop.org/gitea/TDE/tdegraphics/src/commit/db379a2f50774d6ab871507356e95715cbf68a7b/ksnapshot/ksnapshot.cpp#L300). But I do not understand why. Perhaps due to ``` 605 d->m_impl->broadcastOption( "kde-orientation-fixed", "1" ); ``` in kprinter.cpp
Tekijä
Omistaja

I think it is the setOrientation() here. But I do not understand why.
Perhaps due to

605  d->m_impl->broadcastOption( "kde-orientation-fixed", "1" );

in kprinter.cpp

That seems the place where the orientation is selected automatically. But we need to find out why the orientation choice is grayed out in the printer dialog. If we can enable that again, then the user should be able to select a different orientation.

> I think it is the setOrientation() [here](https://mirror.git.trinitydesktop.org/gitea/TDE/tdegraphics/src/commit/db379a2f50774d6ab871507356e95715cbf68a7b/ksnapshot/ksnapshot.cpp#L300). But I do not understand why. > Perhaps due to > > ``` > 605 d->m_impl->broadcastOption( "kde-orientation-fixed", "1" ); > ``` > in kprinter.cpp > That seems the place where the orientation is selected automatically. But we need to find out why the orientation choice is grayed out in the printer dialog. If we can enable that again, then the user should be able to select a different orientation.
Yhteistyökumppani

It is set in

    if (snapshot.width() > snapshot.height())
        printer.setOrientation(KPrinter::Landscape);
    else
        printer.setOrientation(KPrinter::Portrait);

and then it uses the printer to get the sizes and scale if needed

    TQPainter painter(&printer);
    TQPaintDeviceMetrics metrics(painter.device());

So the code is optimizing the image for printing, but after this the user can not change.

I think if we remove the automatic orientation, it would work.
I will test and post result later.

It is set in ``` if (snapshot.width() > snapshot.height()) printer.setOrientation(KPrinter::Landscape); else printer.setOrientation(KPrinter::Portrait); ``` and then it uses the printer to get the sizes and scale if needed TQPainter painter(&printer); TQPaintDeviceMetrics metrics(painter.device()); So the code is optimizing the image for printing, but after this the user can not change. I think if we remove the automatic orientation, it would work. I will test and post result later.
Yhteistyökumppani

Commenting out the following and the orientation can be set manually

if (snapshot.width() > snapshot.height())
    printer.setOrientation(KPrinter::Landscape);
else
    printer.setOrientation(KPrinter::Portrait);

I tested now the default "Portrait" and then with "Landscape". It seems OK.

It also scales the image properly.

I will create PR.

Commenting out the following and the orientation can be set manually ``` if (snapshot.width() > snapshot.height()) printer.setOrientation(KPrinter::Landscape); else printer.setOrientation(KPrinter::Portrait); ``` I tested now the default "Portrait" and then with "Landscape". It seems OK. It also scales the image properly. I will create PR.
MicheleC vaihtoi merkkipaalun R14.2.0 release merkkipaaluun R14.1.0 release 1 vuosi sitten
MicheleC added a new dependency 1 vuosi sitten
Tekijä
Omistaja

Fixed by PR #54

Fixed by PR #54
MicheleC sulki tämän ongelman 1 vuosi sitten
Sign in to join this conversation.
Ei merkkipaalua
Ei käsittelijää
3 osallistujaa
Ilmoitukset
Määräpäivä

Määräpäivää ei asetettu.

Depends on
#54 issue/8/ksnapshot
TDE/tdegraphics
Reference: TDE/tdegraphics#8
Ladataan…
Sisältöä ei vielä ole.