当前位置: 首页>>代码示例>>Python>>正文


Python QDBusConnection.sessionBus方法代码示例

本文整理汇总了Python中PyQt5.QtDBus.QDBusConnection.sessionBus方法的典型用法代码示例。如果您正苦于以下问题:Python QDBusConnection.sessionBus方法的具体用法?Python QDBusConnection.sessionBus怎么用?Python QDBusConnection.sessionBus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtDBus.QDBusConnection的用法示例。


在下文中一共展示了QDBusConnection.sessionBus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
    def __init__(self):
        super(ChatMainWindow, self).__init__()

        self.m_nickname = "nickname"
        self.m_messages = []

        self.setupUi(self)
        self.sendButton.setEnabled(False)

        self.messageLineEdit.textChanged.connect(self.textChangedSlot)
        self.sendButton.clicked.connect(self.sendClickedSlot)
        self.actionChangeNickname.triggered.connect(self.changeNickname)
        self.actionAboutQt.triggered.connect(self.aboutQt)
        QApplication.instance().lastWindowClosed.connect(self.exiting)

        # Add our D-Bus interface and connect to D-Bus.
        ChatAdaptor(self)
        QDBusConnection.sessionBus().registerObject('/', self)

        iface = ChatInterface('', '', QDBusConnection.sessionBus(), self)
        QDBusConnection.sessionBus().connect('', '', 'org.example.chat',
                'message', self.messageSlot)
        iface.action.connect(self.actionSlot)

        dialog = NicknameDialog()
        dialog.cancelButton.setVisible(False)
        dialog.exec_()
        self.m_nickname = dialog.nickname.text().strip()
        self.action.emit(self.m_nickname, "joins the chat")
开发者ID:death-finger,项目名称:Scripts,代码行数:31,代码来源:chat.py

示例2: __init__

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
 def __init__(self, parent=None):
     QObject.__init__(self)
     self.interface = Interface('com.deepin.daemon.SystemInfo', '/com/deepin/daemon/SystemInfo',
             QDBusConnection.sessionBus(), self)
     QDBusConnection.sessionBus().connect('com.deepin.daemon.SystemInfo', 
             '/com/deepin/daemon/SystemInfo',
             'org.freedesktop.DBus.Properties',
             'PropertiesChanged', self.messageSlot)
开发者ID:PeterDaveHello,项目名称:dss,代码行数:10,代码来源:__init__.py

示例3: __init__

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
 def __init__(self, dbus_name, object_name):
     QObject.__init__(self)
     
     iface = QDBusInterface(dbus_name, object_name, '', QDBusConnection.sessionBus())
     if iface.isValid():
         iface.call("unique")
         sys.exit(1)
     
     QDBusConnection.sessionBus().registerService(dbus_name)
     QDBusConnection.sessionBus().registerObject(object_name, self, QDBusConnection.ExportAllSlots)
开发者ID:PeterDaveHello,项目名称:deepin-translator,代码行数:12,代码来源:unique_service.py

示例4: __init__

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
 def __init__(self):
     super(ControlCenterInterface, self).__init__(
         "com.deepin.dde.ControlCenter",
         "/com/deepin/dde/ControlCenter",
         "com.deepin.dde.ControlCenter",
         QDBusConnection.sessionBus(),
         None)
     sessionBus = QDBusConnection.sessionBus()
     self._control_center_exists = not sessionBus.registerService(
         self.service())
     sessionBus.unregisterService(self.service())
开发者ID:SyllaJay,项目名称:deepin-screenshot,代码行数:13,代码来源:dbus_interfaces.py

示例5: __init__

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
    def __init__(self, dbus_name, object_name):
        QObject.__init__(self)

        search_option = len(sys.argv) >= 2 and sys.argv[1] == "--search"
        iface = QDBusInterface(dbus_name, object_name, '', QDBusConnection.sessionBus())
        
        if iface.isValid():
            iface.call("unique")

            if search_option:
                iface.call("search")
            
            sys.exit(1)
        
        QDBusConnection.sessionBus().registerService(dbus_name)
        QDBusConnection.sessionBus().registerObject(object_name, self, QDBusConnection.ExportAllSlots)
开发者ID:diycp,项目名称:deepin-translator,代码行数:18,代码来源:unique_service.py

示例6: __init__

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
 def __init__(self):
     super(NotificationsInterface, self).__init__(
         NOTIFICATIONS_SERVICE,
         NOTIFICATIONS_PATH,
         NOTIFICATIONS_INTERFACE,
         QDBusConnection.sessionBus(),
         None)
开发者ID:AfterTheRainOfStars,项目名称:deepin-movie,代码行数:9,代码来源:dbus_interfaces.py

示例7: __init__

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
 def __init__(self):
     super(ScreenSaverInterface, self).__init__("org.freedesktop.ScreenSaver",
                                                "/org/freedesktop/ScreenSaver",
                                                "org.freedesktop.ScreenSaver",
                                                QDBusConnection.sessionBus(),
                                                None)
     self._inhibit_cookie = None
开发者ID:fpemud,项目名称:DMovie,代码行数:9,代码来源:dbus_interfaces.py

示例8: packagekit_install

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
def packagekit_install(pack="ffmpeg"):
    """
    Equivalent of:
     qdbus org.freedesktop.PackageKit /org/freedesktop/PackageKit
           org.freedesktop.PackageKit.Modify.InstallPackageNames
           0 ffmpeg  "show-confirm-search,hide-finished"
    Or:
     qdbus org.freedesktop.PackageKit /org/freedesktop/PackageKit
           org.freedesktop.PackageKit.Query.IsInstalled 0 ffmpeg
    See also (dbus) http://www.freedesktop.org/software/PackageKit/pk-faq.html#session-methods
    Doc: http://blog.fpmurphy.com/2013/11/packagekit-d-bus-abstraction-layer.html
    """
    from PyQt5.QtDBus import QDBusConnection
    from PyQt5.QtDBus import QDBusInterface

    bus = QDBusConnection.sessionBus()
    service_name = "org.freedesktop.PackageKit"
    service_path = "/org/freedesktop/PackageKit"

    interface = "org.freedesktop.PackageKit.Query.IsInstalled"
    install = QDBusInterface(service_name, service_path, interface, bus)
    reply = install.call(0, pack, "show-confirm-search,hide-finished")
    print(reply.arguments())

    interface = "org.freedesktop.PackageKit.Modify.InstallPackageNames"
    install = QDBusInterface(service_name, service_path, interface, bus)
    reply = install.call(0, pack, "show-confirm-search,hide-finished")
    print(reply.arguments())
开发者ID:eddy-geek,项目名称:quickcut,代码行数:30,代码来源:__init__.py

示例9: __init__

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
 def __init__(self):
     super(DisplayPropertyInterface, self).__init__(
         "com.deepin.daemon.Display",
         "/com/deepin/daemon/Display",
         "org.freedesktop.DBus.Properties",
         QDBusConnection.sessionBus(),
         None)
开发者ID:nicklv,项目名称:deepin-menu,代码行数:9,代码来源:DBusInterfaces.py

示例10: start

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
def start():
    app = QCoreApplication([])
    bus = QDBusConnection.sessionBus()
    server = MyServer()
    bus.registerObject('/mydbus', server)
    bus.registerService('com.home.dbus')
    app.exec()
开发者ID:rtpg,项目名称:junkcode,代码行数:9,代码来源:test-dbus.py

示例11: method3

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
def method3():
    sys.stdout.write("Method 3:\n")

    names = QDBusConnection.sessionBus().interface().registeredServiceNames().value()

    # Mimic the output from the C++ version.
    sys.stdout.write('("%s")\n' % '", "'.join(names))
开发者ID:death-finger,项目名称:Scripts,代码行数:9,代码来源:listnames.py

示例12: createServer

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
def createServer():
	global BUS, ROOT_OBJ

	ROOT_OBJ = SimpleHandler()

	BUS = QDBusConnection.sessionBus()
	BUS.registerService('re.indigo.eye')
	BUS.registerObject('/', ROOT_OBJ, QDBusConnection.ExportAllContents)
开发者ID:hydrargyrum,项目名称:eye,代码行数:10,代码来源:remote_control.py

示例13: __init__

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
 def __init__(self, parent):
     super(AppService, self).__init__(parent)
     self.connection = QDBusConnection.sessionBus()
     path = '/AppService'
     service = 'org.autokey.Service'
     self.connection.registerObject(path, parent)
     self.connection.registerService(service)
     self.setAutoRelaySignals(True)
开发者ID:autokey,项目名称:autokey,代码行数:10,代码来源:dbus_service.py

示例14: __init__

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
    def __init__(self):
        QtCore.QObject.__init__(self)
        self.session_bus = QDBusConnection.sessionBus()
        self.session_bus.connect(self.DBUS_NAME, self.DBUS_PATH, self.DBUS_IFACE,
            'MenuItemClicked', self.MenuItemClickedSlot)
        self.session_bus.connect(self.DBUS_NAME, self.DBUS_PATH, self.DBUS_IFACE,
            'CheckMenuItemClicked', self.CheckMenuItemClickedSlot)

        self._iface = QDBusInterface(self.DBUS_NAME, self.DBUS_PATH, self.DBUS_IFACE, self.session_bus)
开发者ID:xianjunzhengbackup,项目名称:LinuxBackup,代码行数:11,代码来源:dbus_proxy.py

示例15: method2

# 需要导入模块: from PyQt5.QtDBus import QDBusConnection [as 别名]
# 或者: from PyQt5.QtDBus.QDBusConnection import sessionBus [as 别名]
def method2():
    sys.stdout.write("Method 2:\n")

    bus = QDBusConnection.sessionBus()
    dbus_iface = QDBusInterface('org.freedesktop.DBus',
            '/org/freedesktop/DBus', 'org.freedesktop.DBus', bus)
    names = dbus_iface.call('ListNames').arguments()[0]

    # Mimic the output from the C++ version.
    sys.stdout.write('QVariant(QStringList, ("%s") )\n' % '", "'.join(names))
开发者ID:death-finger,项目名称:Scripts,代码行数:12,代码来源:listnames.py


注:本文中的PyQt5.QtDBus.QDBusConnection.sessionBus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。