forked from BoboTiG/python-mss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfactory.py
More file actions
32 lines (24 loc) · 836 Bytes
/
factory.py
File metadata and controls
32 lines (24 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# coding: utf-8
""" This is part of the MSS Python's module.
Source: https://github.com/BoboTiG/python-mss
"""
from platform import system
from .exception import ScreenshotError
def mss(**kwargs):
""" Factory returning a proper MSS class instance.
It detects the plateform we are running on
and choose the most adapted mss_class to take
screenshots.
It then proxies its arguments to the class for
instantiation.
"""
operating_system = system().lower()
if operating_system == 'darwin':
from .darwin import MSS
elif operating_system == 'linux':
from .linux import MSS
elif operating_system == 'windows':
from .windows import MSS
else:
raise ScreenshotError('System not (yet?) implemented.', locals())
return MSS(**kwargs)