diff options
author | aneejit1 <aneejit1@gmail.com> | 2022-07-28 15:46:19 +0000 |
---|---|---|
committer | aneejit1 <aneejit1@gmail.com> | 2022-07-30 17:54:15 +0000 |
commit | e602246539fd7435aaeb440fcb7f852c92c8426b (patch) | |
tree | 35e09f5d93c67158e6c1160d6d9b27ae8a0bf966 /examples/webbrowser/webbrowser.py | |
parent | b34531364d5c0d3be7056d87011afd8bd538a0e7 (diff) | |
download | pytqt-e602246539fd7435aaeb440fcb7f852c92c8426b.tar.gz pytqt-e602246539fd7435aaeb440fcb7f852c92c8426b.zip |
Remove Qt V2 support and example files
Build files for pyuic2 have been removed along with the examples for
version 2 of Qt and the build/configure scripts have been amended
accordingly. The "examples3" directory has been renamed to just
"examples".
Signed-off-by: aneejit1 <aneejit1@gmail.com>
Diffstat (limited to 'examples/webbrowser/webbrowser.py')
-rw-r--r-- | examples/webbrowser/webbrowser.py | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/examples/webbrowser/webbrowser.py b/examples/webbrowser/webbrowser.py new file mode 100644 index 0000000..12f6f1c --- /dev/null +++ b/examples/webbrowser/webbrowser.py @@ -0,0 +1,91 @@ +# Copyright (C) 2001-2002 Trolltech AS. All rights reserved. +# Copyright (C) 2004 Riverbank Computing Ltd. All rights reserved. +# +# This file is part of an example program for the ActiveTQt integration. +# This example program may be used, distributed and modified without +# limitation. + + +import sys +from python_tqt import qt +from python_tqt import qtaxcontainer + +import mainwindow + + +class MainWindowImpl(mainwindow.MainWindow): + def init(self): + self.pb = qt.TQProgressBar(self.statusBar()) + self.pb.setPercentageVisible(False) + self.pb.hide() + self.statusBar().addWidget(self.pb, 0, True) + + self.connect(self.WebBrowser, qt.SIGNAL("ProgressChange(int,int)"), self.setProgress) + self.connect(self.WebBrowser, qt.SIGNAL("StatusTextChange(const TQString&)"), self.statusBar(), qt.SLOT("message(const TQString&)")) + + self.WebBrowser.dynamicCall("GoHome()"); + + self.subwindows = [] + + def go(self): + self.actionStop.setEnabled(True) + self.WebBrowser.dynamicCall("Navigate(const TQString&)", qt.TQVariant(self.addressEdit.text())) + + def setTitle(self, title): + self.setCaption("TQt WebBrowser - " + title.latin1()) + + def setProgress(self, a, b): + if a <= 0 or b <= 0: + self.pb.hide() + return + + self.pb.show() + self.pb.setTotalSteps(b) + self.pb.setProgress(a) + + def setCommandState(self, cmd, on): + if cmd == 1: + self.actionForward.setEnabled(on) + elif cmd == 2: + self.actionBack.setEnabled(on) + + def navigateBegin(self): + self.actionStop.setEnabled(True) + + def navigateComplete(self): + self.actionStop.setEnabled(False) + + def newWindow(self): + window = MainWindowImpl() + window.show() + + if self.addressEdit.text().isEmpty(): + return + + window.addressEdit.setText(self.addressEdit.text()) + window.actionStop.setEnabled(True) + window.go() + + self.subwindows += window + + def aboutSlot(self): + qt.TQMessageBox.about(self, self.tr("About WebBrowser"), self.tr( +"""This Example has been created using the ActiveTQt integration into TQt Designer. +It demonstrates the use of TQAxWidget to embed the Internet Explorer ActiveX +control into a TQt application.""")) + + def aboutTQtSlot(self): + qt.TQMessageBox.aboutTQt(self, self.tr("About TQt")) + + +def main(args): + a = qt.TQApplication(args) + w = MainWindowImpl() + a.setMainWidget(w) + w.show() + + return a.exec_loop() + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) |