本文整理汇总了Python中kdecore.KApplication.dcopClient方法的典型用法代码示例。如果您正苦于以下问题:Python KApplication.dcopClient方法的具体用法?Python KApplication.dcopClient怎么用?Python KApplication.dcopClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kdecore.KApplication
的用法示例。
在下文中一共展示了KApplication.dcopClient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: openFile
# 需要导入模块: from kdecore import KApplication [as 别名]
# 或者: from kdecore.KApplication import dcopClient [as 别名]
def openFile(pdf):
""" Open the specified PDF document """
global _file
c = KApplication.dcopClient()
kpdf = DCOPApp(c.appId(), c).kpdf
# When LilyPond writes a PDF, it first deletes the old one.
# So the new PDF gets a different inode number, which causes
# KPDF to sometimes loose the 'watch' on the file.
# So we call KPDF to open the file, and remember the page number
# displayed ourselves, because KPDF also seems to forget the scroll
# position due to LilyPond deleting the old PDF first.
# It would be best that either KPDF is fixed to just look for a
# named file, even if it has a different inode number, or that
# LilyPond is fixed to not delete the old PDF first, but just
# truncate it and write the new data into it.
# Update June 17, 2008: LilyPond >= 2.11.49 does not delete the PDF
# anymore on unix platforms!
# Document already shown?
if _file == pdf:
# Yes this is the same PDF, see if we need to force KPDF to
# reload the document. If not, we trust that KPDF automatically
# updates its view.
from lilykde.version import version
if (
# User can force reload of PDF with config option
config('preferences')['force reload pdf'] == '1'
# LilyPond >= 2.11.49 does not delete the PDF anymore on unix
or version < (2, 11, 49) or os.name not in ('posix', 'mac')
# read KPDF's 'watch file' option (default is true)
or kconfig('kpdfpartrc', True, False).group('General')['WatchFile']
in ('false', '0', 'off', 'no')):
# Reopen same document, remembering page number
page = kpdf.currentPage()[1]
kpdf.openDocument(KURL(pdf))
QTimer.singleShot(100, lambda: kpdf.goToPage(page))
else:
# This is another PDF, just open it.
kpdf.openDocument(KURL(pdf))
_file = pdf
示例2: KAboutData
# 需要导入模块: from kdecore import KApplication [as 别名]
# 或者: from kdecore.KApplication import dcopClient [as 别名]
#!/usr/bin/python
"""KDE support for dpaste"""
import sys, time
import dcop
import dcopext
from kdecore import KApplication, KCmdLineArgs, KAboutData
from qt import QString, QCString
import StringIO
import dpaster
description = "KDE interface to http://dpaste.com/"
version = "0.1"
aboutData = KAboutData ("testdcopext", "testdcopext",\
version, description, KAboutData.License_GPL,\
"(C) 2007 Peter Fein")
aboutData.addAuthor ("Peter Fein", "wrote it", "[email protected]")
KCmdLineArgs.init (sys.argv, aboutData)
app = KApplication ()
dcop = app.dcopClient ()
d = dcopext.DCOPApp ("klipper", dcop)
res, content = d.klipper.getClipboardContents()
sio=StringIO.StringIO(content)
url=dpaster.paste(sio)
res=d.klipper.setClipboardContents(url)