本文整理汇总了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")
示例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)
示例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)
示例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())
示例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)
示例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)
示例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
示例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())
示例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)
示例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()
示例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))
示例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)
示例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)
示例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)
示例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))