Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2014-01-12 17:55:34 (GMT)
committer Walter Bender <walter@sugarlabs.org>2014-01-12 17:55:34 (GMT)
commit8944bad3d4de6cdee622c93725ef4941a9f45ab9 (patch)
tree49901476558557b5d6d14654c2434f2a8fbc09da
parent9ae7eac046cadf80c6ec0f124c69e098ee4d0268 (diff)
parent3ee39682ad9bc3daf6c67b95b9c8acb42b995d4d (diff)
Merge commit 'refs/merge-requests/9' of git://git.sugarlabs.org/pippy/mainline into merge-requests/9
Conflicts: pippy_app.py
-rw-r--r--pippy_app.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/pippy_app.py b/pippy_app.py
index 2c8d98e..bfa32ca 100644
--- a/pippy_app.py
+++ b/pippy_app.py
@@ -49,9 +49,12 @@ from sugar3.datastore import datastore
from sugar3.activity.widgets import EditToolbar
from sugar3.activity.widgets import StopButton
from sugar3.activity.activity import get_bundle_name
+<<<<<<< HEAD
from sugar3.activity.activity import get_bundle_path
from sugar3.graphics.alert import Alert
from sugar3.graphics.alert import ConfirmationAlert
+=======
+>>>>>>> 3ee39682ad9bc3daf6c67b95b9c8acb42b995d4d
from sugar3.graphics.alert import NotifyAlert
from sugar3.graphics import style
from sugar3.graphics.icon import Icon
@@ -463,12 +466,23 @@ class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity):
text_buffer.redo()
def __copybutton_cb(self, button):
+<<<<<<< HEAD
text_buffer = self.source_tabs.get_text_buffer()
text_buffer.copy_clipboard(Gtk.Clipboard())
def __pastebutton_cb(self, button):
text_buffer = self.source_tabs.get_text_buffer()
text_buffer.paste_clipboard(Gtk.Clipboard(), None, True)
+=======
+ global text_buffer
+ clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
+ text_buffer.copy_clipboard(clipboard)
+
+ def __pastebutton_cb(self, button):
+ global text_buffer
+ clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
+ text_buffer.paste_clipboard(clipboard, None, True)
+>>>>>>> 3ee39682ad9bc3daf6c67b95b9c8acb42b995d4d
def gobutton_cb(self, button):
from shutil import copy2
@@ -539,6 +553,11 @@ class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity):
def _export_document_cb(self, __):
self.copy()
+ alert = NotifyAlert()
+ alert.props.title = _('Saved')
+ alert.props.msg = _('The document has been saved to journal.')
+ alert.connect('response', lambda x, i: self.remove_alert(x))
+ self.add_alert(alert)
def remove_alert_cb(self, alert, response_id):
self.remove_alert(alert)
@@ -858,9 +877,28 @@ class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity):
def load_from_journal(self, file_path):
if self.metadata['mime_type'] == 'text/x-python':
+<<<<<<< HEAD
text = open(file_path).read()
# Discard the '#!/usr/bin/python' and 'coding: utf-8' lines,
# if present.
+=======
+ try:
+ text = open(file_path).read()
+ except:
+ alert = NotifyAlert(10)
+ alert.props.title = _('Error')
+ alert.props.msg = _('Error reading data.')
+
+ def remove_alert(alert, response_id):
+ self.remove_alert(alert)
+
+ alert.connect("response", remove_alert)
+ self.add_alert(alert)
+ return
+
+ # discard the '#!/usr/bin/python' and 'coding: utf-8' lines,
+ # if present
+>>>>>>> 3ee39682ad9bc3daf6c67b95b9c8acb42b995d4d
text = re.sub(r'^' + re.escape(PYTHON_PREFIX), '', text)
self.initial_text_buffer = text