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

Linux ScreenShot feature added #319

Closed
wants to merge 13 commits into from

Conversation

bhaveshAn
Copy link
Contributor

@bhaveshAn bhaveshAn commented Mar 30, 2017

Not having dependencies either.
In a merge-able state.

screenshot

@bhaveshAn bhaveshAn closed this Apr 1, 2017
@bhaveshAn bhaveshAn reopened this Apr 1, 2017
@bhaveshAn
Copy link
Contributor Author

Closed this pull request accidently. Sorry about that. Please check its running fine.
Tested on Linux Ubuntu 16.04 LTS.

@kiok46 kiok46 requested a review from tito April 5, 2017 19:11
@kiok46
Copy link
Contributor

kiok46 commented Apr 6, 2017

@bhaveshAn thanks for contributing, please add screenshotdemo.kv file or load kivy string using Builder.load_string() in the example.
I have a suggestion, Why don't you create a new PR for screenshot for OSX, Linux and Windows? that way we could cover screenshots for all supported desktop devices and you won't have to recreate example in each PR (which you shouldn't). Also, you only need to add Windows as you already have done Linux and OSX.

@bhaveshAn
Copy link
Contributor Author

@kiok46 thanks for your review. Actually I am working on ScreenShot feature for Windows too but don't know how long it would take. So I can say that I have made the PR working from example too. If you merge this PR It will not required for me to recreate the example for screenshot in PR #324 and hence I will pull the upstream changes after deleting the example in PR of OSX. In this way, Workflow will remain same without a extra PR as you suggested.
Meanwhile providing proof of the working of feature from example too.

screenshot from 2017-04-07 00-10-06

screenshot from 2017-04-07 00-09-58

@@ -0,0 +1,62 @@
'''
ScreenShot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Oxford dictionary a "screenshot" is a real word, unlike "FileChooser", therefore it'd be better to go for that. Also, I'd say it's more expected to do:

from something import Screenshot

instead of:

from something import ScreenShot

as it will be more confusing in the future. Also, it's inconsistent with the rest of your code, where you use "screenshot" as a single word.

super(ScreenShot, self).__init__()
self._file_path = file_path

def take_shot(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screenshot.take() seems visually more pleasant than screenshot.take_shot()

@@ -1,5 +1,6 @@
# coding=utf-8


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as pr 320.

'''
Location of the screenshot.
'''
assert isinstance(location, (basestring, unicode)), \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tried it yet, but this seems smelly to me. Have you tried it both with py2 and py3?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also have been used in the audio facade from long.

Copy link
Contributor

@KeyWeeUsr KeyWeeUsr Apr 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely doesn't work on py3. To be more precise:

>>> basestring
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'basestring' is not defined
>>> unicode
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'unicode' is not defined

If there isn't some background magic going on, then I believe even the audio part is broken for py3, unfortunately.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What say If I remove it. @KeyWeeUsr

from plyer.utils import whereis_exe


class GnomeScreenShot(ScreenShot):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a reference to the options (gnome, import) might be useful in the documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done to give to use the feature with which-ever utitlity is present. So need is to give separate names to both implemented classes. What say @KeyWeeUsr

@akshayaurora
Copy link
Member

akshayaurora commented Apr 7, 2017

This pr specifically uses gnome for screenshot. Assuming a Userinterface is something we can not do.

The way you check for ability to import Gnome then switch to using "import" cli binary is something that can be used to test different interfaces like KDE or unity or ....

Please look into using XWindows directly to get the screenshot.

@bhaveshAn
Copy link
Contributor Author

bhaveshAn commented Apr 7, 2017

@akshayaurora I have used command-line tools in my PRs because previously the features like Notification for linux is using tool like notify-send and Wifi is making use of nmcli tool which are pre-installed one like gst-launch-1.0 , gnome-screenshot, import , xrandr and bluetoothctl.

So, from my point of view there is no issues to use pre-installed binaries or command line tools to implement the feature, the idea that I acquire about plyer is to not having dependencies either.

If I am wrong please correct me. :)

@akshayaurora
Copy link
Member

Tools that are "universal & expected to be pre existing on most linux" distros are accepted if there is no obvious way around using them. In this case there is. XWindows & Xrandr extension both offer such options.

@bhaveshAn
Copy link
Contributor Author

bhaveshAn commented Apr 7, 2017

@akshayaurora I browsed about it. find one such and running fine.
sleep 5; xwd -root | convert - capture.png

https://wiki.debian.org/ScreenShots#Using_command_line

can i use it.

@bhaveshAn
Copy link
Contributor Author

bhaveshAn commented Apr 7, 2017

@akshayaurora I have added the screenshot using xwd or XWindows in this branch at origin.
Can I make the pull request with the same branch or a new branch.
Please tell.

@bhaveshAn
Copy link
Contributor Author

Opened a new pull concerning linux screenshot at #326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants