-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebKit.py
More file actions
executable file
·135 lines (89 loc) · 3.41 KB
/
WebKit.py
File metadata and controls
executable file
·135 lines (89 loc) · 3.41 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 06 14:49:05 2015
@author: Marcos Vinicius Scholl
@page: 'www.marcosscholl.github.io
"""
import sys
from PyQt4 import QtGui, QtCore
from PyQt4.QtWebKit import *
url = ""
class MeuNavegadorFoda(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.createBroswer()
def createBroswer(self):
self.centralwidget = QtGui.QWidget(self)
self.line = QtGui.QLineEdit(self)
self.line.setMinimumSize(1150,30)
self.line.setStyleSheet("font-size:15px;")
self.enter = QtGui.QPushButton(self)
self.enter.resize(0,0)
self.enter.clicked.connect(self.Enter)
self.enter.setShortcut("Return")
self.reload = QtGui.QPushButton("R",self)
self.reload.setMinimumSize(35,30)
self.reload.setShortcut("F5")
self.reload.setStyleSheet("font-size:23px;")
self.reload.clicked.connect(self.Reload)
self.back = QtGui.QPushButton("B",self)
self.back.setMinimumSize(35,30)
self.back.setStyleSheet("font-size:23px;")
self.back.clicked.connect(self.Back)
self.forw = QtGui.QPushButton("F",self)
self.forw.setMinimumSize(35,30)
self.forw.setStyleSheet("font-size:23px;")
self.forw.clicked.connect(self.Forward)
self.exit = QtGui.QPushButton("X",self)
self.exit.setMinimumSize(35,30)
self.exit.setStyleSheet("font-size:23px;")
self.exit.clicked.connect(self.Exit)
self.web = QWebView()
self.web.setMinimumSize(1300,650)
self.web.urlChanged.connect(self.UrlChanged)
grid = QtGui.QGridLayout()
grid.addWidget(self.back,0,0, 1, 1)
grid.addWidget(self.forw,0,1, 1, 1)
grid.addWidget(self.reload,0,2, 1, 1)
grid.addWidget(self.line,0,3, 1, 1)
grid.addWidget(self.exit,0,4, 1, 1)
grid.addWidget(self.web, 2, 0, 1, 6)
self.centralwidget.setLayout(grid)
self.setGeometry(50,50,1300,650)
self.setWindowTitle("Navegador 'www.marcosscholl.github.io'")
self.setCentralWidget(self.centralwidget)
def Enter(self):
global url
url = self.line.text()
if url == "xxx":
self.web.load(QtCore.QUrl("http://ifolderlinks.ru/404/"))
return
http = "http://"
www = "www."
if www in url and http not in url:
url = http + url
elif "." not in url:
url = "http://www.google.com/search?q="+url
elif http in url and www not in url:
url = url[:7] + www + url[7:]
elif http and www not in url:
url = http + www + url
self.web.load(QtCore.QUrl(url))
def Back(self):
self.web.back()
def Forward(self):
self.web.forward()
def Reload(self):
self.web.reload()
def UrlChanged(self):
self.line.setText(self.web.url().toString())
def Exit(self):
self.close()
def OpenMyPage(self):
self.web.load(QtCore.QUrl('http://marcosscholl.github.io/'))
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
melhorQueChrome = MeuNavegadorFoda()
melhorQueChrome.show()
melhorQueChrome.OpenMyPage()
sys.exit(app.exec_())