def _show_message(self, title, message="", message_type='debug', icon='dialog-information', is_main=False, actions=[]): """Inform user about what's going on right now. :param title A message title :param message A message to show :param type Describes what type of message it is, i.e., 'debug' or 'notification' :param icon The name of icon to be displayed in the notification :param is_main Determines if the app should be exited on notification's closed callback :param actions A list of :class NotifyAction containing all actions to be added to the notification. :note type must be 'notification' """ if message_type is 'notification': notification = Notify.Notification.new(title, message, icon) for action in actions: notification.add_action(action.name, action.text, action.callback) if is_main: notification.connect('closed', self.__on_mainnotification_closed) notification.show() # Wait for any action # what if user clicked on the link? # -- the program will be still running # (no idea at the moment, how to avoid this) if actions: Gtk.main() else: Client._show_message(self, title, message)
def _show_message(self, title, message="", message_type='debug', icon='dialog-information', is_main=False, actions=[]): """Inform user about what's going on right now. :param title A message title :param message A message to show :param type Describes what type of message it is, i.e., 'debug' or 'notification' :param icon The name of icon to be displayed in the notification :param is_main Determines if the app should be exited on notification's closed callback :param actions A list of :class NotifyAction containing all actions to be added to the notification. :note type must be 'notification' """ if message_type is 'notification': notification = Notify.Notification.new( title, message, icon ) for action in actions: notification.add_action( action.name, action.text, action.callback ) if is_main: notification.connect( 'closed', self.__on_mainnotification_closed ) notification.show() # Wait for any action # what if user clicked on the link? # -- the program will be still running # (no idea at the moment, how to avoid this) if actions: Gtk.main() else: Client._show_message(self, title, message)
def __on_notification_copytoclipboard(self, notification, *args): clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) clipboard.set_text(notification.props.body, -1) Client._show_message( self, notification.props.body, "Copied to the clipboard" )
def __on_notification_copytoclipboard(self, notification, *args): clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) clipboard.set_text(notification.props.body, -1) Client._show_message(self, notification.props.body, "Copied to the clipboard")