From 3e2abc58c0a883254d72afe2261ac3d5af26ed88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Br=C3=B6tzmann?= Date: Mon, 8 Oct 2018 19:59:29 +0200 Subject: [PATCH] [installer] Update GUI --- plugin_installer/config_dialog.ui | 417 ++++++++++++++------------- plugin_installer/plugin_installer.py | 79 ++--- 2 files changed, 249 insertions(+), 247 deletions(-) diff --git a/plugin_installer/config_dialog.ui b/plugin_installer/config_dialog.ui index faa0b61..5f9fa01 100644 --- a/plugin_installer/config_dialog.ui +++ b/plugin_installer/config_dialog.ui @@ -1,9 +1,12 @@ - + - + False + + + True @@ -55,47 +58,47 @@ False - + + + + True - True + False + 18 + 18 + 18 + 18 + 18 - + + 200 True False + True + vertical - - False - True - end - - - 0 - 1 - - - - + True True - True - True - 6 never + out - + True True - True plugin_store - False - 1 - + + True + fixed + 200 + 150 + 300 Plugin True @@ -137,7 +140,7 @@ Install / -Upgrade +Update 0.5 @@ -149,200 +152,224 @@ Upgrade + - 0 - 0 + True + True + 0 - + True False - start - 2 - 2 - 6 - vertical - start + False + 1 - - Install/Upgrade + True - True - True - start - False - refresh - True + False + False + Install/Update Plugin + system-software-update - True - True - 0 + False + False + + + + + + False + True + 1 + + + + + False + True + end + + + False + True + 2 + + + + + False + True + 0 + + + + + 400 + True + False + True + vertical + 18 + + + False + True + start + <Plugin Name> + True + + + + False + True + 0 + + + + + True + False + start + <Description> + True + word-char + True + + + False + True + 1 + + + + + True + False + 6 + 12 + + + True + False + end + start + Version + + + + 0 + 0 + + + + + True + False + end + start + Authors + + + + 0 + 1 + + + + + True + False + end + start + Homepage + + + + 0 + 2 + + + + + True + False + start + <empty> + True + word-char + True + 0 + + + 1 + 0 + + + + + True + False + start + <empty> + True + word-char + True + 0 + + + 1 + 1 + + + + + True + False + start + <empty> + True + word-char + 0 + + + 1 + 2 - 0 - 2 + False + True + 2 - True - False - - - - - 350 - True - False - 6 - 3 - 5 - - - False - True - start - True - - - - - - 0 - 0 - 2 - - - - - True - False - start - Version: - - - 0 - 1 - - - - - True - False - start - start - Authors: - - - 0 - 2 - - - - - True - False - start - Homepage: - - - 0 - 3 - - - - - True - False - start - Description: - - - 0 - 4 - 2 - - - - - True - False - start - False - True - - - 1 - 1 - - - - - True - False - start - start - word-char - True - end - - - 1 - 2 - - - - - True - False - True - True - start - True - none - - - 1 - 3 - - - - - True - True - True - True - in - - - - - - 0 - 5 - 2 - - - - - True - False + False + True + 1 - - True - False - gtk-refresh - diff --git a/plugin_installer/plugin_installer.py b/plugin_installer/plugin_installer.py index 44c5b15..58c5fd2 100644 --- a/plugin_installer/plugin_installer.py +++ b/plugin_installer/plugin_installer.py @@ -43,7 +43,6 @@ try: from common import gajim as app from plugins import GajimPlugin from plugins.gui import GajimPluginConfigDialog - from htmltextview import HtmlTextView from dialogs import WarningDialog, HigDialog, YesNoDialog from gtkgui_helpers import get_action except ImportError: @@ -51,7 +50,6 @@ except ImportError: from gajim.common import configpaths from gajim.plugins import GajimPlugin from gajim.plugins.gui import GajimPluginConfigDialog - from gajim.htmltextview import HtmlTextView from gajim.dialogs import WarningDialog, HigDialog, YesNoDialog from gajim.gtkgui_helpers import get_action @@ -131,7 +129,7 @@ class PluginInstaller(GajimPlugin): def warn_update(self, plugins): def open_update(dummy): get_action('plugins').activate() - page = self.notebook.page_num(self.paned) + page = self.notebook.page_num(self.available_plugins_box) self.notebook.set_current_page(page) if plugins: plugins_str = '\n' + '\n'.join(plugins) @@ -154,7 +152,7 @@ class PluginInstaller(GajimPlugin): def deactivate(self): if hasattr(self, 'available_page'): - self.notebook.remove_page(self.notebook.page_num(self.paned)) + self.notebook.remove_page(self.notebook.page_num(self.available_plugins_box)) self.notebook.set_current_page(0) for id_, widget in list(self.connected_ids.items()): widget.disconnect(id_) @@ -182,35 +180,24 @@ class PluginInstaller(GajimPlugin): self.xml = Gtk.Builder() self.xml.set_translation_domain('gajim_plugins') self.xml.add_objects_from_file(self.Gtk_BUILDER_FILE_PATH, - ['refresh', 'paned', 'plugin_store']) + ['refresh', 'available_plugins_box', 'plugin_store']) widgets_to_extract = ( - 'name_label', 'available_treeview', 'progressbar', 'paned', - 'install_button', 'authors_label', 'homepage_linkbutton', - 'version_label', 'scrolled_description_window') + 'available_plugins_box', 'install_plugin_button', 'plugin_name_label', + 'plugin_version_label', 'plugin_authors_label', 'plugin_description', + 'plugin_homepage_linkbutton', 'progressbar', 'available_plugins_treeview', + 'available_text', 'available_text_label') for widget_name in widgets_to_extract: setattr(self, widget_name, self.xml.get_object(widget_name)) - # Make Link in LinkButton not centered - style_provider = Gtk.CssProvider() - css = '.link { padding-left: 0px; padding-right: 0px; }' - style_provider.load_from_data(css.encode()) - context = self.homepage_linkbutton.get_style_context() - context.add_provider(style_provider, - Gtk.STYLE_PROVIDER_PRIORITY_USER) - self.available_page = self.notebook.append_page( - self.paned, Gtk.Label.new(_('Available'))) + self.available_plugins_box, Gtk.Label.new(_('Available'))) self.available_plugins_model = self.xml.get_object('plugin_store') self.available_plugins_model.set_sort_column_id( 2, Gtk.SortType.ASCENDING) - self.description_textview = HtmlTextView() - self.description_textview.set_wrap_mode(Gtk.WrapMode.WORD) - self.scrolled_description_window.add(self.description_textview) - self.xml.connect_signals(self) self.window.show_all() @@ -227,7 +214,7 @@ class PluginInstaller(GajimPlugin): for i in range(len(self.available_plugins_model)): if self.available_plugins_model[i][Column.UPGRADE]: dir_list.append(self.available_plugins_model[i][Column.DIR]) - self.install_button.set_property('sensitive', bool(dir_list)) + self.install_plugin_button.set_property('sensitive', bool(dir_list)) def on_notebook_switch_page(self, widget, page, page_num): tab_label_text = self.notebook.get_tab_label_text(page) @@ -238,7 +225,7 @@ class PluginInstaller(GajimPlugin): self.start_download(upgrading=True) def on_install_upgrade_clicked(self, widget): - self.install_button.set_property('sensitive', False) + self.install_plugin_button.set_property('sensitive', False) dir_list = [] for i in range(len(self.available_plugins_model)): if self.available_plugins_model[i][Column.UPGRADE]: @@ -316,43 +303,31 @@ class PluginInstaller(GajimPlugin): def available_plugins_treeview_selection_changed(self, treeview_selection): model, iter_ = treeview_selection.get_selected() - self.description_textview.get_buffer().set_text('') if not iter_: - self.name_label.set_text('') - self.version_label.set_text('') - self.authors_label.set_text('') - self.homepage_linkbutton.set_uri('') - self.homepage_linkbutton.set_label('') - self.install_button.set_sensitive(False) + self.plugin_name_label.set_text('') + self.plugin_version_label.set_text('') + self.plugin_authors_label.set_text('') + self.plugin_homepage_linkbutton.set_text('') + self.install_plugin_button.set_sensitive(False) return - self.install_button.set_sensitive(True) - self.name_label.set_text(model.get_value(iter_, Column.NAME)) - self.version_label.set_text(model.get_value(iter_, Column.VERSION)) - self.authors_label.set_text(model.get_value(iter_, Column.AUTHORS)) - self.homepage_linkbutton.set_uri( - model.get_value(iter_, Column.HOMEPAGE)) - self.homepage_linkbutton.set_label( - model.get_value(iter_, Column.HOMEPAGE)) - link_label = self.homepage_linkbutton.get_children()[0] - link_label.set_ellipsize(Pango.EllipsizeMode.END) - desc = _(model.get_value(iter_, Column.DESCRIPTION)) - if not desc.startswith('' - '%s') % desc - desc = desc.replace('\n', '
') - self.description_textview.display_html( - desc, self.description_textview, None) + self.plugin_name_label.set_text(model.get_value(iter_, Column.NAME)) + self.plugin_version_label.set_text(model.get_value(iter_, Column.VERSION)) + self.plugin_authors_label.set_text(model.get_value(iter_, Column.AUTHORS)) + homepage = model.get_value(iter_, Column.HOMEPAGE) + markup = '%s' % (homepage, homepage) + self.plugin_homepage_linkbutton.set_markup(markup) + self.plugin_description.set_text(model.get_value(iter_, Column.DESCRIPTION)) def select_root_iter(self): - selection = self.available_treeview.get_selection() + selection = self.available_plugins_treeview.get_selection() model, iter_ = selection.get_selected() if not iter_: iter_ = self.available_plugins_model.get_iter_first() selection.select_iter(iter_) - self.name_label.show() - self.homepage_linkbutton.show() + self.plugin_name_label.show() + self.plugin_homepage_linkbutton.show() path = self.available_plugins_model.get_path(iter_) - self.available_treeview.scroll_to_cell(path) + self.available_plugins_treeview.scroll_to_cell(path) class DownloadAsync(threading.Thread): @@ -504,7 +479,7 @@ class DownloadAsync(threading.Thread): if V(plugin['version']) > V(plugin['local_version']): plugin['upgrade'] = True GLib.idle_add( - self.plugin.install_button.set_property, + self.plugin.install_plugin_button.set_property, 'sensitive', True) GLib.idle_add(self.model_append, plugin) GLib.idle_add(self.plugin.select_root_iter)