コード例 #1
0
ファイル: filetransfer.py プロジェクト: shubham2110/gajim1
 def show_send_error(self, file_props):
     """
     Show error dialog to the sender saying that transfer has been canceled
     """
     InformationDialog(
         _('File transfer cancelled'),
         _('Connection with peer could not be established.'))
     self._ui.transfers_list.get_selection().unselect_all()
コード例 #2
0
    def on_plugin_downloaded(self, plugin_dirs, auto_update):
        need_restart = False
        for _dir in plugin_dirs:
            updated = app.plugin_manager.update_plugins(replace=False,
                                                        activate=True,
                                                        plugin_name=_dir)
            if updated:
                if not auto_update:
                    plugin = self._get_plugin(updated[0])
                    if plugin is None:
                        log.error('Plugin %s not found', updated[0])
                        continue
                    for row in range(len(self.available_plugins_model)):
                        model_row = self.available_plugins_model[row]
                        if plugin.name == model_row[Column.NAME]:
                            model_row[Column.LOCAL_VERSION] = plugin.version
                            model_row[Column.UPGRADE] = False
                            break

                    # Get plugin icon
                    icon_file = os.path.join(plugin.__path__,
                                             os.path.split(
                                                 plugin.__path__)[1]) + '.png'
                    icon = FALLBACK_ICON
                    if os.path.isfile(icon_file):
                        icon = GdkPixbuf.Pixbuf.new_from_file_at_size(
                            icon_file, 16, 16)
                    row = [
                        plugin, plugin.name, plugin.active, plugin.activatable,
                        icon
                    ]
                    self.installed_plugins_model.append(row)
            else:
                need_restart = True

        if not auto_update:
            if need_restart:
                sectext = _('Updates will be installed next time Gajim is '
                            'started.')
            else:
                sectext = _('All selected plugins downloaded and activated.')
            InformationDialog(_('Plugin Updates Downloaded'), sectext)

        if auto_update and self.config['auto_update_feedback']:

            def _on_ok(is_checked):
                if is_checked:
                    self.config['auto_update_feedback'] = False

            NewConfirmationCheckDialog(
                _('Plugins Updated'), _('Plugins Updated'),
                _('Plugin updates have successfully been downloaded.\n'
                  'Updates will be installed next time Gajim is started.'),
                _('Do not show this message again'),
                [DialogButton.make('OK', callback=_on_ok)]).show()

        if auto_update and not self.config['auto_update_feedback']:
            log.info('Updates downloaded, will install on next restart')
コード例 #3
0
    def _mam_prefs_error(self, obj=None):
        if obj and obj.conn.name != self.account:
            return

        self._disable_spinner()

        if not obj:
            msg = _('No response from the Server')
        else:
            msg = _('Error received: {}').format(obj.error_msg)

        InformationDialog(_('Archiving Preferences Error'), msg)

        self._set_mam_box_state(True)
コード例 #4
0
ファイル: profile.py プロジェクト: bj-h/gajim
 def _nec_vcard_not_published(self, _event):
     if self.message_id:
         self.statusbar.remove(self.context_id, self.message_id)
     self.message_id = self.statusbar.push(
         self.context_id, _('Information NOT published'))
     self.remove_statusbar_timeout_id = GLib.timeout_add_seconds(
         3, self.remove_statusbar, self.message_id)
     if self.update_progressbar_timeout_id is not None:
         GLib.source_remove(self.update_progressbar_timeout_id)
         self.progressbar.set_fraction(0)
         self.update_progressbar_timeout_id = None
     InformationDialog(
         _('vCard publication failed'),
         _('There was an error while publishing your personal information, '
           'try again later.'), transient_for=self)
コード例 #5
0
 def on_encryption_button_clicked(chat_control):
     account = chat_control.account
     key_id = chat_control.contact.keyID
     transient = chat_control.parent_win.window
     authenticated, info = check_state(key_id, account)
     InformationDialog(authenticated, info, transient)
コード例 #6
0
 def _on_accept_button_clicked(self, _widget):
     model = self._ui.items_list_treeview.get_model()
     iter_ = model.get_iter_first()
     if self.action == 'add':
         count = 0
         while iter_:
             if model[iter_][0]:
                 count += 1
                 # It is selected
                 message = _('%s suggested me to add you to my '
                             'contact list.' % self.jid_from)
                 # Keep same groups and same nickname
                 groups = model[iter_][3].split(', ')
                 if groups == ['']:
                     groups = []
                 jid = model[iter_][1]
                 if app.jid_is_transport(self.jid_from):
                     con = app.connections[self.account]
                     con.get_module('Presence').automatically_added.append(
                         jid)
                 app.interface.roster.req_sub(self,
                                              jid,
                                              message,
                                              self.account,
                                              groups=groups,
                                              nickname=model[iter_][2],
                                              auto_auth=True)
             iter_ = model.iter_next(iter_)
         InformationDialog(
             i18n.ngettext('Added %d contact', 'Added %d contacts', count,
                           count, count))
     elif self.action == 'modify':
         count = 0
         while iter_:
             if model[iter_][0]:
                 count += 1
                 # It is selected
                 jid = model[iter_][1]
                 # Keep same groups and same nickname
                 groups = model[iter_][3].split(', ')
                 if groups == ['']:
                     groups = []
                 for contact in app.contacts.get_contact(self.account, jid):
                     contact.name = model[iter_][2]
                 con = app.connections[self.account]
                 con.get_module('Roster').update_contact(
                     jid, model[iter_][2], groups)
                 con.get_module('Roster').draw_contact(jid, self.account)
                 # Update opened chats
                 ctrl = app.interface.msg_win_mgr.get_control(
                     jid, self.account)
                 if ctrl:
                     ctrl.update_ui()
                     win = app.interface.msg_win_mgr.get_window(
                         jid, self.account)
                     win.redraw_tab(ctrl)
                     win.show_title()
             iter_ = model.iter_next(iter_)
     elif self.action == 'delete':
         count = 0
         while iter_:
             if model[iter_][0]:
                 count += 1
                 # It is selected
                 jid = model[iter_][1]
                 app.connections[self.account].get_module(
                     'Presence').unsubscribe(jid)
                 app.interface.roster.remove_contact(jid, self.account)
                 app.contacts.remove_jid(self.account, jid)
             iter_ = model.iter_next(iter_)
         InformationDialog(
             i18n.ngettext('Removed %d contact', 'Removed %d contacts',
                           count, count, count))
     self.destroy()