summaryrefslogtreecommitdiff
path: root/qt-recordmydesktop/src/rmdFrame.py
blob: ef05fc607fa8102035e06672b611c5b398b297e5 (plain)
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
#/******************************************************************************
#*                       qt-recordMyDesktop                                    *
#*******************************************************************************
#*                                                                             *
#*           Copyright (C) 2007  John Varouhakis                               *
#*                                                                             *
#*                                                                             *
#*  This program is free software; you can redistribute it and/or modify       *
#*  it under the terms of the GNU General Public License as published by       *
#*  the Free Software Foundation; either version 2 of the License, or          *
#*  (at your option) any later version.                                        *
#*                                                                             *
#*  This program is distributed in the hope that it will be useful,            *
#*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
#*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
#*  GNU General Public License for more details.                               *
#*                                                                             *
#*  You should have received a copy of the GNU General Public License          *
#*  along with this program; if not, write to the Free Software                *
#*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  *
#*                                                                             *
#*                                                                             *
#*                                                                             *
#*  For further information contact me at johnvarouhakis@gmail.com             *
#******************************************************************************/
from PyQt4 import QtGui,QtCore

class rmdFrame:
    borderwidth=6
    outlinewidth=1

    def __init__(self,x,y,w,h):
        self.window=QtGui.QWidget(None,QtCore.Qt.X11BypassWindowManagerHint|QtCore.Qt.WindowStaysOnTopHint)
        self.x=x
        self.y=y
        self.w=w
        self.h=h

        self.mask = QtGui.QBitmap(self.w+self.borderwidth*2,
                             self.h+self.borderwidth*2)
        self.mask.fill(QtCore.Qt.color1)

        self.window.paintEvent=self.paintEvent
        self.window.setWindowTitle("qt-recordMyDesktop frame")

        self.window.setFixedSize(self.w+self.borderwidth*2,
                                     self.h+self.borderwidth*2)

        self.window.move(self.x-self.borderwidth,
                         self.y-self.borderwidth)
        self.window.show()

    def paintEvent(self,Event):

        painterw= QtGui.QPainter(self.window)
        painterw.fillRect(0,0,self.w+self.borderwidth*2,
                         self.h+self.borderwidth*2,
                         QtGui.QBrush(QtCore.Qt.white,
                         QtCore.Qt.SolidPattern))
        painterw.fillRect(self.outlinewidth,
                         self.outlinewidth,
                         self.w+(self.borderwidth-
                            self.outlinewidth)*2,
                         self.h+(self.borderwidth-
                            self.outlinewidth)*2,
                         QtGui.QBrush(QtCore.Qt.black,
                         QtCore.Qt.SolidPattern))
        painterw.fillRect(self.borderwidth-self.outlinewidth,
                         self.borderwidth-self.outlinewidth,
                         self.w+self.outlinewidth*2,
                         self.h+self.outlinewidth*2,
                         QtGui.QBrush(QtCore.Qt.white,
                         QtCore.Qt.SolidPattern))
        if self.window.mask().isEmpty():
            painter = QtGui.QPainter(self.mask)
            painter.fillRect(self.borderwidth,
                            self.borderwidth,
                            self.w,self.h,
                            QtGui.QBrush(QtCore.Qt.color0,
                            QtCore.Qt.SolidPattern))
            self.window.setMask(self.mask)
    def pass_e(self):
        pass

    def destroy(self):
        #self.area.destroy()
        try:
            self.window.close()
        except:
            pass

if __name__ == "__main__":
    import sys

    app=QtGui.QApplication(sys.argv)
    app.values=[[-1,-1,-1,-1]]
    w = rmdFrame(100,100,340,260)
    app.exec_()
© All Rights Reserved