Snip Macro

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Snip Macro

Post by drmacro »

Ok, it's Saturday morning, I've not had adequate coffee, etc. :roll:

When execute the Snip macro a file dialog appears showing a png file in the list, but blank in the File Name field.

If I drag the .png file to an open forum reply window:
  • The first time the window gets a dashed highlight around it, but the cursor is the forbidden symbol (circle with slash).
  • The second attempt allows mew to drop and it appears in the Attachments.
  • But, when previewed the pic is some random area of the screen...not even within the FreeCAD window.
What am I missing or forgotten? :oops:





OS: Ubuntu 20.04.1 LTS (XFCE/ubuntustudio)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: c4d42a1f74a0a8a8e6f0e43929468dc44fc95890
Python version: 3.8.5
Qt version: 5.12.8
Coin version: 4.0.0
OCC version: 7.3.0
Locale: English/United States (en_US)
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Snip Macro

Post by openBrain »

Some screenshots ? Which browser ?
TheMarkster wrote: Sun Aug 04, 2019 12:24 am Ping @author
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Snip Macro

Post by drmacro »

openBrain wrote: Sat Nov 21, 2020 1:53 pm Some screenshots ? Which browser ?
I would but Snip isn't working... ;)

Firefox

This is the file dialog after clicking OK:
Snip1.png
Snip1.png (31.48 KiB) Viewed 1151 times
And what I get from a drag (which are pieces of the other monitor):
Snip macro screenshot-106bc0.png
Snip macro screenshot-106bc0.png (56.57 KiB) Viewed 1151 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Snip Macro

Post by TheMarkster »

The first image is how it is supposed to work. You drag/drop the image from the open file dialog over to the forum. Alternatively, you can select and open (or double click the image) to open the image in your default image editor. In my case if I double click the image it opens in MS Paint.

In the second image it looks like the macro is taking the image data from the wrong monitor. Which version of Snip are you using? Latest is v1.21. I also have 2 monitors. It works for me no matter which monitor I choose. I'm on Windows, so maybe Ubuntu 20 is different. I haven't updated FreeCAD recently:

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22894 (Git)
Build type: Release
Branch: master
Hash: 9eb080488d970d313c538473e7272117ea0a7cd1
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Snip Macro

Post by drmacro »

Interestingly it works fine on my dual monitor desktop with Radeon card.

It exhibits these issues on my laptop with nvidia graphic and onboard LCD and 2 outboard monitors.


Both have Ubuntu and FC daily...
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Snip Macro

Post by TheMarkster »

Maybe it's the 3 monitors that confuses it.

Try this in the python console:

Code: Select all

from PySide import QtGui
QtGui.QApplication.screens()
QtGui.QApplication.primaryScreen()
If primaryScreen() gives you which screen is detected to be the primary screen, but screens() gives you a list of available screens. You could try to replace line 204 from

Code: Select all

screen = QtGui.QApplication.primaryScreen()
to

Code: Select all

screens = QtGui.QApplication.screens()[0]  #or [1]  or [2] depending on which display to use
LarryWoestman
Posts: 98
Joined: Fri Oct 09, 2020 4:56 pm
Location: Oregon, USA

Re: Snip Macro

Post by LarryWoestman »

There is a know issue with linux and 3 displays. It isn't limitted to FreeCAD.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Snip Macro

Post by chrisb »

Concerning smoothed and not smoothed zoom, I like the smoothed variant much more. For the highDPI display I use a scale factor of 0.999, because this function seems to zoom already on its own. Here are three variants: system screenshot, Snip macro non smoothed and snip macro smoothed
system screenshot
system screenshot
Bildschirmfoto 2020-11-21 um 23.15.13.png (17.67 KiB) Viewed 1063 times
non smoothed variant (linked from another post):
Image
Attachments
Snip smoothed
Snip smoothed
Snip macro screenshot-885c79.png (12.18 KiB) Viewed 1063 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Post by drmacro »

TheMarkster wrote: Sat Nov 21, 2020 9:56 pm Maybe it's the 3 monitors that confuses it.

Try this in the python console:

Code: Select all

from PySide import QtGui
QtGui.QApplication.screens()
QtGui.QApplication.primaryScreen()
If primaryScreen() gives you which screen is detected to be the primary screen, but screens() gives you a list of available screens. You could try to replace line 204 from

Code: Select all

screen = QtGui.QApplication.primaryScreen()
to

Code: Select all

screens = QtGui.QApplication.screens()[0]  #or [1]  or [2] depending on which display to use
The console output:

Code: Select all

from PySide import QtGui
>>> QtGui.QApplication.screens()
[<PySide2.QtGui.QScreen(0x562dfffbe530, name="DP-0") at 0x7ff575fcdec0>, <PySide2.QtGui.QScreen(0x562dfffbe570, name="DP-2") at 0x7ff575f38280>, <PySide2.QtGui.QScreen(0x562dfffbe680, name="DP-4") at 0x7ff575b34fc0>]
>>> QtGui.QApplication.primaryScreen()
<PySide2.QtGui.QScreen(0x562dfffbe530, name="DP-0") at 0x7ff575fcdec0>

I'll assume you meant "screen =" not "screens =":

Code: Select all

screen = QtGui.QApplication.screens()[0]  #or [1]  or [2] depending on which display to use
I changed to:

Code: Select all

screen = QtGui.QApplication.screens()[1]
And it works.

Thanks!
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re:

Post by TheMarkster »

drmacro wrote: Sun Nov 22, 2020 1:55 pm

I changed to:

Code: Select all

screen = QtGui.QApplication.screens()[1]
And it works.

Thanks!
Glad you got it working.
Post Reply