-
Notifications
You must be signed in to change notification settings - Fork 3
/
video.py
103 lines (70 loc) · 2.97 KB
/
video.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# =============================================================================
# Module: video.py
# Contacts: Edward Li ([email protected])
# =============================================================================
"""___DESC___
"""
# =============================================================================
# IMPORTS
# =============================================================================
import os
from PyQt4 import QtGui
# =============================================================================
# CLASSES
# =============================================================================
class Video(object):
# =========================================================================
def __init__(self):
self._screens = list()
self._screen = Screen()
desktop = QtGui.QApplication.desktop()
for screenIndex in range(desktop.screenCount()):
geometry = desktop.screenGeometry(screenIndex)
screen = Screen(geometry)
if screen not in self._screens:
self._screens.append(screen)
# =========================================================================
def screenSet(self, index):
self._screen = self.screens[index]
# =========================================================================
@property
def screens(self):
return self._screens
# =========================================================================
@property
def screen(self):
return self._screen
# =============================================================================
class Screen(object):
# =========================================================================
def __init__(self, geometry=None):
self._geometry = geometry
# =========================================================================
@property
def source(self):
return '{d}+{p}'.format(d=os.environ.get('DISPLAY'), p=self.position)
# =========================================================================
@property
def position(self):
return '{x},{y}'.format(x=self.x, y=self.y)
# =========================================================================
@property
def size(self):
return '{w}x{h}'.format(w=self.width, h=self.height)
# =========================================================================
@property
def x(self):
return self._geometry.x()
# =========================================================================
@property
def y(self):
return self._geometry.y()
# =========================================================================
@property
def width(self):
return self._geometry.width()
# =========================================================================
@property
def height(self):
return self._geometry.height()
# =============================================================================