Repository navigation
Expand file tree
/
Copy pathControlWeb.py
More file actions
53 lines (42 loc) · 1.6 KB
/
Copy pathControlWeb.py
File metadata and controls
53 lines (42 loc) · 1.6 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
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Ricardo Ribeiro"
__credits__ = ["Ricardo Ribeiro"]
__license__ = "MIT"
__version__ = "0.0"
__maintainer__ = "Ricardo Ribeiro"
__email__ = "ricardojvr@gmail.com"
__status__ = "Development"
from AnyQt.QtWebEngineWidgets import QWebEngineView as QWebView
from AnyQt.QtCore import QUrl
from pyforms.gui.controls.ControlBase import ControlBase
class ControlWeb(ControlBase, QWebView):
def __init__(self, *args, **kwargs):
QWebView.__init__(self)
if 'load_finnished_event' in kwargs:
self.load_finnished_event=kwargs['load_finnished_event']
self.loadFinished.connect(self.__load_finnished_evt)
ControlBase.__init__(self, *args, **kwargs)
def init_form(self):
"""
Load Control and initiate the events
"""
ControlBase.init_form(self)
if self._value: QWebView.load(self, QUrl(self._value))
if self.help: self.form.setToolTip(self.help)
############################################################################
############ Properties ####################################################
############################################################################
def __load_finnished_evt(self, ok):
self.load_finnished_event(ok)
def load_finnished_event(self,ok):
pass
@property
def value(self): return ControlBase.value.fget(self)
@value.setter
def value(self, value):
ControlBase.value.fset(self, value)
QWebView.load(self, QUrl(value))
@property
def form(self):
return self