summaryrefslogtreecommitdiffstats
path: root/examples/pyTDEHTMLPart.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pyTDEHTMLPart.py')
-rw-r--r--examples/pyTDEHTMLPart.py54
1 files changed, 22 insertions, 32 deletions
diff --git a/examples/pyTDEHTMLPart.py b/examples/pyTDEHTMLPart.py
index fc3f934..333247d 100644
--- a/examples/pyTDEHTMLPart.py
+++ b/examples/pyTDEHTMLPart.py
@@ -8,7 +8,7 @@ This is an extemely simple and crude example of using
a TDEHTMLPart - I put it together mostly to make sure
the openURL method worked correctly after some modifications
done in KParts::ReadOnlyPart. It took exactly four lines
-added to a basic PyKDE app framework to display a URL
+added to a basic PyTDE app framework to display a URL
via the 'net:
self.w = TDEHTMLPart (self, "HTMLPart", self);
@@ -26,31 +26,27 @@ probably need to connect some signals to slots. I
haven't tried it, but this should work with a plain
TDEMainWindow or other widget too.
-The KDE website also incorporates gifs, jpegs, and
+The TDE website also incorporates gifs, jpegs, and
I believe CSS too. Playing around with some other
sites, it appears the font defaults could use some
improvement.
NOTE!!! For this to work, you (obviously) need to have
a route to the internet established or specify a local
-URL - PyKDE/KDE will take care of everything else.
+URL - PyTDE/TDE will take care of everything else.
Perceptive users will notice the TDEHTMLPart code is
-lifted from the KDE classref.
+lifted from the TDE classref.
"""
# If you import more classes, don't forget to add them here (some of these
# are extras/not used)
+from PyTQt.qt import TQString, TQStringList
from tdecore import TDECmdLineArgs, KURL, TDEApplication, i18n, TDEAboutData, BarIcon, KLibLoader
-
from tdeui import TDEMainWindow, KMessageBox, TDEAction, KStdAction, KKeyDialog, KEditToolbar
-
-from PyTQt.qt import TQString, TQStringList
-
from tdeio import TDETrader
-
from tdehtml import TDEHTMLPart, TDEHTMLView
# Importing the KParts namespace gets us all of the KParts:: classes
@@ -58,20 +54,14 @@ from tdeparts import KParts, createReadOnlyPart, createReadWritePart
import sys, os
-FALSE = 0
-TRUE = not FALSE
-
TOOLBAR_EXIT = 0
TOOLBAR_OPEN = 1
# Note that we use KParts.MainWindow, not TDEMainWindow as the superclass
-# (KParts.MainWindow subclasses TDEMainWindow). Also, be sure the 'apply'
-# clause references KParts.MainWindow - it's a hard bug to track down
-# if it doesn't.
-
+# (KParts.MainWindow subclasses TDEMainWindow).
class pyPartsMW (KParts.MainWindow):
def __init__ (self, *args):
- apply (KParts.MainWindow.__init__, (self,) + args)
+ KParts.MainWindow.__init__(self, *args)
# Create the actions for our menu/toolbar to use
# Keep in mind that the part loaded will provide its
@@ -90,19 +80,19 @@ class pyPartsMW (KParts.MainWindow):
KStdAction.configureToolbars(self.optionsConfigureToolbars, self.actionCollection());
self.path = os.getcwd () + '/'
- self.setGeometry (0, 0, 600, 500)
+ self.setGeometry (0, 0, 1024, 768)
# point to our XML file
- self.setXMLFile (self.path + "pyParts.rc", FALSE)
+ self.setXMLFile (self.path + "pyParts.rc", False)
# The next few lines are all that's necessary to
# create a web browser (of course you have to edit
# this file to change url's)
self.w = TDEHTMLPart (self, "HTMLPart", self);
- self.w.openURL (KURL ("http://www.kde.org"));
+ self.w.openURL (KURL ("http://www.trinitydesktop.org"));
- self.w.view ().setGeometry (30, 55, 500, 400);
+ self.w.view ().setGeometry (30, 30, 1024-60, 768-60);
# self.v = TDEHTMLView (self.w, self)
@@ -143,21 +133,21 @@ class pyPartsMW (KParts.MainWindow):
# some boilerplate left over from pyKLess/KLess
def queryClose(self):
res = KMessageBox.warningYesNoCancel(self,\
- i18n("Save changes to Document?<br>(Does not make sense, we know, but it is just a programming example :-)"))
+ i18n("<qt>Save changes to Document?<br/>(Does not make sense, we know, but it is just a programming example :-)</qt>"))
if res == KMessageBox.Yes:
- #// save document here. If saving fails, return FALSE
- return TRUE
+ #// save document here. If saving fails, return False
+ return True
elif res == KMessageBox.No:
- return TRUE
+ return True
else: #// cancel
- return FALSE
+ return False
def queryExit(self):
#// this slot is invoked in addition when the *last* window is going
#// to be closed. We could do some final cleanup here.
- return TRUE #// accept
+ return True #// accept
# I'm not sure the session mgmt stuff here works
@@ -181,16 +171,16 @@ class pyPartsMW (KParts.MainWindow):
#------------- main ----------------------------
# A Human readable description of your program
-description = "TDEHTMLPart - simple example"
+description = b"TDEHTMLPart - simple example"
# The version
-version = "0.1"
+version = b"0.1"
# stuff for the "About" menu
-aboutData = TDEAboutData ("pyTDEHTMLPart", "pyHTMLPart",\
+aboutData = TDEAboutData (b"pyTDEHTMLPart", b"pyHTMLPart",\
version, description, TDEAboutData.License_GPL,\
- "(c) 2002, Jim Bublitz")
+ b"(c) 2002, Jim Bublitz")
-aboutData.addAuthor ("Jim Bublitz", "Example for PyKDE", "[email protected]")
+aboutData.addAuthor (b"Jim Bublitz", b"Example for PyTDE", b"[email protected]")
# This MUST go here (before TDEApplication () is called)
TDECmdLineArgs.init (sys.argv, aboutData)