[gnome-lirc-properties] Remove download and upload capabilities
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-lirc-properties] Remove download and upload capabilities
- Date: Wed, 19 May 2010 14:08:35 +0000 (UTC)
commit 9c2b2f963ba0df39cd57ce18ccabd55a46c7a58a
Author: Bastien Nocera <hadess hadess net>
Date: Wed May 19 13:51:04 2010 +0100
Remove download and upload capabilities
As the web service is not maintained, and there are no checks
on the validity of uploaded remotes, or check for duplicates.
Makefile.am | 4 +-
configure.ac | 17 -
data/gnome-lirc-properties-custom-config.ui | 19 -
gnome_lirc_properties/Makefile.am | 2 +-
gnome_lirc_properties/backend.py | 22 -
gnome_lirc_properties/config.py.in | 4 -
gnome_lirc_properties/lirc.py | 31 +--
gnome_lirc_properties/net/Makefile.am | 6 -
gnome_lirc_properties/net/MultipartPostHandler.py | 175 --------
gnome_lirc_properties/net/__init__.py | 23 -
gnome_lirc_properties/net/services.py | 339 ---------------
gnome_lirc_properties/ui/CustomConfiguration.py | 63 +---
gnome_lirc_properties/ui/Makefile.am | 1 -
gnome_lirc_properties/ui/ProgressWindow.py | 99 -----
.../ui/RemoteControlProperties.py | 75 +----
gnome_lirc_properties/ui/__init__.py | 1 -
web/README | 82 ----
web/service.wsgi | 458 --------------------
18 files changed, 5 insertions(+), 1416 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index b4b2a55..65eda34 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,9 +10,7 @@ EXTRA_DIST = \
gnome-doc-utils.make \
man/gnome-lirc-properties.1 \
patches/0001-Use-new-instead-of-conf-as-filename-suffix.patch \
- patches/0002-Add-resume-switch-to-irrecord.patch \
- web/README \
- web/service.wsgi
+ patches/0002-Add-resume-switch-to-irrecord.patch
DISTCLEANFILES = \
intltool-extract \
diff --git a/configure.ac b/configure.ac
index 977b6f7..30f85dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -169,20 +169,6 @@ fi
AC_MSG_CHECKING([configured LIRCD socket])
AC_MSG_RESULT([$with_lircd_socket])
-dnl support custom upload and download locations ===
-
-AC_ARG_WITH([download_uri],
- AS_HELP_STRING([--with-download-uri],
- [The URI for downloading user-submitted lircd.conf files.]),
- [], [with_download_uri="http://lirc.fluendo.com/lircdb/remotes.tar.gz"])
-AC_ARG_WITH([upload_uri],
- AS_HELP_STRING([--with-upload-uri],
- [The URI to use for user-submitted lircd.conf files.]),
- [], [with_upload_uri="http://lirc.fluendo.com/lircdb/upload/"])
-
-AC_SUBST([with_download_uri])
-AC_SUBST([with_upload_uri])
-
dnl find irrecord ===
AC_PATH_PROG([LIRC_IRRECORD], [irrecord])
@@ -212,7 +198,6 @@ AC_CONFIG_FILES([Makefile
data/icons/scalable/Makefile
gnome_lirc_properties/Makefile
gnome_lirc_properties/config.py
- gnome_lirc_properties/net/Makefile
gnome_lirc_properties/ui/Makefile
help/Makefile
po/Makefile.in])
@@ -231,7 +216,5 @@ AC_MSG_NOTICE([ LIRC configuration directory: $with_lirc_confdir])
AC_MSG_NOTICE([ LIRC configuration file: $with_lirc_hardware_conf])
AC_MSG_NOTICE([ LIRCd socket: $with_lircd_socket])
AC_MSG_NOTICE([ Startup style: $with_startup_style])
-AC_MSG_NOTICE([ Download URI: $with_download_uri])
-AC_MSG_NOTICE([ Upload URI: $with_upload_uri])
AC_MSG_NOTICE([=====================================================================])
diff --git a/data/gnome-lirc-properties-custom-config.ui b/data/gnome-lirc-properties-custom-config.ui
index eed6e7a..ee66b1b 100644
--- a/data/gnome-lirc-properties-custom-config.ui
+++ b/data/gnome-lirc-properties-custom-config.ui
@@ -479,24 +479,6 @@ Try to use key names from the default namespace only for best interoperability.<
</packing>
</child>
<child>
- <object class="GtkButton" id="button_upload">
- <property name="label" translatable="yes">_Upload</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="_on_button_upload_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
- <property name="secondary">True</property>
- </packing>
- </child>
- <child>
<object class="GtkButton" id="button_cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
@@ -523,7 +505,6 @@ Try to use key names from the default namespace only for best interoperability.<
</child>
<action-widgets>
<action-widget response="-5">button_ok</action-widget>
- <action-widget response="1">button_upload</action-widget>
<action-widget response="-6">button_cancel</action-widget>
</action-widgets>
</object>
diff --git a/gnome_lirc_properties/Makefile.am b/gnome_lirc_properties/Makefile.am
index b43940f..b95db15 100644
--- a/gnome_lirc_properties/Makefile.am
+++ b/gnome_lirc_properties/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = net ui
+SUBDIRS = ui
moduledir = $(pythondir)/gnome_lirc_properties
diff --git a/gnome_lirc_properties/backend.py b/gnome_lirc_properties/backend.py
index af186c5..b6d5ff3 100644
--- a/gnome_lirc_properties/backend.py
+++ b/gnome_lirc_properties/backend.py
@@ -844,28 +844,6 @@ class BackendService(PolicyKitService):
configuration,
keys)
- @dbus.service.method(dbus_interface=INTERFACE_NAME,
- in_signature='s', out_signature='',
- sender_keyword='sender')
- def InstallRemoteDatabase(self, filename, sender=None):
- '''Update the customized receiver database.'''
-
- # Copy the tarball with updates into our data folder
- # to allow atomic replacement of the old tarball:
- tarball = os.path.join(config.PACKAGE_DIR, 'remotes-update.tar.gz')
-
- if not os.path.isdir(config.PACKAGE_DIR):
- os.makedirs(config.PACKAGE_DIR)
-
- shutil.copyfile(filename, tarball)
-
- # Now practice the atomic replacement:
- os.rename(tarball, config.LIRC_REMOTES_TARBALL)
-
- # Finally adjust timestamps of the archive:
- timestamps = os.path.getatime(filename), os.path.getmtime(filename)
- os.utime(config.LIRC_REMOTES_TARBALL, timestamps)
-
def get_service_bus():
'''Retrieves a reference to the D-BUS system bus.'''
diff --git a/gnome_lirc_properties/config.py.in b/gnome_lirc_properties/config.py.in
index f5e2445..785374f 100644
--- a/gnome_lirc_properties/config.py.in
+++ b/gnome_lirc_properties/config.py.in
@@ -18,14 +18,10 @@ LIRC_REMOTE_CONF = path.join(LIRC_CONFDIR, 'lircd.conf.gnome')
LIRC_DAEMON_CONF = path.join(LIRC_CONFDIR, 'lircd.conf')
LIRC_REMOTES_DATABASE = '@with_remotes_database@'
-LIRC_REMOTES_TARBALL = path.join(PACKAGE_DIR, 'remotes.tar.gz')
LIRC_IRRECORD = '@LIRC_IRRECORD@'
LIRC_INPUT_DRIVER = '@devinput_driver@'
-URI_UPLOADS = '@with_upload_uri@'
-URI_UPDATES = '@with_download_uri@'
-
STARTUP_STYLE = '@with_startup_style@'
# remove temporary objects from namespace
diff --git a/gnome_lirc_properties/lirc.py b/gnome_lirc_properties/lirc.py
index 1631da7..f4225a1 100644
--- a/gnome_lirc_properties/lirc.py
+++ b/gnome_lirc_properties/lirc.py
@@ -19,7 +19,7 @@
LIRC specific classes.
'''
-import errno, gobject, logging, os, re, tarfile
+import errno, gobject, logging, os, re
from datetime import datetime
from gettext import gettext as _
@@ -292,35 +292,6 @@ class RemotesDatabase(object):
return True
- def load_tarball(self, path=config.LIRC_REMOTES_TARBALL):
- '''
- Reads remote configurations from tarball.
- '''
-
- return False
-
- if not os.path.isfile(path):
- return False
-
- if not tarfile.is_tarfile(path):
- logging.warning('Bad remote control archive: %s', path)
- return False
-
- logging.info('Reading remote database from %s...', path)
- tarball = tarfile.open(path)
-
- for entry in tarball:
- if not entry.isfile():
- continue
- if os.path.basename(entry.name) == 'README':
- continue
-
- self.read(reader=tarball.extractfile(entry.name),
- filename=entry.name, database=path,
- replace=True)
-
- return True
-
def load(self, filename):
'''
Reads remote configuration from filename.
diff --git a/gnome_lirc_properties/ui/CustomConfiguration.py b/gnome_lirc_properties/ui/CustomConfiguration.py
index 203c3fb..17f0744 100644
--- a/gnome_lirc_properties/ui/CustomConfiguration.py
+++ b/gnome_lirc_properties/ui/CustomConfiguration.py
@@ -22,7 +22,7 @@ The dialog for customizing remote control settings.
import dbus, logging, gobject, gtk
from gettext import gettext as _
-from gnome_lirc_properties import backend, config, lirc, model, net
+from gnome_lirc_properties import backend, config, lirc, model
from gnome_lirc_properties.ui.common import show_message, thread_callback
from StringIO import StringIO
from time import time
@@ -62,7 +62,6 @@ class CustomConfiguration(object):
# lookup buttons:
self.__button_ok = self.__ui.get_object('button_ok')
- self.__button_upload = self.__ui.get_object('button_upload')
self.__button_detect_basics = self.__ui.get_object('button_detect_basics')
self.__button_keys_learn = self.__ui.get_object('button_keys_learn')
self.__button_keys_remove = self.__ui.get_object('button_keys_remove')
@@ -83,9 +82,6 @@ class CustomConfiguration(object):
self.__setup_basics()
self.__setup_keys()
- # apply "secondary" child property: for some reason libglade ignores it
- self.__dialog.action_area.set_child_secondary(self.__button_upload, True)
-
# apply stock icon to learn button
image = gtk.image_new_from_stock(gtk.STOCK_MEDIA_RECORD,
gtk.ICON_SIZE_BUTTON)
@@ -363,62 +359,6 @@ class CustomConfiguration(object):
'''Handle activation of row in the "keys" tree view.'''
self.__start_learning(path)
- def _on_button_upload_clicked(self, button):
- '''Handle the "Upload" button's "clicked" signal.'''
-
- def configuration_problem(message):
- '''
- Informs the user about configuration file problems,
- and ask the user for acceptance or rejection.
- '''
-
- response_buttons = (
- (gtk.RESPONSE_ACCEPT, _('_Upload Configuration')),
- (gtk.RESPONSE_REJECT, gtk.STOCK_CANCEL),
- )
-
- message = '%s %s' % (message, _('Do you really want to upload this configuration?'))
-
- return (gtk.RESPONSE_ACCEPT != show_message(
- self.__dialog, _('Configuration Problems'),
- message, buttons=response_buttons))
-
- def on_upload_finished(message):
- '''Informs the user about successful uploads.'''
-
- # The message is usually some "thanks" text from the server side:
- # TODO: Is this wise? It will not be translated?
- show_message(self.__dialog, _('Upload Succeeded'),
- message, message_type=gtk.MESSAGE_INFO)
- self.__dialog.set_sensitive(True)
-
- def on_upload_failure(message):
- '''Informs the user about upload failures.'''
-
- show_message(self.__dialog, _('Upload Failed'), message)
- self.__dialog.set_sensitive(True)
-
- keys_model = self.__treeview_keys.get_model()
-
- if 0 == keys_model.count_keys(lirc.KeyCodeCategory.DEFAULT):
- if configuration_problem(
- _('This configuration has no keys for the default namespace. Most applications won\'t be able to use this configuration.')):
- return
-
- elif 0 != keys_model.count_keys(lirc.KeyCodeCategory.CUSTOM):
- if configuration_problem(
- _('Some keys in this configuration have names which do not belong to any standardized namespace. Most applications won\'t be able to use those keys.')):
- return
-
- self.__dialog.set_sensitive(False)
-
- net.post_file(target_uri=config.URI_UPLOADS,
- filename=lirc.find_remote_config(),
- content=self.__remote.configuration,
- context=_('customized configuration file'),
- finished_callback=on_upload_finished,
- failure_callback=on_upload_failure)
-
def __retreive_remote_name(self):
'''Build the symbolic name of the currently edited remote.'''
@@ -550,7 +490,6 @@ class CustomConfiguration(object):
# Update state of model-page widgets:
self.__usage_hint.set_property('visible', not model_complete)
- self.__button_upload.set_sensitive(keys_complete)
# Update state of basics-page widgets:
self.__treeview_basics.set_sensitive(have_receiver)
diff --git a/gnome_lirc_properties/ui/Makefile.am b/gnome_lirc_properties/ui/Makefile.am
index ca27d19..c61cc2b 100644
--- a/gnome_lirc_properties/ui/Makefile.am
+++ b/gnome_lirc_properties/ui/Makefile.am
@@ -4,7 +4,6 @@ module_PYTHON = \
__init__.py \
common.py \
CustomConfiguration.py \
- ProgressWindow.py \
ReceiverChooserDialog.py \
RemoteControlProperties.py
diff --git a/gnome_lirc_properties/ui/RemoteControlProperties.py b/gnome_lirc_properties/ui/RemoteControlProperties.py
index 1ba0e42..9faac42 100644
--- a/gnome_lirc_properties/ui/RemoteControlProperties.py
+++ b/gnome_lirc_properties/ui/RemoteControlProperties.py
@@ -23,11 +23,10 @@ import dbus, errno, gobject, gtk, gtk.gdk, pango
import httplib, locale, logging, os, subprocess
from gettext import gettext as _
-from gnome_lirc_properties import backend, config, lirc, model, hardware, policykit, net
+from gnome_lirc_properties import backend, config, lirc, model, hardware, policykit
from gnome_lirc_properties.ui.common import show_message, thread_callback
from gnome_lirc_properties.ui.CustomConfiguration import CustomConfiguration
-from gnome_lirc_properties.ui.ProgressWindow import ProgressWindow
from gnome_lirc_properties.ui.ReceiverChooserDialog import ReceiverChooserDialog
class RemoteControlProperties(object):
@@ -100,7 +99,6 @@ class RemoteControlProperties(object):
self.__remotes_db.clear()
self.__remotes_db.load(os.path.join(self.__datadir, 'linux-input-layer-lircd.conf'))
self.__remotes_db.load_folder()
- self.__remotes_db.load_tarball()
self.__remote_vendors.clear()
self.__remote_vendors.load(self.__remotes_db)
@@ -377,77 +375,6 @@ class RemoteControlProperties(object):
if use_supplied and self.supplied_remote:
self.selected_remote = self.supplied_remote
- def _on_button_download_clicked(self, button=None):
- '''Handle clicks on the auto-detection button.'''
-
- @thread_callback
- def on_download_progress(progress, total, action):
- '''Handle progress reports from download service.'''
-
- args = (
- locale.format(percent='%.1f', grouping=True, value=progress/1024.0),
- locale.format(percent='%.1f', grouping=True, value=total/1024.0))
- message = (
- total > 0 and _('%s of %s KiB retrieved...') % args
- or _('%s KiB retrieved...') % args[0])
-
- progress_window.detail = action
- progress_window.update(progress, total, message)
-
- @thread_callback
- def on_download_success(content, headers):
- '''Handle finished downloads.'''
-
- self.__dialog.set_sensitive(True)
- progress_window.hide()
-
- if 'application/x-gzip' == headers.get('content-type'):
- try:
- backend.get_service().InstallRemoteDatabase(content.name)
- self.__update_remotes_db()
-
- except dbus.DBusException, ex:
- show_message(self.__dialog, progress_window.title, ex.message)
-
- elif httplib.NOT_MODIFIED == getattr(content, 'code', None):
- show_message(self.__dialog, progress_window.title,
- details=_('No updates available. Your remote control configuration files are already up-to-date.'),
- message_type=gtk.MESSAGE_INFO)
-
- else:
- show_message(self.__dialog, progress_window.title,
- _('Download of updated remote control configurations failed.'))
-
- @thread_callback
- def on_download_failure(message):
- '''Handle failure reports from download service.'''
-
- self.__dialog.set_sensitive(True)
- progress_window.hide()
-
- show_message(self.__dialog, progress_window.title, message)
-
- self.__dialog.set_sensitive(False)
- progress_window = ProgressWindow(self.__ui)
- progress_window.show(self.__dialog, _('Updating Remote Configuration Files'))
-
- gtk.gdk.threads_leave()
-
- try:
- timestamp = (
- os.path.isfile(config.LIRC_REMOTES_TARBALL) and
- os.path.getmtime(config.LIRC_REMOTES_TARBALL) or
- None)
-
- net.retrieve_tarball(tarball_uri=config.URI_UPDATES,
- progress_callback=on_download_progress,
- success_callback=on_download_success,
- failure_callback=on_download_failure,
- reference_time=timestamp)
-
- finally:
- gtk.gdk.threads_enter()
-
# pylint: disable-msg=C0103
def _on_radiobutton_other_remote_size_allocate(self, widget, alloc):
'''
diff --git a/gnome_lirc_properties/ui/__init__.py b/gnome_lirc_properties/ui/__init__.py
index 8d10306..40fb2c8 100644
--- a/gnome_lirc_properties/ui/__init__.py
+++ b/gnome_lirc_properties/ui/__init__.py
@@ -25,6 +25,5 @@ from gnome_lirc_properties.ui.common import *
# publish dialog classes
from gnome_lirc_properties.ui.CustomConfiguration import CustomConfiguration
-from gnome_lirc_properties.ui.ProgressWindow import ProgressWindow
from gnome_lirc_properties.ui.ReceiverChooserDialog import ReceiverChooserDialog
from gnome_lirc_properties.ui.RemoteControlProperties import RemoteControlProperties
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]