Exemple #1
0
    def _nec_notification(self, obj):
        if obj.do_popup:
            if obj.popup_image:
                icon_path = gtkgui_helpers.get_icon_path(obj.popup_image, 48)
                if icon_path:
                    image_path = icon_path
            elif obj.popup_image_path:
                image_path = obj.popup_image_path
            else:
                image_path = ''
            popup(obj.popup_event_type,
                  obj.jid,
                  obj.conn.name,
                  obj.popup_msg_type,
                  path_to_image=image_path,
                  title=obj.popup_title,
                  text=obj.popup_text,
                  timeout=obj.popup_timeout)

        if obj.do_sound:
            if obj.sound_file:
                helpers.play_sound_file(obj.sound_file)
            elif obj.sound_event:
                helpers.play_sound(obj.sound_event)

        if obj.do_command:
            try:
                helpers.exec_command(obj.command, use_shell=True)
            except Exception:
                pass
Exemple #2
0
 def on_open_file_in_browser_menuitem_activate(self, menu, data):
     if os.name == "nt":
         filepath = "file://" + os.path.abspath(data["filepath"])
     else:
         filepath = "file://" + data["filepath"]
     if app.config.get('autodetect_browser_mailer') \
             or app.config.get('custombrowser') == '':
         dialogs.ErrorDialog(
             _('Cannot open downloaded file in browser'),
             _('You have to set a custom browser executable '
               'in your gajim settings for this to work.'),
             transient_for=app.app.get_active_window())
         return
     command = app.config.get('custombrowser')
     command = helpers.build_command(command, filepath)
     try:
         helpers.exec_command(command)
     except Exception:
         pass
Exemple #3
0
    def _nec_notification(self, obj):
        if obj.do_popup:
            icon_name = self._get_icon_name(obj)
            self.popup(obj.popup_event_type, str(obj.jid), obj.conn.name,
                       obj.popup_msg_type, icon_name=icon_name,
                       title=obj.popup_title, text=obj.popup_text,
                       timeout=obj.popup_timeout)

        if obj.do_sound:
            if obj.sound_file:
                helpers.play_sound_file(obj.sound_file)
            elif obj.sound_event:
                helpers.play_sound(obj.sound_event)

        if obj.do_command:
            try:
                helpers.exec_command(obj.command, use_shell=True)
            except Exception:
                pass