Exemplo n.º 1
0
    def __init__(self, plugin, parent):
        Gtk.ApplicationWindow.__init__(self)
        self.set_application(app.app)
        self.set_show_menubar(False)
        self.set_title(_('PGP Configuration'))
        self.set_transient_for(parent)
        self.set_resizable(True)
        self.set_type_hint(Gdk.WindowTypeHint.DIALOG)
        self.set_destroy_with_parent(True)

        ui_path = Path(__file__).parent
        self._ui = get_builder(ui_path.resolve() / 'config.ui')

        self.add(self._ui.config_box)

        self._ui.connect_signals(self)

        self._plugin = plugin

        for account in app.connections.keys():
            page = Page(plugin, account)
            self._ui.stack.add_titled(page, account,
                                      app.get_account_label(account))

        self.show_all()
Exemplo n.º 2
0
    def on_activate(self, plugin_win):
        if hasattr(self, 'available_page'):
            # 'Available' tab exists
            return
        if hasattr(self, 'thread'):
            del self.thread
        self.installed_plugins_model = plugin_win.installed_plugins_model
        self.notebook = plugin_win.plugins_notebook
        id_ = self.notebook.connect('switch-page',
                                    self._on_notebook_switch_page)
        self.connected_ids[id_] = self.notebook
        self.window = plugin_win.window
        id_ = self.window.connect('destroy', self._on_destroy)
        self.connected_ids[id_] = self.window

        self._ui = get_builder(self.local_file_path('installer.ui'))

        self.spinner = self._ui.spinner
        self.install_plugin_button = self._ui.install_plugin_button
        self.available_plugins_model = self._ui.plugin_store
        self.available_plugins_model.set_sort_column_id(
            2, Gtk.SortType.ASCENDING)
        self.available_page = self.notebook.append_page(
            self._ui.available_plugins_box, Gtk.Label.new(_('Available')))

        self._ui.connect_signals(self)
        self.window.show_all()
Exemplo n.º 3
0
    def __init__(self, secret_keys, transient_for):
        Gtk.Dialog.__init__(self,
                            title=_('Assign PGP Key'),
                            transient_for=transient_for)

        secret_keys[_('None')] = _('None')

        self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.set_resizable(True)
        self.set_default_size(500, 300)

        self.add_button(_('Cancel'), Gtk.ResponseType.CANCEL)
        self.add_button(_('OK'), Gtk.ResponseType.OK)

        self._selected_key = None

        ui_path = Path(__file__).parent
        self._ui = get_builder(ui_path.resolve() / 'choose_key.ui')

        self._ui.keys_treeview = self._ui.keys_treeview

        model = self._ui.keys_treeview.get_model()
        model.set_sort_func(1, self._sort)

        model = self._ui.keys_treeview.get_model()
        for key_id in secret_keys.keys():
            model.append((key_id, secret_keys[key_id]))

        self.get_content_area().add(self._ui.box)

        self._ui.connect_signals(self)

        self.connect_after('response', self._on_response)

        self.show_all()
Exemplo n.º 4
0
    def init(self):
        path = self.plugin.local_file_path('config_dialog.ui')
        self._ui = get_builder(
            path, widgets=['plugin_box', 'liststore1', 'liststore2'])

        box = self.get_content_area()
        box.pack_start(self._ui.plugin_box, True, True, 0)

        self._ui.connect_signals(self)
        self.connect('hide', self.on_hide)
Exemplo n.º 5
0
    def __init__(self, plugin, window, event):
        self._plugin = plugin
        self._event = event

        path = self._plugin.local_file_path('gtk/progress.ui')
        self._ui = get_builder(path)
        self._ui.progress_dialog.set_transient_for(window)
        self._ui.progressbar.set_text("")
        self._ui.progress_dialog.show_all()

        image_path = self._plugin.local_file_path('omemo.png')
        self._ui.image.set_from_file(image_path)
        self._ui.connect_signals(self)
        self._seen = 0
Exemplo n.º 6
0
    def init(self):
        # pylint: disable=attribute-defined-outside-init
        path = self.plugin.local_file_path('gtk/config.ui')
        self._ui = get_builder(path)

        image_path = self.plugin.local_file_path('omemo.png')
        self._ui.image.set_from_file(image_path)

        try:
            self.disabled_accounts = self.plugin.config['DISABLED_ACCOUNTS']
        except KeyError:
            self.plugin.config['DISABLED_ACCOUNTS'] = []
            self.disabled_accounts = self.plugin.config['DISABLED_ACCOUNTS']

        box = self.get_content_area()
        box.pack_start(self._ui.notebook1, True, True, 0)

        self._ui.connect_signals(self)

        self.plugin_active = False
Exemplo n.º 7
0
    def __init__(self, plugin, contact, transient, windows, groupchat=False):
        super().__init__(title=_('OMEMO Fingerprints'),
                         destroy_with_parent=True)

        self.set_transient_for(transient)
        self.set_resizable(True)
        self.set_default_size(500, 450)

        self.get_style_context().add_class('omemo-key-dialog')

        self._groupchat = groupchat
        self._contact = contact
        self._windows = windows
        self._account = self._contact.account.name
        self._plugin = plugin
        self._omemo = self._plugin.get_omemo(self._account)
        self._own_jid = app.get_jid_from_account(self._account)
        self._show_inactive = False

        path = self._plugin.local_file_path('gtk/key.ui')
        self._ui = get_builder(path)

        self._ui.header.set_text(_('Fingerprints for %s') % self._contact.jid)

        omemo_img_path = self._plugin.local_file_path('omemo.png')
        self._ui.omemo_image.set_from_file(omemo_img_path)

        self._ui.list.set_filter_func(self._filter_func, None)
        self._ui.list.set_sort_func(self._sort_func, None)

        self._identity_key = self._omemo.backend.storage.getIdentityKeyPair()
        ownfpr_format = get_fingerprint(self._identity_key, formatted=True)
        self._ui.own_fingerprint.set_text(ownfpr_format)

        self.get_content_area().add(self._ui.grid)

        self.update()
        self._load_qrcode()
        self._ui.connect_signals(self)
        self.connect('destroy', self._on_destroy)
        self.show_all()
Exemplo n.º 8
0
    def init(self):
        path = self.plugin.local_file_path('config_dialog.ui')
        self._ui = get_builder(path)
        box = self.get_content_area()
        box.pack_start(self._ui.main_box, True, True, 0)

        self._ui.set_translation_domain('gajim_plugins')

        self.liststore = Gtk.ListStore(str)
        self._ui.default_lexer_combobox.set_model(self.liststore)

        self.style_liststore = Gtk.ListStore(str)
        self._ui.style_combobox.set_model(self.style_liststore)

        self._ui.preview_textview.get_buffer().connect(
            'insert-text', self._on_preview_text_inserted)

        self._ui.connect_signals(self)

        self.default_lexer_id = 0
        self.style_id = 0
Exemplo n.º 9
0
    def __init__(self, plugin, transient):
        Gtk.ApplicationWindow.__init__(self)
        self.set_application(app.app)
        self.set_show_menubar(False)
        self.set_title(_('Acronyms Configuration'))
        self.set_transient_for(transient)
        self.set_default_size(400, 400)
        self.set_type_hint(Gdk.WindowTypeHint.DIALOG)
        self.set_modal(True)
        self.set_destroy_with_parent(True)

        ui_path = Path(__file__).parent
        self._ui = get_builder(ui_path.resolve() / 'config.ui')

        self._plugin = plugin

        self.add(self._ui.box)

        self._fill_list()
        self.show_all()

        self._ui.connect_signals(self)
        self.connect('destroy', self._on_destroy)
Exemplo n.º 10
0
 def init(self):
     self._ui = get_builder(self.plugin.local_file_path('config.ui'))
     self.get_child().add(self._ui.config_grid)
     self._ui.connect_signals(self)