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
Posts: 1980
Joined: Sun Mar 02, 2014 4:35 pm

Snip Macro

Postby drmacro » Sat Nov 21, 2020 1:24 pm

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."

My beginners, written treatise: Learning FreeCAD
openBrain
Posts: 4873
Joined: Fri Nov 09, 2018 5:38 pm

Re: Snip Macro

Postby openBrain » Sat Nov 21, 2020 1:53 pm

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

Re: Snip Macro

Postby drmacro » Sat Nov 21, 2020 2:04 pm

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 204 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 204 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."

My beginners, written treatise: Learning FreeCAD
TheMarkster
Posts: 2048
Joined: Thu Apr 05, 2018 1:53 am

Re: Snip Macro

Postby TheMarkster » Sat Nov 21, 2020 5:43 pm

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)
My FreeCAD video series on youtube: https://www.youtube.com/c/mwganson
drmacro
Posts: 1980
Joined: Sun Mar 02, 2014 4:35 pm

Re: Snip Macro

Postby drmacro » Sat Nov 21, 2020 6:47 pm

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."

My beginners, written treatise: Learning FreeCAD
TheMarkster
Posts: 2048
Joined: Thu Apr 05, 2018 1:53 am

Re: Snip Macro

Postby TheMarkster » 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
My FreeCAD video series on youtube: https://www.youtube.com/c/mwganson
LarryWoestman
Posts: 1
Joined: Fri Oct 09, 2020 4:56 pm

Re: Snip Macro

Postby LarryWoestman » Sat Nov 21, 2020 10:03 pm

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

Re: Snip Macro

Postby chrisb » Sat Nov 21, 2020 10:19 pm

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
Bildschirmfoto 2020-11-21 um 23.15.13.png
system screenshot
Bildschirmfoto 2020-11-21 um 23.15.13.png (17.67 KiB) Viewed 116 times
non smoothed variant (linked from another post):
Image
Attachments
Snip macro screenshot-885c79.png
Snip smoothed
Snip macro screenshot-885c79.png (12.18 KiB) Viewed 116 times
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
drmacro
Posts: 1980
Joined: Sun Mar 02, 2014 4:35 pm

Postby drmacro » Sun Nov 22, 2020 1:55 pm

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."

My beginners, written treatise: Learning FreeCAD
TheMarkster
Posts: 2048
Joined: Thu Apr 05, 2018 1:53 am

Re:

Postby TheMarkster » Sun Nov 22, 2020 9:36 pm

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.
My FreeCAD video series on youtube: https://www.youtube.com/c/mwganson