[installer] Update GUI

This commit is contained in:
Daniel Brötzmann
2018-10-08 19:59:29 +02:00
committed by Philipp Hörist
parent 6e12a1e493
commit 3e2abc58c0
2 changed files with 249 additions and 247 deletions

View File

@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.14"/>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="ConfigWindow">
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkGrid" id="config_grid">
<property name="visible">True</property>
@@ -55,47 +58,47 @@
<object class="GtkWindow" id="AvailablePlugins">
<property name="can_focus">False</property>
<child>
<object class="GtkPaned" id="paned">
<placeholder/>
</child>
<child>
<object class="GtkBox" id="available_plugins_box">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="margin_left">18</property>
<property name="margin_right">18</property>
<property name="margin_top">18</property>
<property name="margin_bottom">18</property>
<property name="spacing">18</property>
<child>
<object class="GtkGrid" id="plugin_grid">
<object class="GtkBox">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkProgressBar" id="progressbar">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<object class="GtkScrolledWindow" id="scrolledwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">out</property>
<child>
<object class="GtkTreeView" id="available_treeview">
<object class="GtkTreeView" id="available_plugins_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="model">plugin_store</property>
<property name="headers_clickable">False</property>
<property name="search_column">1</property>
<child internal-child="selection">
<object class="GtkTreeSelection">
<object class="GtkTreeSelection" id="treeview-selection">
<signal name="changed" handler="available_plugins_treeview_selection_changed" swapped="no"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">200</property>
<property name="min_width">150</property>
<property name="max_width">300</property>
<property name="title" translatable="yes">Plugin</property>
<property name="expand">True</property>
<child>
@@ -137,7 +140,7 @@
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Install /
Upgrade</property>
Update</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererToggle" id="togglerenderer">
@@ -149,200 +152,224 @@ Upgrade</property>
</child>
</object>
</child>
<style>
<class name="space"/>
</style>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<object class="GtkToolbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="layout_style">start</property>
<property name="show_arrow">False</property>
<property name="icon_size">1</property>
<child>
<object class="GtkButton" id="install_button">
<property name="label" translatable="yes">Install/Upgrade</property>
<object class="GtkToolButton" id="install_plugin_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">start</property>
<property name="vexpand">False</property>
<property name="image">refresh</property>
<property name="always_show_image">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Install/Update Plugin</property>
<property name="icon_name">system-software-update</property>
<signal name="clicked" handler="on_install_upgrade_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<style>
<class name="inline-toolbar"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkProgressBar" id="progressbar">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="width_request">400</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">18</property>
<child>
<object class="GtkLabel" id="plugin_name_label">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="halign">start</property>
<property name="label" translatable="yes">&lt;Plugin Name&gt;</property>
<property name="selectable">True</property>
<style>
<class name="large-header"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="plugin_description">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">&lt;Description&gt;</property>
<property name="wrap">True</property>
<property name="wrap_mode">word-char</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="label" translatable="yes">Version</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="label" translatable="yes">Authors</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="label" translatable="yes">Homepage</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="plugin_version_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">&lt;empty&gt;</property>
<property name="wrap">True</property>
<property name="wrap_mode">word-char</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="plugin_authors_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">&lt;empty&gt;</property>
<property name="wrap">True</property>
<property name="wrap_mode">word-char</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="plugin_homepage_linkbutton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">&lt;empty&gt;</property>
<property name="wrap">True</property>
<property name="wrap_mode">word-char</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="description_grid">
<property name="width_request">350</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="row_spacing">3</property>
<property name="column_spacing">5</property>
<child>
<object class="GtkLabel" id="name_label">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="halign">start</property>
<property name="selectable">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="versionlabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Version:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="authorslabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="label" translatable="yes">Authors:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="homepage_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Homepage:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="description_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Description:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="version_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">False</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="authors_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="wrap_mode">word-char</property>
<property name="selectable">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLinkButton" id="homepage_linkbutton">
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="relief">none</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_description_window">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">2</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkImage" id="refresh">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-refresh</property>
</object>
</interface>

View File

@@ -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('<body '):
desc = ('<body xmlns=\'http://www.w3.org/1999/xhtml\'>'
'%s</body>') % desc
desc = desc.replace('\n', '<br/>')
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 = '<a href="%s">%s</a>' % (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)