def main(): water_status = { 'waterSensor1': '0', 'waterSensor2': '0', 'waterSensor3': '0' } def callback(data): water_status['waterSensorA'] = data.WaterDetA water_status['waterSensorB'] = data.WaterDetB water_status['waterSensorC'] = data.WaterDetC rospy.init_node('leak_notifier', anonymous=True) rospy.Subscriber("/hull_status", hull_status, callback) while not rospy.is_shutdown(): for key, value in water_status.iteritems(): if value == True: canberra = pycanberra.Canberra() canberra.easy_play_sync( "alarm-clock-elapsed" ) #for more sounds, see here: http://0pointer.de/public/sound-naming-spec.html#guidelines canberra.destroy() rospy.loginfo("Hey dude, you've got water in your TUBE man!") rospy.sleep(1) rospy.on_shutdown(destroyCanberra)
def main(): charge_status = {'oUPS1': '0', 'oUPS2': '0', 'oUPS3': '0', 'oUPS4': '0'} def callback(data): charge_status['oUPS1'] = data.battery1 charge_status['oUPS2'] = data.battery2 charge_status['oUPS3'] = data.battery3 charge_status['oUPS4'] = data.battery4 rospy.init_node('battery_notifier', anonymous=True) rospy.Subscriber("openups", openups, callback) while not rospy.is_shutdown(): for key, value in charge_status.iteritems(): if value <= 10: canberra = pycanberra.Canberra() canberra.easy_play_sync("suspend-error") canberra.destroy() rospy.loginfo('Low Power') rospy.sleep(1) rospy.on_shutdown(destroyCanberra)
def _busMessageCb(self, unused_bus, message): if message.type == Gst.MessageType.EOS: # Render complete self.debug("got EOS message, render complete") self._shutDown() self.progress.progressbar.set_text(_("Render complete")) self.progress.window.set_title(_("Render complete")) if has_libnotify: Notify.init("pitivi") if not self.progress.window.is_active(): self.notification = Notify.Notification.new(_("Render complete"), _('"%s" has finished rendering.' % self.fileentry.get_text()), "pitivi") self.notification.show() if has_canberra: canberra = pycanberra.Canberra() canberra.play(1, pycanberra.CA_PROP_EVENT_ID, "complete-media", None) self.progress.play_rendered_file_button.show() self.progress.close_button.show() self.progress.cancel_button.hide() self.progress.play_pause_button.hide() elif message.type == Gst.MessageType.ERROR: # Errors in a GStreamer pipeline are fatal. If we encounter one, # we should abort and show the error instead of sitting around. error, details = message.parse_error() self._cancelRender() self._showRenderErrorDialog(error, details) elif message.type == Gst.MessageType.STATE_CHANGED and self.progress: prev, state, pending = message.parse_state_changed() if message.src == self._pipeline: state_really_changed = pending == Gst.State.VOID_PENDING if state_really_changed: if state == Gst.State.PLAYING: self.debug("Rendering started/resumed, resetting ETA calculation and inhibiting sleep") self.timestarted = time.time() self.system.inhibitSleep(RenderDialog.INHIBIT_REASON) else: self.system.uninhibitSleep(RenderDialog.INHIBIT_REASON)
# -*- coding: utf-8 -*- """ Sound theme plugin using pycanberra """ import pycanberra from pybitmessage.bitmessageqt import sound _canberra = pycanberra.Canberra() _theme = { sound.SOUND_UNKNOWN: 'message-new-email', sound.SOUND_CONNECTED: 'network-connectivity-established', sound.SOUND_DISCONNECTED: 'network-connectivity-lost', sound.SOUND_CONNECTION_GREEN: 'network-connectivity-established' } def connect_plugin(category, label=None): # pylint: disable=unused-argument """This function implements the entry point.""" try: _canberra.play(0, pycanberra.CA_PROP_EVENT_ID, _theme[category], None) except (KeyError, pycanberra.CanberraException): pass
def _maybePlayFinishedSound(): if not PYCANBERRA_SOFT_DEPENDENCY: return import pycanberra canberra = pycanberra.Canberra() canberra.play(1, pycanberra.CA_PROP_EVENT_ID, "complete-media", None)
def _maybePlayFinishedSound(): if "pycanberra" in missing_soft_deps: return import pycanberra canberra = pycanberra.Canberra() canberra.play(1, pycanberra.CA_PROP_EVENT_ID, "complete-media", None)