diff --git a/extensions/cpsection/aboutcomputer/model.py b/extensions/cpsection/aboutcomputer/model.py index b560117c64..c4b368ef3e 100644 --- a/extensions/cpsection/aboutcomputer/model.py +++ b/extensions/cpsection/aboutcomputer/model.py @@ -144,8 +144,8 @@ def get_secondary_licenses(): licenses_path = config.licenses_path if os.path.isdir(licenses_path): for file_name in os.listdir(licenses_path): + file_path = os.path.join(licenses_path, file_name) try: - file_path = os.path.join(licenses_path, file_name) with open(file_path) as f: licenses.append(f.read()) except IOError: diff --git a/extensions/cpsection/webaccount/web_service.py b/extensions/cpsection/webaccount/web_service.py index 998acb120d..bbb88c80a1 100644 --- a/extensions/cpsection/webaccount/web_service.py +++ b/extensions/cpsection/webaccount/web_service.py @@ -16,7 +16,7 @@ class WebService(): def get_icon_name(self): - raise "Not implemented" + raise NotImplementedError def config_service_cb(self, widget, event, container): - raise "Not implemented" + raise NotImplementedError diff --git a/extensions/deviceicon/frame.py b/extensions/deviceicon/frame.py index ac9da2bda1..79e72e6103 100644 --- a/extensions/deviceicon/frame.py +++ b/extensions/deviceicon/frame.py @@ -66,5 +66,5 @@ def setup(tray): # of the OSK has many unresolved corner cases, see # http://dev.laptop.org/ticket/12281 - if _HAS_MALIIT: - tray.add_device(DeviceView()) + # if _HAS_MALIIT: + # tray.add_device(DeviceView()) diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py index 99d8f58a49..21bf69354b 100644 --- a/src/jarabe/desktop/favoritesview.py +++ b/src/jarabe/desktop/favoritesview.py @@ -172,7 +172,7 @@ def __settings_changed_cb(self, **kwargs): def _set_layout(self, layout): if layout not in LAYOUT_MAP: - logging.warn('Unknown favorites layout: %r', layout) + logging.warning('Unknown favorites layout: %r', layout) layout = favoriteslayout.RingLayout.key assert layout in LAYOUT_MAP diff --git a/src/jarabe/frame/clipboardtray.py b/src/jarabe/frame/clipboardtray.py index 247dead3ba..74088740d6 100644 --- a/src/jarabe/frame/clipboardtray.py +++ b/src/jarabe/frame/clipboardtray.py @@ -178,7 +178,7 @@ def drag_data_received_cb(self, widget, context, x, y, selection, object_id = self._context_map.get_object_id(context) try: if selection is None: - logging.warn('ClipboardTray: empty selection for target %s', + logging.warning('ClipboardTray: empty selection for target %s', selection.get_target()) else: self._add_selection(object_id, selection) diff --git a/src/jarabe/journal/bundlelauncher.py b/src/jarabe/journal/bundlelauncher.py index 2d523cd4b4..eb6b5cfeb5 100644 --- a/src/jarabe/journal/bundlelauncher.py +++ b/src/jarabe/journal/bundlelauncher.py @@ -43,6 +43,10 @@ def get_bundle(bundle_id=None, object_id=None): return activities[0] else: + obj = datastore.get(object_id) + if obj.metadata['mime_type'] is None: + return None + mime_type = str(obj.metadata['mime_type']) bundle = bundleregistry.get_registry().get_bundle(bundle_id) if bundle is None: logging.warning('Activity with the bundle_id %s was not found', diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py index 8c163f02fb..33c17393fd 100644 --- a/src/jarabe/journal/listview.py +++ b/src/jarabe/journal/listview.py @@ -352,7 +352,7 @@ def _get_width_for_string(self, text): widget = Gtk.Label(label='') context = widget.get_pango_context() - layout = Pango.Layout(context) + layout = Pango.Layout.new(context) layout.set_text(text, len(text)) width, height_ = layout.get_pixel_size() return width diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py index 9c7d73f44a..a8502b3f36 100644 --- a/src/jarabe/journal/palettes.py +++ b/src/jarabe/journal/palettes.py @@ -218,7 +218,7 @@ def __friend_selected_cb(self, menu_item, buddy): file_name = model.get_file(self._metadata['uid']) if not file_name or not os.path.exists(file_name): - logging.warn('Entries without a file cannot be sent.') + logging.warning('Entries without a file cannot be sent.') self.emit('volume-error', _('Entries without a file cannot be sent.'), _('Warning')) @@ -387,7 +387,7 @@ def __copy_to_volume_cb(self, menu_item): file_path = model.get_file(uid) if not file_path or not os.path.exists(file_path): - logging.warn('Entries without a file cannot be copied.') + logging.warning('Entries without a file cannot be copied.') self.emit('volume-error', _('Entries without a file cannot be copied.'), _('Warning')) @@ -416,7 +416,7 @@ def _get_confirmation_alert_message(self, entries_len): def _perform_copy(self, metadata): file_path = model.get_file(metadata['uid']) if not file_path or not os.path.exists(file_path): - logging.warn('Entries without a file cannot be copied.') + logging.warning('Entries without a file cannot be copied.') return try: model.copy(metadata, self._mount_point) @@ -447,7 +447,7 @@ def __copy_to_clipboard_cb(self, menu_item): uid = uid_list[0] file_path = model.get_file(uid) if not file_path or not os.path.exists(file_path): - logging.warn('Entries without a file cannot be copied.') + logging.warning('Entries without a file cannot be copied.') self.emit('volume-error', _('Entries without a file cannot be copied.'), _('Warning')) diff --git a/src/jarabe/journal/volumestoolbar.py b/src/jarabe/journal/volumestoolbar.py index db4b057199..96e5ee9986 100644 --- a/src/jarabe/journal/volumestoolbar.py +++ b/src/jarabe/journal/volumestoolbar.py @@ -296,7 +296,7 @@ def _drag_data_received_cb(self, widget, drag_context, x, y, metadata = model.get(object_id) file_path = model.get_file(metadata['uid']) if not file_path or not os.path.exists(file_path): - logging.warn('Entries without a file cannot be copied.') + logging.warning('Entries without a file cannot be copied.') self.emit('volume-error', _('Entries without a file cannot be copied.'), _('Warning')) diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py index f76df27289..6c4dbb8526 100644 --- a/src/jarabe/model/bundleregistry.py +++ b/src/jarabe/model/bundleregistry.py @@ -265,8 +265,8 @@ def _scan_directory(self, path): # Sort by mtime to ensure a stable activity order bundles = {} for f in os.listdir(path): + bundle_dir = os.path.join(path, f) try: - bundle_dir = os.path.join(path, f) if os.path.isdir(bundle_dir): bundles[bundle_dir] = os.stat(bundle_dir).st_mtime except Exception: diff --git a/src/jarabe/model/filetransfer.py b/src/jarabe/model/filetransfer.py index 6564e5e12f..f915148f48 100644 --- a/src/jarabe/model/filetransfer.py +++ b/src/jarabe/model/filetransfer.py @@ -42,20 +42,25 @@ from jarabe.model import neighborhood -FT_STATE_NONE = 0 -FT_STATE_PENDING = 1 -FT_STATE_ACCEPTED = 2 -FT_STATE_OPEN = 3 -FT_STATE_COMPLETED = 4 -FT_STATE_CANCELLED = 5 - -FT_REASON_NONE = 0 -FT_REASON_REQUESTED = 1 -FT_REASON_LOCAL_STOPPED = 2 -FT_REASON_REMOTE_STOPPED = 3 -FT_REASON_LOCAL_ERROR = 4 -FT_REASON_LOCAL_ERROR = 5 -FT_REASON_REMOTE_ERROR = 6 +FT_STATE_NONE = TelepathyGLib.FileTransferState.NONE +FT_STATE_PENDING = TelepathyGLib.FileTransferState.PENDING +FT_STATE_ACCEPTED = TelepathyGLib.FileTransferState.ACCEPTED +FT_STATE_OPEN = TelepathyGLib.FileTransferState.OPEN +FT_STATE_COMPLETED = TelepathyGLib.FileTransferState.COMPLETED +FT_STATE_CANCELLED = TelepathyGLib.FileTransferState.CANCELLED + +FT_REASON_NONE = \ + TelepathyGLib.FileTransferStateChangeReason.NONE +FT_REASON_REQUESTED = \ + TelepathyGLib.FileTransferStateChangeReason.REQUESTED +FT_REASON_LOCAL_STOPPED = \ + TelepathyGLib.FileTransferStateChangeReason.LOCAL_STOPPED +FT_REASON_REMOTE_STOPPED = \ + TelepathyGLib.FileTransferStateChangeReason.REMOTE_STOPPED +FT_REASON_LOCAL_ERROR = \ + TelepathyGLib.FileTransferStateChangeReason.LOCAL_ERROR +FT_REASON_REMOTE_ERROR = \ + TelepathyGLib.FileTransferStateChangeReason.REMOTE_ERROR new_file_transfer = dispatch.Signal() diff --git a/src/jarabe/view/viewsource.py b/src/jarabe/view/viewsource.py index 2967e82a78..e5a11c8a0a 100644 --- a/src/jarabe/view/viewsource.py +++ b/src/jarabe/view/viewsource.py @@ -334,7 +334,7 @@ def __destroy_cb(self, window, document_path): if document_path is not None and os.path.exists(document_path): os.unlink(document_path) - self._gdk_window.set_cursor(Gdk.Cursor(Gdk.CursorType.LEFT_PTR)) + self._gdk_window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)) Gdk.flush() def __key_press_event_cb(self, window, event): @@ -418,9 +418,9 @@ def __set_busy_cursor(self, busy): cursor = None if busy: - cursor = Gdk.Cursor(Gdk.CursorType.WATCH) + cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) else: - cursor = Gdk.Cursor(Gdk.CursorType.LEFT_PTR) + cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR) gdk_window = self.get_root_window() gdk_window.set_cursor(cursor) diff --git a/tests/extensions/cpsection/webaccount/services/mock/service.py b/tests/extensions/cpsection/webaccount/services/mock/service.py index bd29dab8e7..2e83075602 100644 --- a/tests/extensions/cpsection/webaccount/services/mock/service.py +++ b/tests/extensions/cpsection/webaccount/services/mock/service.py @@ -18,7 +18,7 @@ from jarabe.webservice import accountsmanager -from cpsection.webaccount.web_service import WebService +from extensions.cpsection.webaccount.web_service import WebService _SERVICE_NAME = 'mock' diff --git a/tests/extensions/cpsection/webaccount/web_service.py b/tests/extensions/cpsection/webaccount/web_service.py index 998acb120d..bbb88c80a1 100644 --- a/tests/extensions/cpsection/webaccount/web_service.py +++ b/tests/extensions/cpsection/webaccount/web_service.py @@ -16,7 +16,7 @@ class WebService(): def get_icon_name(self): - raise "Not implemented" + raise NotImplementedError def config_service_cb(self, widget, event, container): - raise "Not implemented" + raise NotImplementedError diff --git a/tests/test_backup.py b/tests/test_backup.py index 0fe832c146..48a2a2b020 100644 --- a/tests/test_backup.py +++ b/tests/test_backup.py @@ -21,8 +21,8 @@ # we need import from the extensions path sys.path.append(config.ext_path) -from cpsection.backup.backupmanager import BackupManager -from cpsection.backup.backends.backend_tools import Backend +from extensions.cpsection.backup.backupmanager import BackupManager +from extensions.cpsection.backup.backends.backend_tools import Backend class TestBackup(unittest.TestCase): diff --git a/tests/test_modemconfiguration.py b/tests/test_modemconfiguration.py index b8b61e5454..9515088957 100644 --- a/tests/test_modemconfiguration.py +++ b/tests/test_modemconfiguration.py @@ -19,9 +19,9 @@ from mock import patch -from cpsection.modemconfiguration.model import CountryCodeParser, \ +from extensions.cpsection.modemconfiguration.model import CountryCodeParser, \ ServiceProvidersParser, ServiceProviders, PROVIDERS_PATH -from cpsection.modemconfiguration.model import CONF_SP_COUNTRY, \ +from extensions.cpsection.modemconfiguration.model import CONF_SP_COUNTRY, \ CONF_SP_PROVIDER, CONF_SP_PLAN diff --git a/tests/test_user_profile.py b/tests/test_user_profile.py index f9950de583..f20f8e3999 100644 --- a/tests/test_user_profile.py +++ b/tests/test_user_profile.py @@ -16,7 +16,7 @@ import unittest -from cpsection.aboutme import model +from extensions.cpsection.aboutme import model from jarabe.intro.agepicker import AGES from jarabe.intro.genderpicker import GENDERS