def test3(): self._state["recordingExposureNs"] = int(8.5e8) signal = QDBusMessage.createSignal( '/', 'com.krontech.chronos.control.mock', 'recordingExposureNs') signal << self._state["recordingExposureNs"] QDBusConnection.systemBus().send(signal)
def setIconName(self, value): self._iconName = value msg = QDBusMessage.createSignal("/StatusNotifierItem", "org.kde.StatusNotifierItem", "NewIcon") msg.setArguments([]) self.__sessionService.sessionBus.send(msg)
def _updateLayout(self): self._revision += 1 msg = QDBusMessage.createSignal("/MenuBar", "com.canonical.dbusmenu", "LayoutUpdated") msg.setArguments([ QDBusArgument(self._revision, QMetaType.UInt), QDBusArgument(DBusMenuAction.Root.value, QMetaType.Int), ]) self.__sessionService.sessionBus.send(msg)
def setIconName(self, value): self._iconName = value msg = QDBusMessage.createSignal( "/StatusNotifierItem", "org.kde.StatusNotifierItem", "NewIcon" ) msg.setArguments([]) self.__sessionService.sessionBus.send(msg)
def _updateLayout(self): self._revision += 1 msg = QDBusMessage.createSignal("/MenuBar", "com.canonical.dbusmenu", "LayoutUpdated") msg.setArguments([ QDBusArgument(self._revision, QMetaType.UInt), QDBusArgument(DBusMenuAction.Root.value, QMetaType.Int), ]) self.__sessionService.sessionBus.send(msg)
def action(self, notification_id: int, name: str) -> None: """Sends an action notification for the given ID.""" message = QDBusMessage.createSignal( notification.DBusNotificationAdapter.PATH, notification.DBusNotificationAdapter.INTERFACE, "ActionInvoked") message.setArguments([notification._as_uint32(notification_id), name]) if not self._bus.send(message): raise OSError("Could not send action notification")
def setProgress(self, value: float, visible: bool=True) -> bool: if sys.platform.startswith('linux') and self._sessionbus.isConnected(): signal = QDBusMessage.createSignal('/com/canonical/unity/launcherentry/337963624', 'com.canonical.Unity.LauncherEntry', 'Update') message = signal << self._desktopfile << {'progress-visible': visible, 'progress': value} return self._sessionbus.send(message) elif sys.platform == 'win32' and TaskbarProgress.isValidWinVer(): self.parent.win_taskbar_button.progress().setValue(int(value * 100)) return True
def setProgress(self, value: float, visible: bool = True): signal = QDBusMessage.createSignal( '/com/canonical/unity/launcherentry/337963624', 'com.canonical.Unity.LauncherEntry', 'Update') message = signal << self._desktopfile << { 'progress-visible': visible, 'progress': value } self._sessionbus.send(message)
def update(self, progress, visible=True): self._progress = progress self._visible = visible # Automatic forwarding of Qt signals does not work in this case # since Qt cannot handle the complex "a{sv}" type. # Create the signal message manually. message = QDBusMessage.createSignal(self._path, DBUS_INTERFACE, 'Update') message.setArguments([self._app_uri, self.current_progress]) self._bus.send(message)
def close(self, notification_id: int) -> None: """Sends a close notification for the given ID.""" message = QDBusMessage.createSignal( notification.DBusNotificationAdapter.PATH, notification.DBusNotificationAdapter.INTERFACE, "NotificationClosed") # The 2 here is the notification removal reason ("dismissed by the user") # it's effectively arbitrary as we don't use that information message.setArguments([ notification._as_uint32(notification_id), notification._as_uint32(2), ]) if not self._bus.send(message): raise OSError("Could not send close notification")
def sendClickedSlot(self): msg = QDBusMessage.createSignal('/', 'org.example.chat', 'message') msg << self.m_nickname << self.messageLineEdit.text() QDBusConnection.sessionBus().send(msg) self.messageLineEdit.setText('')
def invokeItem(self, id): msg = QDBusMessage.createSignal('/com/deepin/menu', 'com.deepin.menu.Menu', 'ItemInvoked') msg << id QDBusConnection.sessionBus().send(msg)
def emitControlSignal(self, name: str, value=None) -> None: """Emit an update signal, usually for indicating a value has changed.""" signal = QDBusMessage.createSignal('/ca/krontech/chronos/control_mock', 'ca.krontech.chronos.control_mock', 'notify') signal << { name: getattr(state, name) if value is None else value } QDBusConnection.systemBus().send(signal)
def sendClickedSlot(self): msg = QDBusMessage.createSignal("/", "org.example.chat", "message") msg << self.m_nickname << self.messageLineEdit.text() QDBusConnection.sessionBus().send(msg) self.messageLineEdit.setText("")
def __init__(self): self.signal = QDBusMessage.createSignal( "/org/mpris/MediaPlayer2", "org.freedesktop.DBus.Properties", "PropertiesChanged" )
def sendClickedSlot(self): msg = QDBusMessage.createSignal('/', 'org.example.chat', 'message') msg << self.m_nickname << self.messageLineEdit.text() QDBusConnection.sessionBus().send(msg) self.messageLineEdit.setText('')
def emitSignal(self, signalName: str, *args) -> None: """Emit an arbitrary signal. (Use emitControlSignal for API values.)""" signal = QDBusMessage.createSignal('/ca/krontech/chronos/control_mock', 'ca.krontech.chronos.control_mock', signalName) for arg in args: signal << arg QDBusConnection.systemBus().send(signal)