forked from doctoboggan/NoBrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.py
More file actions
executable file
·42 lines (33 loc) · 1.12 KB
/
Copy pathcode.py
File metadata and controls
executable file
·42 lines (33 loc) · 1.12 KB
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
#!/usr/bin/python -d
import sys
from PyQt4 import QtCore, QtGui
from interface import Ui_MainWindow
class NoBrowser(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.initUI()
def initUI(self):
self.connect(self.ui.bBack, QtCore.SIGNAL('clicked()'), self.ui.webView.back)
self.connect(self.ui.bForward, QtCore.SIGNAL('clicked()'), self.ui.webView.forward)
self.connect(self.ui.url, QtCore.SIGNAL('returnPressed()'), self.browse)
def browse(self):
url = self.ui.url.text() if self.ui.url.text() else self.default_url
print url
self.ui.webView.load(QtCore.QUrl(url))
self.ui.webView.show()
def mousePressEvent(self, event):
self.offset = event.pos()
def mouseMoveEvent(self, event):
x=event.globalX()
y=event.globalY()
x_w = self.offset.x()
y_w = self.offset.y()
self.move(x-x_w, y-y_w)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = NoBrowser()
myapp.show()
sys.exit(app.exec_())