diff options
author | Sascha Silbe <silbe@activitycentral.com> | 2011-03-12 17:44:09 (GMT) |
---|---|---|
committer | Sascha Silbe <silbe@activitycentral.com> | 2011-03-12 17:44:09 (GMT) |
commit | db56ac4562a9ab10308de0998b56262956f51b64 (patch) | |
tree | e9ea3923a6203538480822593354146c01d1341b /src/jarabe/view/viewsource.py | |
parent | 8cd75e783fec952497eda68ae06e00323a4c179b (diff) | |
parent | ff47b24c5aa032f830c6f3dc3ae32dfed3c72229 (diff) |
Merge commit 'refs/top-bases/t/bug-1755' into t/bug-1755t/bug-1755
* commit 'refs/top-bases/t/bug-1755': (261 commits)
Fix up style issues introduced by commit 3f8a1e1
Don't set default timezone
Restore setting a language with the command line OLPC #10681
battery frame device: replace HAL with UPower
use ConsoleKit instead of HAL for shutdown/reboot
fix recognition of JEBs outside of data store
Adjust the year in the licence visible in the control panel
Handle activities that cycle through windows dlo#10695
Speaker frame device: pop up palette on left-click instead of toggling mute
recognise translations using pgettext
Remove last few pieces of buddy-icon.jpg handling
fix whitespace error introduced by 4b6a534 (revert of 4a3416b)
Commit from Sugar Labs: Translation System by user RafaelOrtiz.: 374 of 374 messages translated (0 fuzzy).
Intro: Fall back to user name if GECOS real name field is empty
Sugar Ad-hoc icons show in search results when connect/disconnect to AP OLPC #10412
Show busy cursor during session shutdown
Show free space for the Journal in the Journal volumes toolbar (SL#2318)
Fix incorrect logging level for warning about missing GSM configuration
simplify extension loading exception error
Revert "Add cpu and memory resource indicator to frame" as agreed on with erikos. Scheduling for inclusion in 0.94 after potential artwork changes based on feedback from the Design Team.
...
Conflicts:
src/jarabe/util/emulator.py
Diffstat (limited to 'src/jarabe/view/viewsource.py')
-rw-r--r-- | src/jarabe/view/viewsource.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/jarabe/view/viewsource.py b/src/jarabe/view/viewsource.py index 9905713..a1c0be3 100644 --- a/src/jarabe/view/viewsource.py +++ b/src/jarabe/view/viewsource.py @@ -17,7 +17,6 @@ import os import logging -import traceback from gettext import gettext as _ import gobject @@ -37,11 +36,13 @@ from sugar.bundle.activitybundle import ActivityBundle from sugar.datastore import datastore from sugar import mime + _SOURCE_FONT = pango.FontDescription('Monospace %d' % style.FONT_SIZE) _logger = logging.getLogger('ViewSource') map_activity_to_window = {} + def setup_view_source(activity): service = activity.get_service() if service is not None: @@ -52,9 +53,9 @@ def setup_view_source(activity): expected_exceptions = ['org.freedesktop.DBus.Error.UnknownMethod', 'org.freedesktop.DBus.Python.NotImplementedError'] if e.get_dbus_name() not in expected_exceptions: - logging.error(traceback.format_exc()) + logging.exception('Exception occured in HandleViewSource():') except Exception: - logging.error(traceback.format_exc()) + logging.exception('Exception occured in HandleViewSource():') window_xid = activity.get_xid() if window_xid is None: @@ -76,9 +77,9 @@ def setup_view_source(activity): expected_exceptions = ['org.freedesktop.DBus.Error.UnknownMethod', 'org.freedesktop.DBus.Python.NotImplementedError'] if e.get_dbus_name() not in expected_exceptions: - logging.error(traceback.format_exc()) + logging.exception('Exception occured in GetDocumentPath():') except Exception: - logging.error(traceback.format_exc()) + logging.exception('Exception occured in GetDocumentPath():') if bundle_path is None and document_path is None: _logger.debug('Activity without bundle_path nor document_path') @@ -89,6 +90,7 @@ def setup_view_source(activity): map_activity_to_window[window_xid] = view_source view_source.show() + class ViewSource(gtk.Window): __gtype_name__ = 'SugarViewSource' @@ -129,10 +131,10 @@ class ViewSource(gtk.Window): file_name = '' activity_bundle = ActivityBundle(bundle_path) - command = activity_bundle.get_command() + command = activity_bundle.get_command() if len(command.split(' ')) > 1: name = command.split(' ')[1].split('.')[0] - file_name = name + '.py' + file_name = name + '.py' path = os.path.join(activity_bundle.get_path(), file_name) self._selected_file = path @@ -195,6 +197,7 @@ class ViewSource(gtk.Window): else: self._source_display.file_path = None + class DocumentButton(RadioToolButton): __gtype_name__ = 'SugarDocumentButton' @@ -244,22 +247,20 @@ class DocumentButton(RadioToolButton): error_handler=self.__internal_save_error_cb) def __internal_save_cb(self): - logging.debug("Saved Source object to datastore.") + logging.debug('Saved Source object to datastore.') self._jobject.destroy() def __internal_save_error_cb(self, err): logging.debug('Error saving Source object to datastore: %s', err) self._jobject.destroy() + class Toolbar(gtk.Toolbar): __gtype_name__ = 'SugarViewSourceToolbar' __gsignals__ = { - 'stop-clicked': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ([])), - 'source-selected': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, + 'stop-clicked': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), + 'source-selected': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([str])), } @@ -309,7 +310,6 @@ class Toolbar(gtk.Toolbar): stop = ToolButton(icon_name='dialog-cancel') stop.set_tooltip(_('Close')) stop.connect('clicked', self.__stop_clicked_cb) - stop.show() self.insert(stop, -1) stop.show() @@ -340,6 +340,7 @@ class Toolbar(gtk.Toolbar): if button.props.active: self.emit('source-selected', path) + class FileViewer(gtk.ScrolledWindow): __gtype_name__ = 'SugarFileViewer' @@ -406,6 +407,7 @@ class FileViewer(gtk.ScrolledWindow): file_path = model.get_value(tree_iter, 1) self.emit('file-selected', file_path) + class SourceDisplay(gtk.ScrolledWindow): __gtype_name__ = 'SugarSourceDisplay' @@ -462,4 +464,3 @@ class SourceDisplay(gtk.ScrolledWindow): return self._file_path file_path = property(_get_file_path, _set_file_path) - |