Gtk UI: Remove dependency manager code
This commit is contained in:
parent
d230bfb8f2
commit
5ac4b4ded0
|
@ -60,13 +60,6 @@
|
|||
</object>
|
||||
<accelerator key="P" modifiers="GDK_CONTROL_MASK"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="itemDependencies">
|
||||
<property name="name">itemDependencies</property>
|
||||
<property name="label" translatable="yes">Additional components</property>
|
||||
<signal handler="on_itemDependencies_activate" name="activate"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="itemClose">
|
||||
<property name="stock_id">gtk-close</property>
|
||||
|
@ -361,7 +354,6 @@
|
|||
<menuitem action="itemRemoveOldEpisodes"/>
|
||||
<separator/>
|
||||
<menuitem action="itemPreferences"/>
|
||||
<menuitem action="itemDependencies"/>
|
||||
<separator/>
|
||||
<menuitem action="itemClose"/>
|
||||
<menuitem action="itemQuit"/>
|
||||
|
|
|
@ -1,174 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--*- mode: xml -*-->
|
||||
<interface>
|
||||
<object class="GtkDialog" id="gPodderDependencyManager">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Additional components</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="default_width">500</property>
|
||||
<property name="default_height">300</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
<property name="has_separator">True</property>
|
||||
<signal handler="on_gPodderDependencyManager_response" name="response"/>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="closebutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="sw_components">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview_components">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
<signal handler="on_treeview_components_cursor_changed" name="cursor_changed"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="btn_install">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal handler="on_btn_install_clicked" name="clicked"/>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">0</property>
|
||||
<property name="right_padding">0</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-save</property>
|
||||
<property name="icon_size">4</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Install package</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="btn_about">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-about</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal handler="on_btn_about_clicked" name="clicked"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-7">closebutton1</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
|
@ -1,66 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# gPodder - A media aggregator and podcast client
|
||||
# Copyright (c) 2005-2010 Thomas Perl and the gPodder Team
|
||||
#
|
||||
# gPodder is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# gPodder is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import gtk
|
||||
|
||||
import gpodder
|
||||
|
||||
_ = gpodder.gettext
|
||||
|
||||
from gpodder import services
|
||||
|
||||
from gpodder.gtkui.services import DependencyModel
|
||||
|
||||
from gpodder.gtkui.interface.common import BuilderWidget
|
||||
|
||||
class gPodderDependencyManager(BuilderWidget):
|
||||
def new(self):
|
||||
col_name = gtk.TreeViewColumn(_('Feature'), gtk.CellRendererText(), text=0)
|
||||
self.treeview_components.append_column(col_name)
|
||||
col_installed = gtk.TreeViewColumn(_('Status'), gtk.CellRendererText(), text=2)
|
||||
self.treeview_components.append_column(col_installed)
|
||||
self.treeview_components.set_model(DependencyModel(services.dependency_manager))
|
||||
self.btn_about.set_sensitive(False)
|
||||
self.btn_install.hide()
|
||||
|
||||
def on_btn_about_clicked(self, widget):
|
||||
selection = self.treeview_components.get_selection()
|
||||
model, iter = selection.get_selected()
|
||||
if iter is not None:
|
||||
title = model.get_value(iter, 0)
|
||||
description = model.get_value(iter, 1)
|
||||
available = model.get_value(iter, 3)
|
||||
missing = model.get_value(iter, 4)
|
||||
|
||||
if not available:
|
||||
description += '\n\n'+_('Missing components:')+'\n\n'+missing
|
||||
|
||||
self.show_message(description, title, important=True)
|
||||
|
||||
def on_btn_install_clicked(self, widget):
|
||||
# TODO: Implement package manager integration
|
||||
pass
|
||||
|
||||
def on_treeview_components_cursor_changed(self, treeview):
|
||||
self.btn_about.set_sensitive(treeview.get_selection().count_selected_rows() > 0)
|
||||
# TODO: If installing is possible, show btn_install
|
||||
|
||||
def on_gPodderDependencyManager_response(self, dialog, response_id):
|
||||
self.gPodderDependencyManager.destroy()
|
||||
|
|
@ -37,33 +37,6 @@ import os
|
|||
import urlparse
|
||||
import threading
|
||||
|
||||
class DependencyModel(gtk.ListStore):
|
||||
C_NAME, C_DESCRIPTION, C_AVAILABLE_TEXT, C_AVAILABLE, C_MISSING = range(5)
|
||||
|
||||
def __init__(self, depman):
|
||||
gtk.ListStore.__init__(self, str, str, str, bool, str)
|
||||
|
||||
for feature_name, description, modules, tools in depman.dependencies:
|
||||
modules_available, module_info = depman.modules_available(modules)
|
||||
tools_available, tool_info = depman.tools_available(tools)
|
||||
|
||||
available = modules_available and tools_available
|
||||
if available:
|
||||
available_str = _('Available')
|
||||
else:
|
||||
available_str = _('Missing dependencies')
|
||||
|
||||
missing_str = []
|
||||
for module in modules:
|
||||
if not module_info[module]:
|
||||
missing_str.append(_('Python module "%s" not installed') % module)
|
||||
for tool in tools:
|
||||
if not tool_info[tool]:
|
||||
missing_str.append(_('Command "%s" not installed') % tool)
|
||||
missing_str = '\n'.join(missing_str)
|
||||
|
||||
self.append((feature_name, description, available_str, available, missing_str))
|
||||
|
||||
|
||||
class CoverDownloader(ObservableService):
|
||||
"""
|
||||
|
|
|
@ -103,7 +103,6 @@ if gpodder.ui.desktop:
|
|||
from gpodder.gtkui.desktop.shownotes import gPodderShownotes
|
||||
from gpodder.gtkui.desktop.episodeselector import gPodderEpisodeSelector
|
||||
from gpodder.gtkui.desktop.podcastdirectory import gPodderPodcastDirectory
|
||||
from gpodder.gtkui.desktop.dependencymanager import gPodderDependencyManager
|
||||
from gpodder.gtkui.interface.progress import ProgressIndicator
|
||||
try:
|
||||
from gpodder.gtkui.desktop.trayicon import GPodderStatusIcon
|
||||
|
@ -3269,9 +3268,6 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
|||
# Initial message to relayout window (in case it's opened in portrait mode
|
||||
self.preferences_dialog.on_window_orientation_changed(self._last_orientation)
|
||||
|
||||
def on_itemDependencies_activate(self, widget):
|
||||
gPodderDependencyManager(self.gPodder)
|
||||
|
||||
def on_goto_mygpo(self, widget):
|
||||
self.mygpo_client.open_website()
|
||||
|
||||
|
|
|
@ -63,55 +63,3 @@ class ObservableService(object):
|
|||
log('Signal "%s" is not available for notification.', signal_name, sender=self)
|
||||
|
||||
|
||||
class DependencyManager(object):
|
||||
def __init__(self):
|
||||
self.dependencies = []
|
||||
|
||||
def depend_on(self, feature_name, description, modules, tools):
|
||||
self.dependencies.append([feature_name, description, modules, tools])
|
||||
|
||||
def modules_available(self, modules):
|
||||
"""
|
||||
Receives a list of modules and checks if each
|
||||
of them is available. Returns a tuple with the
|
||||
first item being a boolean variable that is True
|
||||
when all required modules are available and False
|
||||
otherwise. The second item is a dictionary that
|
||||
lists every module as key with the available as
|
||||
boolean value.
|
||||
"""
|
||||
result = {}
|
||||
all_available = True
|
||||
for module in modules:
|
||||
try:
|
||||
__import__(module)
|
||||
result[module] = True
|
||||
except:
|
||||
result[module] = False
|
||||
all_available = False
|
||||
|
||||
return (all_available, result)
|
||||
|
||||
def tools_available(self, tools):
|
||||
"""
|
||||
See modules_available.
|
||||
"""
|
||||
result = {}
|
||||
all_available = True
|
||||
for tool in tools:
|
||||
if util.find_command(tool):
|
||||
result[tool] = True
|
||||
else:
|
||||
result[tool] = False
|
||||
all_available = False
|
||||
|
||||
return (all_available, result)
|
||||
|
||||
|
||||
dependency_manager = DependencyManager()
|
||||
|
||||
|
||||
# Register non-module-specific dependencies here
|
||||
dependency_manager.depend_on(_('Bluetooth file transfer'), _('Send podcast episodes to Bluetooth devices. Needs the bluetooth-sendto command from gnome-bluetooth.'), [], ['bluetooth-sendto'])
|
||||
dependency_manager.depend_on(_('HTML episode shownotes'), _('Display episode shownotes in HTML format using WebKit.'), ['webkit'], [])
|
||||
|
||||
|
|
Loading…
Reference in New Issue