當前位置: 首頁>>代碼示例>>Python>>正文


Python KApplication.dcopClient方法代碼示例

本文整理匯總了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
開發者ID:Alwnikrotikz,項目名稱:lilykde,代碼行數:46,代碼來源:pdf.py

示例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)
開發者ID:grimreaper,項目名稱:dpaster,代碼行數:31,代碼來源:kdpaster.py


注:本文中的kdecore.KApplication.dcopClient方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。