From 57e2ced52bf3ba886bb7710212167a86e20305e6 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:14:34 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- examples/pyKHTMLPart.py | 4 +- examples/pytde-sampler/gen_todo.py | 2 +- examples/pytde-sampler/qt_widgets/CONTRIB | 110 ++++++++-------- examples/pytde-sampler/sampler.py | 6 +- examples/uikmdi.py | 203 ------------------------------ examples/uikmdi.rc | 11 -- examples/uitdemdi.py | 203 ++++++++++++++++++++++++++++++ examples/uitdemdi.rc | 11 ++ 8 files changed, 275 insertions(+), 275 deletions(-) delete mode 100644 examples/uikmdi.py delete mode 100644 examples/uikmdi.rc create mode 100644 examples/uitdemdi.py create mode 100644 examples/uitdemdi.rc (limited to 'examples') diff --git a/examples/pyKHTMLPart.py b/examples/pyKHTMLPart.py index e483d6f..2795526 100644 --- a/examples/pyKHTMLPart.py +++ b/examples/pyKHTMLPart.py @@ -51,10 +51,10 @@ from qt import TQString, TQStringList from kio import KTrader -from khtml import KHTMLPart, KHTMLView +from tdehtml import KHTMLPart, KHTMLView # Importing the KParts namespace gets us all of the KParts:: classes -from kparts import KParts, createReadOnlyPart, createReadWritePart +from tdeparts import KParts, createReadOnlyPart, createReadWritePart import sys, os diff --git a/examples/pytde-sampler/gen_todo.py b/examples/pytde-sampler/gen_todo.py index 6abd5be..d094ab6 100644 --- a/examples/pytde-sampler/gen_todo.py +++ b/examples/pytde-sampler/gen_todo.py @@ -1,4 +1,4 @@ -mods = ['dcop', 'tdecore', 'tdefx', 'tdeprint', 'tdesu', 'tdeui', 'kfile', 'khtml', 'kio', 'kmdi', 'kparts', 'kspell', ] +mods = ['dcop', 'tdecore', 'tdefx', 'tdeprint', 'tdesu', 'tdeui', 'kfile', 'tdehtml', 'kio', 'tdemdi', 'tdeparts', 'tdespell', ] all = [] diff --git a/examples/pytde-sampler/qt_widgets/CONTRIB b/examples/pytde-sampler/qt_widgets/CONTRIB index bf546f4..ea10773 100644 --- a/examples/pytde-sampler/qt_widgets/CONTRIB +++ b/examples/pytde-sampler/qt_widgets/CONTRIB @@ -392,10 +392,10 @@ kfile,KURLComboRequester,,, kfile,KURLPropsPlugin,,, kfile,KURLRequester,,, kfile,KURLRequesterDlg,,, -khtml,DOM,,, -khtml,KHTMLPart,,, -khtml,KHTMLSettings,,, -khtml,KHTMLView,,, +tdehtml,DOM,,, +tdehtml,KHTMLPart,,, +tdehtml,KHTMLSettings,,, +tdehtml,KHTMLView,,, kio,KAr,,, kio,KArchive,,, kio,KArchiveDirectory,,, @@ -484,54 +484,54 @@ kio,ThumbCreator,,, kio,testKIOMetaData,,, kio,testKIOUDSEntry,,, kio,testKIOUDSEntryList,,, -kmdi,KMdi,,, -kmdi,KMdiChildArea,,, -kmdi,KMdiChildFrm,,, -kmdi,KMdiChildFrmCaption,,, -kmdi,KMdiChildFrmDragBeginEvent,,, -kmdi,KMdiChildFrmDragEndEvent,,, -kmdi,KMdiChildFrmMoveEvent,,, -kmdi,KMdiChildFrmResizeBeginEvent,,, -kmdi,KMdiChildFrmResizeEndEvent,,, -kmdi,KMdiChildView,,, -kmdi,KMdiMainFrm,,, -kmdi,KMdiTaskBar,,, -kmdi,KMdiTaskBarButton,,, -kmdi,KMdiToolViewAccessor,,, -kmdi,KMdiViewCloseEvent,,, -kmdi,KMdiWin32IconButton,,, -kparts,KParts,,, -kparts,createReadOnlyPart,,, -kparts,createReadWritePart,,, -kparts,testTQMapTQCStringInt,,, -kspell,KS_ADD,,, -kspell,KS_CANCEL,,, -kspell,KS_CLIENT_ASPELL,,, -kspell,KS_CLIENT_HSPELL,,, -kspell,KS_CLIENT_ISPELL,,, -kspell,KS_CONFIG,,, -kspell,KS_E_ASCII,,, -kspell,KS_E_CP1251,,, -kspell,KS_E_CP1255,,, -kspell,KS_E_KOI8R,,, -kspell,KS_E_KOI8U,,, -kspell,KS_E_LATIN1,,, -kspell,KS_E_LATIN13,,, -kspell,KS_E_LATIN15,,, -kspell,KS_E_LATIN2,,, -kspell,KS_E_LATIN3,,, -kspell,KS_E_LATIN4,,, -kspell,KS_E_LATIN5,,, -kspell,KS_E_LATIN7,,, -kspell,KS_E_LATIN8,,, -kspell,KS_E_LATIN9,,, -kspell,KS_E_UTF8,,, -kspell,KS_IGNORE,,, -kspell,KS_IGNOREALL,,, -kspell,KS_REPLACE,,, -kspell,KS_REPLACEALL,,, -kspell,KS_STOP,,, -kspell,KS_SUGGEST,,, -kspell,KSpell,,, -kspell,KSpellConfig,,, -kspell,KSpellDlg,,, +tdemdi,KMdi,,, +tdemdi,KMdiChildArea,,, +tdemdi,KMdiChildFrm,,, +tdemdi,KMdiChildFrmCaption,,, +tdemdi,KMdiChildFrmDragBeginEvent,,, +tdemdi,KMdiChildFrmDragEndEvent,,, +tdemdi,KMdiChildFrmMoveEvent,,, +tdemdi,KMdiChildFrmResizeBeginEvent,,, +tdemdi,KMdiChildFrmResizeEndEvent,,, +tdemdi,KMdiChildView,,, +tdemdi,KMdiMainFrm,,, +tdemdi,KMdiTaskBar,,, +tdemdi,KMdiTaskBarButton,,, +tdemdi,KMdiToolViewAccessor,,, +tdemdi,KMdiViewCloseEvent,,, +tdemdi,KMdiWin32IconButton,,, +tdeparts,KParts,,, +tdeparts,createReadOnlyPart,,, +tdeparts,createReadWritePart,,, +tdeparts,testTQMapTQCStringInt,,, +tdespell,KS_ADD,,, +tdespell,KS_CANCEL,,, +tdespell,KS_CLIENT_ASPELL,,, +tdespell,KS_CLIENT_HSPELL,,, +tdespell,KS_CLIENT_ISPELL,,, +tdespell,KS_CONFIG,,, +tdespell,KS_E_ASCII,,, +tdespell,KS_E_CP1251,,, +tdespell,KS_E_CP1255,,, +tdespell,KS_E_KOI8R,,, +tdespell,KS_E_KOI8U,,, +tdespell,KS_E_LATIN1,,, +tdespell,KS_E_LATIN13,,, +tdespell,KS_E_LATIN15,,, +tdespell,KS_E_LATIN2,,, +tdespell,KS_E_LATIN3,,, +tdespell,KS_E_LATIN4,,, +tdespell,KS_E_LATIN5,,, +tdespell,KS_E_LATIN7,,, +tdespell,KS_E_LATIN8,,, +tdespell,KS_E_LATIN9,,, +tdespell,KS_E_UTF8,,, +tdespell,KS_IGNORE,,, +tdespell,KS_IGNOREALL,,, +tdespell,KS_REPLACE,,, +tdespell,KS_REPLACEALL,,, +tdespell,KS_STOP,,, +tdespell,KS_SUGGEST,,, +tdespell,KSpell,,, +tdespell,KSpellConfig,,, +tdespell,KSpellDlg,,, diff --git a/examples/pytde-sampler/sampler.py b/examples/pytde-sampler/sampler.py index 183b185..f90a1bb 100755 --- a/examples/pytde-sampler/sampler.py +++ b/examples/pytde-sampler/sampler.py @@ -22,8 +22,8 @@ from tdeui import KMainWindow, KPushButton, KSplashScreen, KStdAction from tdeui import KKeyDialog, KEditToolbar from kio import KTrader -from kparts import createReadOnlyPart, createReadWritePart -from khtml import KHTMLPart +from tdeparts import createReadOnlyPart, createReadWritePart +from tdehtml import KHTMLPart import about import lib @@ -152,7 +152,7 @@ class WebFrame(CommonFrame): def __init__(self, parent): CommonFrame.__init__(self, parent) self.part = part = buildPart(self, 'text/html', "Type == 'Service'") - #part.connect(part, SIGNAL('khtmlMousePressEvent(a)'), self.onURL) + #part.connect(part, SIGNAL('tdehtmlMousePressEvent(a)'), self.onURL) def onURL(self, a): print '****', a diff --git a/examples/uikmdi.py b/examples/uikmdi.py deleted file mode 100644 index 6c9cc21..0000000 --- a/examples/uikmdi.py +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env python -""" -This is a rough Python translation of the ideas presented in this KMDI tutorial: - - http://web.tiscali.it/andreabergia/kmditutorial.html - -What does work: - - IDEAlMode - yay! - - Adding and closing child views - - Two-way syncing between a tool widget and a matching child view - -All is not rosy, however: - - Instances of the KmdiExample maintain a dictionary of child views. Values - cannot be deleted from this dictionary during a window close (causes an - immediate segfault). - - Child views created after initialization aren't numbered correctly; given - the first problem, it's harder to do this than it's really worth. - - The example segfaults at shutdown if the tool (on the left) is is open but - is not in overlap-mode. - -""" -import os -import sys - -from qt import SIGNAL, TQVBoxLayout, TQLabel -from tdecore import i18n, TDEAboutData, TDEApplication, TDEGlobal, KIcon, TDECmdLineArgs -from tdeui import KDockWidget, KListBox, KStdAction - -try: - from kmdi import KMdi, KMdiMainFrm, KMdiChildView -except (ImportError, ): - print 'Exception importing KMDI; check your PyKDE installation' - sys.exit(1) - - -sigChildCloseRequest = SIGNAL('childWindowCloseRequest(KMdiChildView *)') -sigChildViewActivated = SIGNAL('viewActivated(KMdiChildView *)') -sigBoxSelectionChanged = SIGNAL('selectionChanged(TQListBoxItem *)') - - -def getIcon(name, group=KIcon.NoGroup, size=KIcon.SizeSmall): - """ returns a kde icon by name - - """ - return TDEGlobal.instance().iconLoader().loadIcon(name, group, size) - - -class KmdiExample(KMdiMainFrm): - """ KmdiExample(parent=None) -> an example KMdiMainFrm window - - """ - uifilebase = 'uikmdi.rc' - viewIcons = ('network', 'email', 'stop', 'back', 'forward', ) - toolIcons = ('view_icon', 'configure') - - def __init__(self, parent=None): - KMdiMainFrm.__init__(self, parent, 'KmdiExample', KMdi.IDEAlMode) - - xmlfile = os.path.join('.', self.uifilebase) - self.setXMLFile(os.path.abspath(xmlfile)) - actions = self.actionCollection() - self.openNewAction = KStdAction.openNew(self.newView, actions) - self.quitAction = KStdAction.quit(self.close, actions) - self.closeAction = KStdAction.close(self.closeActiveChild, actions) - self.createGUI(None) - self.statusBar() - self.resize(400, 300) - - self.tools = {} - for idx, ico in enumerate(self.toolIcons): - wid = KListBox(self, 'list%s' % idx) - self.makeTool(wid, 'Tool %s' % idx, ico) - ## smells - self.mainToolWidget = maintool = self.tools['Tool 0'][0] - - self.childs = {} - for idx, ico in enumerate(self.viewIcons): - self.makeView('View %s' % idx, ico, ico) - - - self.connect(self, sigChildViewActivated, self.activatedMessage) - self.connect(self, sigChildViewActivated, self.syncFromChildView) - self.connect(maintool, sigBoxSelectionChanged, self.syncFromMainTool) - self.syncFromChildView(self.activeWindow()) - - - def syncFromMainTool(self, item): - """ activate the view that matches the item text - - """ - try: - self.activateView(self.findWindow(item.text())) - except (RuntimeError, ): - pass - - def syncFromChildView(self, child): - """ sync the main tool to the indicated child - - """ - maintool = self.mainToolWidget - item = maintool.findItem(child.tabCaption()) - if item: - maintool.setSelected(item, True) - - def makeTool(self, widget, caption, icon, percent=50): - """ makes a tool from the widget - - """ - tip = i18n('%s Tool Tip' % caption) - dock = KDockWidget.DockLeft - maindock = self.getMainDockWidget() - widget.setIcon(getIcon(icon)) - tool = self.addToolWindow(widget, dock, maindock, percent, tip, caption) - self.tools[caption] = (widget, tool) - - def makeView(self, label, icon, text): - """ makes a child view with a text label and a pixmap label - - """ - view = KMdiChildView(label, self) - self.childs[label] = view - view.setIcon(getIcon(icon)) - layout = TQVBoxLayout(view) - layout.setAutoAdd(True) - - lbl = i18n('Label for a view with an icon named %s' % text) - lbl = TQLabel(lbl, view) - pxm = TQLabel('', view) - pxm.setPixmap(getIcon(icon, size=KIcon.SizeLarge)) - - self.addWindow(view) - self.mainToolWidget.insertItem(label) - self.connect(view, sigChildCloseRequest, self.closeChild) - - def removeMainToolItem(self, view): - """ remove item from the main list tool that corresponds to the view - - """ - maintool = self.mainToolWidget - maintool.takeItem(maintool.findItem(view.tabCaption(), 0)) - - def newView(self): - """ make a view when the user invokes the new action - - """ - self.makeView('View %s' % len(self.childs), 'network', 'A Fresh View') - self.syncFromChildView(self.activeWindow()) - - def closeActiveChild(self): - """ close the current view - - """ - self.removeMainToolItem(self.activeWindow()) - self.closeActiveView() - self.syncFromChildView(self.activeWindow()) - - def closeChild(self, which): - """ called to close a view from its tab close button - - """ - try: - caption = which.tabCaption() - except (AttributeError, ): - ## probably None; bug in kmdi? - return - self.removeMainToolItem(which) - which.close() - self.statusBar().message(i18n('%s closed' % caption)) - self.syncFromChildView(self.activeWindow()) - - def activatedMessage(self, view): - """ updates the status bar with the caption of the current view - - """ - try: - self.statusBar().message(i18n('%s activated' % view.tabCaption())) - except (RuntimeError, ): - ## sometimes the status bar or the current object is already gone... - pass - - -if __name__ == '__main__': - aname = 'PyKDE KMDI Sample' - desc = 'A Simple PyKDE KMDI Sample' - ver = '1.0' - lic = TDEAboutData.License_GPL - author = 'Troy Melhase' - authormail = 'troy@gci.net' - - about = TDEAboutData(aname, aname, ver, desc, lic, '%s (c) 2004' % authormail) - about.addAuthor(author, 'hi, mom!', authormail) - about.addAuthor ('Jim Bublitz', 'For PyKDE', 'jbublitz@nwinternet.com') - TDECmdLineArgs.init(sys.argv, about) - app = TDEApplication() - mainWindow = KmdiExample() - mainWindow.show() - app.exec_loop() diff --git a/examples/uikmdi.rc b/examples/uikmdi.rc deleted file mode 100644 index a7e2196..0000000 --- a/examples/uikmdi.rc +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/examples/uitdemdi.py b/examples/uitdemdi.py new file mode 100644 index 0000000..f746384 --- /dev/null +++ b/examples/uitdemdi.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python +""" +This is a rough Python translation of the ideas presented in this KMDI tutorial: + + http://web.tiscali.it/andreabergia/tdemditutorial.html + +What does work: + + IDEAlMode - yay! + + Adding and closing child views + + Two-way syncing between a tool widget and a matching child view + +All is not rosy, however: + + Instances of the KmdiExample maintain a dictionary of child views. Values + cannot be deleted from this dictionary during a window close (causes an + immediate segfault). + + Child views created after initialization aren't numbered correctly; given + the first problem, it's harder to do this than it's really worth. + + The example segfaults at shutdown if the tool (on the left) is is open but + is not in overlap-mode. + +""" +import os +import sys + +from qt import SIGNAL, TQVBoxLayout, TQLabel +from tdecore import i18n, TDEAboutData, TDEApplication, TDEGlobal, KIcon, TDECmdLineArgs +from tdeui import KDockWidget, KListBox, KStdAction + +try: + from tdemdi import KMdi, KMdiMainFrm, KMdiChildView +except (ImportError, ): + print 'Exception importing KMDI; check your PyKDE installation' + sys.exit(1) + + +sigChildCloseRequest = SIGNAL('childWindowCloseRequest(KMdiChildView *)') +sigChildViewActivated = SIGNAL('viewActivated(KMdiChildView *)') +sigBoxSelectionChanged = SIGNAL('selectionChanged(TQListBoxItem *)') + + +def getIcon(name, group=KIcon.NoGroup, size=KIcon.SizeSmall): + """ returns a kde icon by name + + """ + return TDEGlobal.instance().iconLoader().loadIcon(name, group, size) + + +class KmdiExample(KMdiMainFrm): + """ KmdiExample(parent=None) -> an example KMdiMainFrm window + + """ + uifilebase = 'uitdemdi.rc' + viewIcons = ('network', 'email', 'stop', 'back', 'forward', ) + toolIcons = ('view_icon', 'configure') + + def __init__(self, parent=None): + KMdiMainFrm.__init__(self, parent, 'KmdiExample', KMdi.IDEAlMode) + + xmlfile = os.path.join('.', self.uifilebase) + self.setXMLFile(os.path.abspath(xmlfile)) + actions = self.actionCollection() + self.openNewAction = KStdAction.openNew(self.newView, actions) + self.quitAction = KStdAction.quit(self.close, actions) + self.closeAction = KStdAction.close(self.closeActiveChild, actions) + self.createGUI(None) + self.statusBar() + self.resize(400, 300) + + self.tools = {} + for idx, ico in enumerate(self.toolIcons): + wid = KListBox(self, 'list%s' % idx) + self.makeTool(wid, 'Tool %s' % idx, ico) + ## smells + self.mainToolWidget = maintool = self.tools['Tool 0'][0] + + self.childs = {} + for idx, ico in enumerate(self.viewIcons): + self.makeView('View %s' % idx, ico, ico) + + + self.connect(self, sigChildViewActivated, self.activatedMessage) + self.connect(self, sigChildViewActivated, self.syncFromChildView) + self.connect(maintool, sigBoxSelectionChanged, self.syncFromMainTool) + self.syncFromChildView(self.activeWindow()) + + + def syncFromMainTool(self, item): + """ activate the view that matches the item text + + """ + try: + self.activateView(self.findWindow(item.text())) + except (RuntimeError, ): + pass + + def syncFromChildView(self, child): + """ sync the main tool to the indicated child + + """ + maintool = self.mainToolWidget + item = maintool.findItem(child.tabCaption()) + if item: + maintool.setSelected(item, True) + + def makeTool(self, widget, caption, icon, percent=50): + """ makes a tool from the widget + + """ + tip = i18n('%s Tool Tip' % caption) + dock = KDockWidget.DockLeft + maindock = self.getMainDockWidget() + widget.setIcon(getIcon(icon)) + tool = self.addToolWindow(widget, dock, maindock, percent, tip, caption) + self.tools[caption] = (widget, tool) + + def makeView(self, label, icon, text): + """ makes a child view with a text label and a pixmap label + + """ + view = KMdiChildView(label, self) + self.childs[label] = view + view.setIcon(getIcon(icon)) + layout = TQVBoxLayout(view) + layout.setAutoAdd(True) + + lbl = i18n('Label for a view with an icon named %s' % text) + lbl = TQLabel(lbl, view) + pxm = TQLabel('', view) + pxm.setPixmap(getIcon(icon, size=KIcon.SizeLarge)) + + self.addWindow(view) + self.mainToolWidget.insertItem(label) + self.connect(view, sigChildCloseRequest, self.closeChild) + + def removeMainToolItem(self, view): + """ remove item from the main list tool that corresponds to the view + + """ + maintool = self.mainToolWidget + maintool.takeItem(maintool.findItem(view.tabCaption(), 0)) + + def newView(self): + """ make a view when the user invokes the new action + + """ + self.makeView('View %s' % len(self.childs), 'network', 'A Fresh View') + self.syncFromChildView(self.activeWindow()) + + def closeActiveChild(self): + """ close the current view + + """ + self.removeMainToolItem(self.activeWindow()) + self.closeActiveView() + self.syncFromChildView(self.activeWindow()) + + def closeChild(self, which): + """ called to close a view from its tab close button + + """ + try: + caption = which.tabCaption() + except (AttributeError, ): + ## probably None; bug in tdemdi? + return + self.removeMainToolItem(which) + which.close() + self.statusBar().message(i18n('%s closed' % caption)) + self.syncFromChildView(self.activeWindow()) + + def activatedMessage(self, view): + """ updates the status bar with the caption of the current view + + """ + try: + self.statusBar().message(i18n('%s activated' % view.tabCaption())) + except (RuntimeError, ): + ## sometimes the status bar or the current object is already gone... + pass + + +if __name__ == '__main__': + aname = 'PyKDE KMDI Sample' + desc = 'A Simple PyKDE KMDI Sample' + ver = '1.0' + lic = TDEAboutData.License_GPL + author = 'Troy Melhase' + authormail = 'troy@gci.net' + + about = TDEAboutData(aname, aname, ver, desc, lic, '%s (c) 2004' % authormail) + about.addAuthor(author, 'hi, mom!', authormail) + about.addAuthor ('Jim Bublitz', 'For PyKDE', 'jbublitz@nwinternet.com') + TDECmdLineArgs.init(sys.argv, about) + app = TDEApplication() + mainWindow = KmdiExample() + mainWindow.show() + app.exec_loop() diff --git a/examples/uitdemdi.rc b/examples/uitdemdi.rc new file mode 100644 index 0000000..a7e2196 --- /dev/null +++ b/examples/uitdemdi.rc @@ -0,0 +1,11 @@ + + + + + + + + -- cgit v1.2.3