diff options
-rw-r--r-- | NEWS | 8 | ||||
-rw-r--r-- | activity.py | 6 | ||||
-rw-r--r-- | activity/activity.info | 2 | ||||
-rw-r--r-- | edit.py | 86 | ||||
-rw-r--r-- | icons/journal-image.svg | 76 | ||||
-rw-r--r-- | icons/load-image-from-journal.svg | 83 | ||||
-rw-r--r-- | icons/load-text-from-journal.svg | 97 | ||||
-rw-r--r-- | infoslicer/processing/Article_Builder.py | 8 | ||||
-rw-r--r-- | infoslicer/processing/HTML_strip.py | 89 | ||||
-rw-r--r-- | infoslicer/widgets/Journal_Gallery_View.py | 168 | ||||
-rw-r--r-- | infoslicer/widgets/Journal_Image_Pane.py | 62 | ||||
-rw-r--r-- | library.py | 11 | ||||
-rw-r--r-- | po/InfoSlicer.pot | 189 | ||||
-rw-r--r-- | po/es.po | 32 | ||||
-rw-r--r-- | po/hus.po | 3 |
15 files changed, 114 insertions, 806 deletions
@@ -1,11 +1,3 @@ -17 - -ENHANCEMENTS: -* Load text from Sugar Journal (w/ Aneesh Dogra) -* Load images from Sugar Journal (w/ Aneesh Dogra) -* Add Polish wikipedia to library (w/ ) -* New translations - 15 ENHANCEMENT: diff --git a/activity.py b/activity.py index 278729b..fa94eab 100644 --- a/activity.py +++ b/activity.py @@ -30,9 +30,6 @@ import library import edit import book -import logging - - class InfoslicerActivity(activity.Activity): def __init__(self, handle): self.notebook = Gtk.Notebook() @@ -54,9 +51,6 @@ class InfoslicerActivity(activity.Activity): self.edit_page = 1 self.edit = edit.View() - - logging.debug(self.edit) - self.library = library.View(self) toolbar_box = ToolbarBox() diff --git a/activity/activity.info b/activity/activity.info index fbd30c2..5ba8956 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,6 +1,6 @@ [Activity] name = InfoSlicer -activity_version = 17 +activity_version = 15 host_version = 1 icon = slicelogo bundle_id = org.sugarlabs.InfoSlicer @@ -13,34 +13,21 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA from gi.repository import Gtk -from gi.repository import Gdk from gi.repository import GObject from gettext import gettext as _ from sugar3.graphics.toolbutton import ToolButton from sugar3.graphics.toggletoolbutton import ToggleToolButton -from sugar3 import mime -from sugar3.graphics.objectchooser import ObjectChooser - from infoslicer.widgets.Edit_Pane import Edit_Pane from infoslicer.widgets.Format_Pane import Format_Pane from infoslicer.widgets.Image_Pane import Image_Pane -from infoslicer.widgets.Journal_Image_Pane import Journal_Image_Pane -from infoslicer.processing.HTML_strip import dehtml -from infoslicer.processing.Article import Article - import book -import logging - - TABS = (Edit_Pane(), Image_Pane(), - Journal_Image_Pane(), Format_Pane()) - class View(Gtk.Notebook): def __init__(self): GObject.GObject.__init__(self) @@ -64,38 +51,20 @@ class View(Gtk.Notebook): class ToolbarBuilder(): def __init__(self, edit, toolbar): self.edit = edit - logging.debug('init edit toolbar') - logging.debug(self.edit) self.txt_toggle = ToggleToolButton('ascii') self.img_toggle = ToggleToolButton('image') - self.jimg_toggle = ToggleToolButton('journal-image') - self.jimg_chooser_toggle = ToolButton('load-image-from-journal') - self.jtext_chooser_toggle = ToolButton('load-text-from-journal') self.txt_toggle.set_tooltip(_('Text')) self.txt_toggle.connect('toggled', self._toggle_cb, - [self.txt_toggle, self.img_toggle, self.jimg_toggle]) + [self.txt_toggle, self.img_toggle]) toolbar.insert(self.txt_toggle, -1) self.img_toggle.set_tooltip(_('Images')) self.img_toggle.connect('toggled', self._toggle_cb, - [self.txt_toggle, self.img_toggle, self.jimg_toggle]) + [self.txt_toggle, self.img_toggle]) toolbar.insert(self.img_toggle, -1) - self.jimg_toggle.set_tooltip(_('Journal Images')) - self.jimg_toggle.connect('toggled', self._toggle_cb, - [self.txt_toggle, self.img_toggle, self.jimg_toggle]) - toolbar.insert(self.jimg_toggle, -1) - - self.jimg_chooser_toggle.set_tooltip(_('Choose Journal Images')) - self.jimg_chooser_toggle.connect('clicked', self._toggle_image_chooser) - toolbar.insert(self.jimg_chooser_toggle, -1) - - self.jtext_chooser_toggle.set_tooltip(_('Choose Journal Text')) - self.jtext_chooser_toggle.connect('clicked', self._toggle_text_chooser) - toolbar.insert(self.jtext_chooser_toggle, -1) - for tab in TABS: for i in tab.toolitems: toolbar.insert(i, -1) @@ -105,48 +74,10 @@ class ToolbarBuilder(): def sensitize_all(self): self.txt_toggle.set_sensitive(True) self.img_toggle.set_sensitive(True) - self.jimg_toggle.set_sensitive(True) def unsensitize_all(self): self.txt_toggle.set_sensitive(False) self.img_toggle.set_sensitive(False) - self.jimg_toggle.set_sensitive(False) - - def _toggle_image_chooser(self, widget): - # self._old_cursor = self.edit.get_window().get_cursor() - # self.edit.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) - GObject.idle_add(self.__image_chooser) - - def __image_chooser(self): - chooser = ObjectChooser(what_filter=mime.GENERIC_TYPE_IMAGE) - result = chooser.run() - if result == Gtk.ResponseType.ACCEPT: - jobject = chooser.get_selected_object() - if jobject and jobject.file_path: - title = str(jobject.metadata['title']) - path = str(jobject.file_path) - TABS[2].gallery.add_image(path, title) - # self.edit.get_window().set_cursor(self._old_cursor) - - def _toggle_text_chooser(self, widget): - # self._old_cursor = self.edit.get_window().get_cursor() - # self.edit.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) - GObject.idle_add(self.__text_chooser) - - def __text_chooser(self): - chooser = ObjectChooser(what_filter=mime.GENERIC_TYPE_TEXT) - result = chooser.run() - if result == Gtk.ResponseType.ACCEPT: - jobject = chooser.get_selected_object() - if jobject and jobject.file_path: - title = str(jobject.metadata['title']) - path = str(jobject.file_path) - fp = open(path, 'r') - text = fp.read() - fp.close() - article_data = dehtml(text, title) - TABS[0].set_source_article(Article(article_data)) - # self.edit.get_window().set_cursor(self._old_cursor) def _toggle_cb(self, widget, toggles): for tab in TABS: @@ -154,19 +85,16 @@ class ToolbarBuilder(): i.hide() if not widget.get_active(): - index = 3 + index = 2 else: - for t in range(0, len(toggles)): - if toggles[t] != widget: - toggles[t].set_active(False) - else: - index = t + another = toggles[0] == widget and 1 or 0 + toggles[another].set_active(False) + index = int(not another) for i in TABS[index].toolitems: i.show() - # We don't require any article data to display jounal images - if book.wiki.article and index != 2: + if book.wiki.article: TABS[index].set_source_article(book.wiki.article) if book.custom.article: TABS[index].set_working_article(book.custom.article) diff --git a/icons/journal-image.svg b/icons/journal-image.svg deleted file mode 100644 index e0118e9..0000000 --- a/icons/journal-image.svg +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - version="1.1" - width="55" - height="55" - viewBox="0 0 55 55" - id="svg2" - xml:space="preserve"><metadata - id="metadata25"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs - id="defs33" /><g - transform="matrix(0.65959435,0,0,0.65959435,2.2217886,-0.13950423)" - id="clipping-image" - style="display:block"><g - id="g5" - style="display:inline"><g - id="g7"><polygon - points="48.788,23.002 36.849,11.058 5.962,11.058 5.962,43.944 48.788,43.944 " - id="polygon9" - style="fill:#ffffff;stroke:#010101;stroke-width:3.5" /><polyline - style="fill:none;stroke:#010101;stroke-width:3.5" - points="36.849,11.058 36.849,23.002 48.788,23.002 " - id="polyline11" /></g></g><path - d="m 27.504,23.342 c -6.258,0 -11.471,6.241 -11.471,6.241 0,0 5.213,6.271 11.471,6.267 6.259,-0.005 11.475,-6.274 11.475,-6.274 0,0 -5.216,-6.238 -11.475,-6.234 z m 0,10.642 c -2.423,0 -4.387,-1.966 -4.387,-4.389 0,-2.419 1.964,-4.388 4.387,-4.388 2.42,0 4.386,1.969 4.386,4.388 0,2.424 -1.966,4.389 -4.386,4.389 z" - id="path13" - style="fill:#010101;display:inline" /><circle - cx="27.504" - cy="29.597" - r="1.9910001" - id="circle15" - style="fill:#010101;display:inline" /></g><g - transform="matrix(1.079797,0,0,1.079797,-5.2529966,-5.2292405)" - id="g3013" - style="stroke:#ffffff;stroke-opacity:1"><g - transform="matrix(0.55205508,0,0,0.55205508,77.118464,18.235971)" - id="g4382" - style="stroke:#ffffff;stroke-opacity:1"><g - transform="translate(-80.093659,12.220029)" - id="g4308" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><g - id="g4310" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><path - d="m 6.736,49.002 h 24.52 c 2.225,0 3.439,-1.447 3.439,-3.441 v -27.28 c 0,-1.73 -1.732,-3.441 -3.439,-3.441 h -4.389" - id="path4312" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g></g><g - transform="translate(-80.093659,12.220029)" - id="g4314" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><g - id="g4316" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><path - d="m 26.867,38.592 c 0,1.836 -1.345,3.201 -3.441,4.047 L 6.736,49.002 V 14.84 l 16.69,-8.599 c 2.228,-0.394 3.441,0.84 3.441,2.834 v 29.517 z" - id="path4318" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g></g><path - d="m -70.669659,54.827029 c 0,0 -1.351,-0.543 -2.702,-0.543 -1.351,0 -2.703,0.543 -2.703,0.543" - id="path4320" - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path - d="m -70.669659,44.226029 c 0,0 -1.239,-0.543 -2.815,-0.543 -1.577,0 -2.59,0.543 -2.59,0.543" - id="path4322" - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path - d="m -70.669659,33.898029 c 0,0 -1.125,-0.544 -2.927,-0.544 -1.802,0 -2.478,0.544 -2.478,0.544" - id="path4324" - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><line - id="line4326" - y2="23.725029" - y1="58.753029" - x2="-66.884659" - x1="-66.884659" - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g></g></svg>
\ No newline at end of file diff --git a/icons/load-image-from-journal.svg b/icons/load-image-from-journal.svg deleted file mode 100644 index b8307c8..0000000 --- a/icons/load-image-from-journal.svg +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - version="1.1" - width="55" - height="55" - viewBox="0 0 55 55" - id="svg2" - xml:space="preserve"><metadata - id="metadata25"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs - id="defs33" /><g - transform="matrix(0.55205508,0,0,0.55205508,77.118464,18.235971)" - id="g4382"><g - transform="translate(-80.093659,12.220029)" - id="g4308" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><g - id="g4310" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><path - d="m 6.736,49.002 h 24.52 c 2.225,0 3.439,-1.447 3.439,-3.441 v -27.28 c 0,-1.73 -1.732,-3.441 -3.439,-3.441 h -4.389" - id="path4312" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g></g><g - transform="translate(-80.093659,12.220029)" - id="g4314" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><g - id="g4316" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><path - d="m 26.867,38.592 c 0,1.836 -1.345,3.201 -3.441,4.047 L 6.736,49.002 V 14.84 l 16.69,-8.599 c 2.228,-0.394 3.441,0.84 3.441,2.834 v 29.517 z" - id="path4318" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g></g><path - d="m -70.669659,54.827029 c 0,0 -1.351,-0.543 -2.702,-0.543 -1.351,0 -2.703,0.543 -2.703,0.543" - id="path4320" - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path - d="m -70.669659,44.226029 c 0,0 -1.239,-0.543 -2.815,-0.543 -1.577,0 -2.59,0.543 -2.59,0.543" - id="path4322" - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path - d="m -70.669659,33.898029 c 0,0 -1.125,-0.544 -2.927,-0.544 -1.802,0 -2.478,0.544 -2.478,0.544" - id="path4324" - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><line - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" - x1="-66.884659" - x2="-66.884659" - y1="58.753029" - y2="23.725029" - id="line4326" /></g><g - transform="matrix(1.1623273,0,0,1.1623273,-14.422024,-12.63995)" - id="g3882" - style="fill:none;stroke:#ffffff;stroke-width:2.15085721;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"><g - id="g3884" - style="fill:none;stroke:#ffffff;stroke-width:2.15085721;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><polygon - points="35.281,13.812 15.204,13.812 15.204,35.189 43.041,35.189 43.041,21.577 " - id="polygon3886" - style="fill:none;stroke:#ffffff;stroke-width:2.15085721;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><polyline - id="polyline3888" - points="35.281,13.812 35.281,21.577 43.041,21.577 " - style="fill:none;stroke:#ffffff;stroke-width:2.15085721;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g><path - d="m 19.426691,12.275117 c -4.727185,0 -8.666312,4.714399 -8.666312,4.714399 0,0 3.939127,4.737646 8.666312,4.735322 4.729509,-0.0046 8.668637,-4.739971 8.668637,-4.739971 0,0 -3.939128,-4.713237 -8.668637,-4.70975 z m 0,8.039818 c -1.830666,0 -3.314958,-1.484292 -3.314958,-3.31612 0,-1.827179 1.484292,-3.314958 3.314958,-3.314958 1.828341,0 3.312632,1.487779 3.312632,3.314958 0,1.831828 -1.484291,3.31612 -3.312632,3.31612 z" - id="path3890" - style="fill:#ffffff;fill-opacity:1;stroke:none;display:inline" /><circle - cx="29.207001" - cy="25.863001" - r="1.294" - transform="matrix(1.1623273,0,0,1.1623273,-14.520241,-13.061294)" - id="circle3892" - style="fill:#ffffff;fill-opacity:1;stroke:none;display:inline" /><g - transform="matrix(-1,0,0,1,90.661358,9.6560695)" - id="g4770"><g - transform="translate(34.0803,-1006.42)" - id="g4772"><polyline - transform="matrix(-0.469241,0.469241,-0.469241,-0.469241,66.2906,1019.03)" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" - points="51.562,15.306 41.17,16.188 42.053,5.794" - id="polyline4774" /><path - d="m 39.363241,1033.1291 -0.05636,9.9115 -8.750608,0.067" - id="path4776" - style="fill:none;stroke:#ffffff;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g></svg>
\ No newline at end of file diff --git a/icons/load-text-from-journal.svg b/icons/load-text-from-journal.svg deleted file mode 100644 index b3db477..0000000 --- a/icons/load-text-from-journal.svg +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - version="1.1" - width="55" - height="55" - viewBox="0 0 55 55" - id="svg2" - xml:space="preserve"><metadata - id="metadata25"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs - id="defs33" /><g - transform="matrix(0.55205508,0,0,0.55205508,77.118464,18.235971)" - id="g4382"><g - transform="translate(-80.093659,12.220029)" - id="g4308" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><g - id="g4310" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><path - d="m 6.736,49.002 h 24.52 c 2.225,0 3.439,-1.447 3.439,-3.441 v -27.28 c 0,-1.73 -1.732,-3.441 -3.439,-3.441 h -4.389" - id="path4312" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g></g><g - transform="translate(-80.093659,12.220029)" - id="g4314" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><g - id="g4316" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><path - d="m 26.867,38.592 c 0,1.836 -1.345,3.201 -3.441,4.047 L 6.736,49.002 V 14.84 l 16.69,-8.599 c 2.228,-0.394 3.441,0.84 3.441,2.834 v 29.517 z" - id="path4318" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g></g><path - d="m -70.669659,54.827029 c 0,0 -1.351,-0.543 -2.702,-0.543 -1.351,0 -2.703,0.543 -2.703,0.543" - id="path4320" - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path - d="m -70.669659,44.226029 c 0,0 -1.239,-0.543 -2.815,-0.543 -1.577,0 -2.59,0.543 -2.59,0.543" - id="path4322" - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path - d="m -70.669659,33.898029 c 0,0 -1.125,-0.544 -2.927,-0.544 -1.802,0 -2.478,0.544 -2.478,0.544" - id="path4324" - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><line - style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" - x1="-66.884659" - x2="-66.884659" - y1="58.753029" - y2="23.725029" - id="line4326" /></g><g - transform="matrix(0,-1,1,0,9.8287336,88.386573)" - id="g4770"><g - transform="translate(34.0803,-1006.42)" - id="g4772"><polyline - transform="matrix(-0.469241,0.469241,-0.469241,-0.469241,66.2906,1019.03)" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" - points="51.562,15.306 41.17,16.188 42.053,5.794" - id="polyline4774" /><path - d="m 39.363241,1033.1291 -0.05636,9.9115 -8.750608,0.067" - id="path4776" - style="fill:none;stroke:#ffffff;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g><g - transform="matrix(0.75578519,0,0,0.75578519,-4.9396196,-1.2911009)" - id="clipping-text" - style="fill:none;stroke:#ffffff;stroke-opacity:1;display:block"><g - id="g3152" - style="fill:none;stroke:#ffffff;stroke-opacity:1;display:inline"><g - id="g3154" - style="fill:none;stroke:#ffffff;stroke-opacity:1"><polygon - points="10.932,6.088 31.874,6.088 43.818,18.027 43.818,48.914 10.932,48.914 " - id="polygon3156" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1" /><polyline - id="polyline3158" - points="43.818,18.027 31.874,18.027 31.874,6.088 " - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1" /></g></g><line - id="line3160" - y2="26.25" - y1="26.25" - x2="36.875" - x1="17.875" - display="inline" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1;display:inline" /><line - id="line3162" - y2="33.25" - y1="33.25" - x2="36.875" - x1="17.875" - display="inline" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1;display:inline" /><line - id="line3164" - y2="40.25" - y1="40.25" - x2="36.875" - x1="17.875" - display="inline" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1;display:inline" /></g></svg>
\ No newline at end of file diff --git a/infoslicer/processing/Article_Builder.py b/infoslicer/processing/Article_Builder.py index 5d2a429..b6bd750 100644 --- a/infoslicer/processing/Article_Builder.py +++ b/infoslicer/processing/Article_Builder.py @@ -135,7 +135,7 @@ def get_article_from_dita(image_path, dita): sentence_data_list.insert(0, picture_data)
article_title = input.find("title").renderContents().replace("\n", "").strip()
-
+
image_list = []
imglist_tag = input.find(True, attrs={"id" : "imagelist"})
if imglist_tag != None:
@@ -149,9 +149,9 @@ def get_article_from_dita(image_path, dita): logger.info('cannot find image %s' % img['href'])
else:
image_list.append((img['href'], caption, img['orig_href']))
-
- data = Article_Data(article_id, article_id, article_title, "theme", section_data_list, image_list)
-
+
+ data = Article_Data(article_id, article_id, article_title, "theme", section_data_list, image_list)
+
return data
diff --git a/infoslicer/processing/HTML_strip.py b/infoslicer/processing/HTML_strip.py deleted file mode 100644 index cdd5108..0000000 --- a/infoslicer/processing/HTML_strip.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (C) 2012 Aneesh Dogra <lionaneesh@gmail.com> -# -# This program 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 2 of the License, or -# (at your option) any later version. -# -# This program 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, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -from HTMLParser import HTMLParser -from re import sub -from infoslicer.processing.Article_Data import Sentence_Data, \ - Paragraph_Data, \ - Section_Data, \ - Article_Data -import string - -def filter_non_printable(str): - return ''.join([c for c in str if ord(c) > 31 or ord(c) == 9]) - -class HTML_Strip(HTMLParser): - def __init__(self): - HTMLParser.__init__(self) - self.__text = [] - - def handle_data(self, data): - text = data.strip() - if len(text) > 0: - text = sub('[\t\r\n]+', '', text) - # replace multiple spaces with one - text = sub('[ ]+', ' ', text) - text = filter_non_printable(text) - self.__text.append(text + '') - - def handle_starttag(self, tag, attrs): - if tag == 'p': - self.__text.append('<PARAGRAPH>') - elif tag == 'br': - self.__text.append('<SENTENCE>') - if tag == 'div': - self.__text.append('<SECTION>') - - def text(self): - return ''.join(self.__text).strip() - - -# takes in a HTML document and returns a list of Section objects. -def dehtml(text, title): - try: - parser = HTML_Strip() - parser.feed(text) - parser.close() - text_stripped = parser.text() - except: - text_stripped = text - - # We now need to convert this stripped data to an - # Article Data object. - sections = text_stripped.split('<SECTION>') - section_objs = [] - for section in sections: - s = section.strip() - if s: - paragraphs = text_stripped.split('<PARAGRAPH>') - p_objs = [] - for para in paragraphs: - if para[:len('<SECTION>')] == '<SECTION>': - para = para[len('<SECTION>'):] - if para.endswith('<SECTION>'): - para = para[:-len('<SECTION>')] - p = para.strip() - if p: - sentences = para.split('<SENTENCE>') - s_objs = [] - for sentence in sentences: - s = sentence.strip() - if s: - s_objs += [Sentence_Data(text=s)] - s_objs += [Sentence_Data(text='\n')] - p_objs += [Paragraph_Data(sentences_data=s_objs)] - section_objs += [Section_Data(paragraphs_data=p_objs)] - return Article_Data(article_title=title, sections_data=section_objs) diff --git a/infoslicer/widgets/Journal_Gallery_View.py b/infoslicer/widgets/Journal_Gallery_View.py deleted file mode 100644 index 5358d05..0000000 --- a/infoslicer/widgets/Journal_Gallery_View.py +++ /dev/null @@ -1,168 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) Aneesh Dogra <lionaneesh@gmail.com> -# -# This program 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. -# -# You should have received a copy of the GNU General Public License -# along with this library; if not, write to the Free Software -# Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA - -from gi.repository import Gtk -from gi.repository import Gdk -from gi.repository import GObject -from gi.repository import GdkPixbuf -import os -import cPickle -import pickle -import logging - -from Editable_Textbox import Editable_Textbox -from infoslicer.processing.Article_Data import * -from infoslicer.processing.Article import Article -import book -# from infoslicer.processing import Journal_Getter as journal - -logger = logging.getLogger('infoslicer') - -# For journal images -IMG_WIDTH = 400 -IMG_HEIGHT = 300 - -class Journal_Gallery_View( Gtk.HBox ): - """ - Created by Aneesh Dogra - Journal Gallery View - - The journal gallery view displays the jounal images. - - Drag-and-drop methods have been added to set up the images as a drag - source. - The data returned by drag-data-get will be a list containing - an Image_Data object and a Sentence_Data object. - These correspond to the image - and caption respectively. - """ - - def __init__(self): - self.image_list = [] - GObject.GObject.__init__(self) - self.current_index = -1 - self.source_article_id = -1 - left_button = Gtk.Button(label="\n\n << \n\n") - right_button = Gtk.Button(label="\n\n >> \n\n") - self.imagenumberlabel = Gtk.Label() - self.image = Gtk.Image() - self.imagebox = Gtk.EventBox() - self.imagebox.add(self.image) - self.imagebox.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, - [], - Gdk.DragAction.COPY) - self.imagebox.drag_source_add_image_targets() - self.imagebox.connect("drag-begin", self.drag_begin_event, None) - logging.debug('##################### Galler_View.connect') - self.imagebox.connect("drag-data-get", self.drag_data_get_event, None) - - self.caption = Gtk.Label(label="") - self.caption.set_line_wrap(True) - - self.image_drag_container = Gtk.VBox() - self.image_drag_container.pack_start(self.imagenumberlabel, expand=False, - fill=False, padding=0) - self.image_drag_container.pack_start(self.imagebox, False, True, 0) - self.image_drag_container.pack_start(self.caption, False, True, 0) - - image_container = Gtk.VBox() - image_container.pack_start(Gtk.Label(" "), True, True, 0) - image_container.pack_start(self.image_drag_container, False, True, 0) - image_container.pack_start(Gtk.Label(" "), True, True, 0) - - left_button_container = Gtk.VBox() - left_button_container.pack_start(Gtk.Label(" "), True, True, 0) - left_button_container.pack_start(left_button, False, True, 0) - left_button_container.pack_start(Gtk.Label(" "), True, True, 0) - - right_button_container = Gtk.VBox() - right_button_container.pack_start(Gtk.Label(" "), True, True, 0) - right_button_container.pack_start(right_button, False, True, 0) - right_button_container.pack_start(Gtk.Label(" "), True, True, 0) - - - self.pack_start(left_button_container, False, True, 0) - self.pack_start(image_container, True, True, 0) - self.pack_start(right_button_container, False, True, 0) - - self.show_all() - right_button.connect("clicked", self.get_next_item, None) - left_button.connect("clicked", self.get_prev_item, None) - self.get_next_item(right_button, None) - - def get_next_item(self, button, param): - if self.image_list == []: - self.caption.set_text("No images were found in the journal.") - self.image.clear() - return - self.current_index += 1 - if self.current_index == len(self.image_list): - self.current_index = 0 - self.imagebuf = GdkPixbuf.Pixbuf.new_from_file(self.image_list[self.current_index][0]) - self.imagebuf = self.imagebuf.scale_simple(IMG_WIDTH, IMG_HEIGHT, - GdkPixbuf.InterpType.BILINEAR) - self.image.set_from_pixbuf(self.imagebuf) - self.caption.set_text("\n" + self.image_list[self.current_index][1]) - self.imagenumberlabel.set_text("(%d / %d)\n" % (self.current_index+1, len(self.image_list))) - - def get_prev_item(self, button, param): - if self.image_list == []: - self.caption.set_text("No images were found in the journal.") - self.image.clear() - return - if self.current_index == 0: - self.current_index = len(self.image_list) - self.current_index -= 1 - self.imagebuf = GdkPixbuf.Pixbuf.new_from_file(self.image_list[self.current_index][0]) - self.imagebuf = self.imagebuf.scale_simple(IMG_WIDTH, IMG_HEIGHT, - GdkPixbuf.InterpType.BILINEAR) - self.image.set_from_pixbuf(self.imagebuf) - self.caption.set_text("\n" + self.image_list[self.current_index][1]) - self.imagenumberlabel.set_text("(%d / %d)\n" % (self.current_index+1, len(self.image_list))) - - def get_first_item(self): - if self.image_list == []: - self.caption.set_text("No images were found in the journal.") - self.image.clear() - return - self.current_index = 0 - self.imagebuf = GdkPixbuf.Pixbuf.new_from_file(self.image_list[self.current_index][0]) - self.imagebuf = self.imagebuf.scale_simple(IMG_WIDTH, IMG_HEIGHT, - GdkPixbuf.InterpType.BILINEAR) - self.image.set_from_pixbuf(self.imagebuf) - self.caption.set_text("\n" + self.image_list[self.current_index][1]) - logger.debug("setting text to:") - logger.debug("(%d / %d)\n" % - (self.current_index+1, len(self.image_list))) - self.imagenumberlabel.set_text("(%d / %d)\n" % (self.current_index+1, len(self.image_list))) - - def drag_begin_event(self, widget, context, data): - logging.debug('########### Journal_Journal_Gallery_View.drag_begin_event called') - self.imagebox.drag_source_set_icon_pixbuf(self.imagebuf) - - def drag_data_get_event(self, widget, context, selection_data, info, timestamp, data): - logger.debug('############# Journal_Journal_Gallery_View.drag_data_get_event') - atom = Gdk.atom_intern("section", only_if_exists=False) - imagedata = Picture_Data(self.source_article_id, - self.image_list[self.current_index][0]) - captiondata = Sentence_Data(0, self.source_article_id, 0, 0, 0, self.image_list[self.current_index][1]) - paragraph1data = Paragraph_Data(0, self.source_article_id, 0, 0, [imagedata]) - paragraph2data = Paragraph_Data(0, self.source_article_id, 0, 0, [captiondata]) - sectionsdata = [Section_Data(0, self.source_article_id, 0, [paragraph1data, paragraph2data])] - string = cPickle.dumps(sectionsdata) - selection_data.set(atom, 8, string) - - def add_image(self, image_path, title): - logger.debug('############# Journal_Journal_Gallery_View.add_image') - self.image_list.append((image_path, title)) - logger.debug(self.image_list) - self.get_first_item() diff --git a/infoslicer/widgets/Journal_Image_Pane.py b/infoslicer/widgets/Journal_Image_Pane.py deleted file mode 100644 index 38c1c23..0000000 --- a/infoslicer/widgets/Journal_Image_Pane.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) IBM Corporation 2008 -import gi -gi.require_version('Gtk', '3.0') -from gi.repository import Gtk -from gi.repository import Gdk -from gi.repository import GObject -import logging - -from gettext import gettext as _ -from Editing_View import Editing_View -from infoslicer.widgets.Journal_Gallery_View import Journal_Gallery_View -from infoslicer.processing.Article import Article - -logger = logging.getLogger('infoslicer') - -class Journal_Image_Pane(Gtk.HBox): - """ - Created by Aneesh Dogra - - See __init__.py for overview of panes. - - The Image Pane gives a side-by-side view of the jounal images and edit article. - The left hand side shows the jounal images. These can be dragged into - the edit article. - """ - - def __init__(self): - GObject.GObject.__init__(self) - self.toolitems = [] - - gallery_box = Gtk.VBox() - gallery_box.show() - - labeleb = Gtk.EventBox() - labeleb.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse("#EEEEEE")) - gallery_box.pack_start(labeleb, False, False, 0) - labeleb.show() - - self.articletitle = Gtk.Label() - self.articletitle.set_justify(Gtk.Justification.CENTER) - labeleb.add(self.articletitle) - self.articletitle.show() - - self.gallery = Journal_Gallery_View() - self.gallery.set_size_request(Gdk.Screen.width()/2, -1) - gallery_box.pack_start(self.gallery, True, True, 0) - - self.pack_start(gallery_box, False, False, 0) - - self.editarticle = Editing_View() - self.pack_start(self.editarticle, True, True, 0) - self.editarticle.show_all() - - def set_working_article(self, article): - logger.debug("working received, title %s" % article.article_title) - - self.editarticle.articletitle.set_markup( - "<span size='medium'><b> %s </b> %s</span>"% \ - (_("Article:"), article.article_title)) - - if self.editarticle.textbox.get_article() != article: - self.editarticle.textbox.set_article(article) @@ -236,9 +236,8 @@ class ToolbarBuilder(): def _publish_clicked_cb(self, widget): xol.publish(self.activity) -WIKI = { _('English Wikipedia') : 'en.wikipedia.org', - _('Simple English Wikipedia') : 'simple.wikipedia.org', - _('French Wikipedia') : 'fr.wikipedia.org', - _('German Wikipedia') : 'de.wikipedia.org', - _('Polish Wikipedia') : 'pl.wikipedia.org', - _('Spanish Wikipedia') : 'es.wikipedia.org'} +WIKI = { _("English Wikipedia") : "en.wikipedia.org", + _("Simple English Wikipedia") : "simple.wikipedia.org", + _("German Wikipedia") : "de.wikipedia.org", + _("Spanish Wikipedia") : "es.wikipedia.org", + _("French Wikipedia") : "fr.wikipedia.org" } diff --git a/po/InfoSlicer.pot b/po/InfoSlicer.pot index 3250977..231eb20 100644 --- a/po/InfoSlicer.pot +++ b/po/InfoSlicer.pot @@ -8,83 +8,52 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-03-27 08:46-0400\n" +"POT-Creation-Date: 2012-11-15 00:33-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: activity/activity.info:2 +#. TRANS: "name" option from activity.info file msgid "InfoSlicer" msgstr "" -#: activity/activity.info:3 +#. TRANS: "summary" option from activity.info file +#. TRANS: "description" option from activity.info file msgid "" "Is it possible to have my own encyclopedia? Yes! Find your favorite " "information on the web and package it with InfoSlicer creating incredible " "collections." msgstr "" -#: edit.py:70 -msgid "Text" -msgstr "" - -#: edit.py:75 -msgid "Images" -msgstr "" - -#: edit.py:80 -msgid "Journal Images" -msgstr "" - -#: edit.py:85 -msgid "Choose Journal Images" -msgstr "" - -#: edit.py:89 -msgid "Choose Journal Text" -msgstr "" - -#: parse.py:18 -msgid "Return to index" -msgstr "" - -#: net.py:37 -#, python-format -msgid "\"%s\" download in progress..." +#: activity.py:67 +msgid "Library" msgstr "" -#: net.py:40 -#, python-format -msgid "Processing \"%s\"..." +#: activity.py:75 +msgid "Edit" msgstr "" -#: net.py:44 -#, python-format -msgid "Downloading \"%s\" images..." +#: book.py:211 +msgid "Lion (from en.wikipedia.org)" msgstr "" -#: net.py:45 -#, python-format -msgid " (from %s)" +#: book.py:212 +msgid "Tiger (from en.wikipedia.org)" msgstr "" -#: net.py:47 -#, python-format -msgid "\"%s\" successfully downloaded" +#: book.py:213 +msgid "Giraffe (from en.wikipedia.org)" msgstr "" -#: net.py:51 -#, python-format -msgid "\"%s\" could not be found" +#: book.py:214 +msgid "Zebra (from en.wikipedia.org)" msgstr "" -#: net.py:55 -#, python-format -msgid "Error downloading \"%s\"; check your connection" +#: book.py:221 +msgid "Giraffe" msgstr "" #: bookview.py:52 @@ -111,32 +80,46 @@ msgstr "" msgid "New article" msgstr "" -#: activity.py:67 -msgid "Library" +#: edit.py:58 +msgid "Text" msgstr "" -#: activity.py:75 -msgid "Edit" +#: edit.py:63 +msgid "Images" msgstr "" -#: book.py:211 -msgid "Lion (from en.wikipedia.org)" +#: infoslicer/widgets/Edit_Pane.py:53 +msgid "Snap selection to:" msgstr "" -#: book.py:212 -msgid "Tiger (from en.wikipedia.org)" +#: infoslicer/widgets/Edit_Pane.py:54 +msgid "Nothing" msgstr "" -#: book.py:213 -msgid "Giraffe (from en.wikipedia.org)" +#: infoslicer/widgets/Edit_Pane.py:55 +msgid "Sentences" msgstr "" -#: book.py:214 -msgid "Zebra (from en.wikipedia.org)" +#: infoslicer/widgets/Edit_Pane.py:56 +msgid "Paragraphs" msgstr "" -#: book.py:221 -msgid "Giraffe" +#: infoslicer/widgets/Edit_Pane.py:57 +msgid "Sections" +msgstr "" + +#: infoslicer/widgets/Edit_Pane.py:103 infoslicer/widgets/Edit_Pane.py:111 +#: infoslicer/widgets/Format_Pane.py:52 infoslicer/widgets/Image_Pane.py:58 +#: infoslicer/widgets/Image_Pane.py:89 +msgid "Article:" +msgstr "" + +#: infoslicer/widgets/Image_Pane.py:79 +msgid "This article does not have any images" +msgstr "" + +#: infoslicer/widgets/Image_Pane.py:82 +msgid "Please select a Wikipedia article from the menu above" msgstr "" #: library.py:50 @@ -207,19 +190,54 @@ msgid "Simple English Wikipedia" msgstr "" #: library.py:241 -msgid "French Wikipedia" +msgid "German Wikipedia" msgstr "" #: library.py:242 -msgid "German Wikipedia" +msgid "Spanish Wikipedia" msgstr "" #: library.py:243 -msgid "Polish Wikipedia" +msgid "French Wikipedia" msgstr "" -#: library.py:244 -msgid "Spanish Wikipedia" +#: net.py:37 +#, python-format +msgid "\"%s\" download in progress..." +msgstr "" + +#: net.py:40 +#, python-format +msgid "Processing \"%s\"..." +msgstr "" + +#: net.py:44 +#, python-format +msgid "Downloading \"%s\" images..." +msgstr "" + +#: net.py:45 +#, python-format +msgid " (from %s)" +msgstr "" + +#: net.py:47 +#, python-format +msgid "\"%s\" successfully downloaded" +msgstr "" + +#: net.py:51 +#, python-format +msgid "\"%s\" could not be found" +msgstr "" + +#: net.py:55 +#, python-format +msgid "Error downloading \"%s\"; check your connection" +msgstr "" + +#: parse.py:18 +msgid "Return to index" msgstr "" #: xol.py:50 @@ -248,38 +266,3 @@ msgstr "" msgid "" "You can read the book in Browse or access the .xol file from your Journal" msgstr "" - -#: infoslicer/widgets/Journal_Image_Pane.py:59 -#: infoslicer/widgets/Image_Pane.py:58 infoslicer/widgets/Image_Pane.py:89 -#: infoslicer/widgets/Format_Pane.py:52 infoslicer/widgets/Edit_Pane.py:103 -#: infoslicer/widgets/Edit_Pane.py:111 -msgid "Article:" -msgstr "" - -#: infoslicer/widgets/Image_Pane.py:79 -msgid "This article does not have any images" -msgstr "" - -#: infoslicer/widgets/Image_Pane.py:82 -msgid "Please select a Wikipedia article from the menu above" -msgstr "" - -#: infoslicer/widgets/Edit_Pane.py:53 -msgid "Snap selection to:" -msgstr "" - -#: infoslicer/widgets/Edit_Pane.py:54 -msgid "Nothing" -msgstr "" - -#: infoslicer/widgets/Edit_Pane.py:55 -msgid "Sentences" -msgstr "" - -#: infoslicer/widgets/Edit_Pane.py:56 -msgid "Paragraphs" -msgstr "" - -#: infoslicer/widgets/Edit_Pane.py:57 -msgid "Sections" -msgstr "" @@ -236,27 +236,15 @@ msgstr "Mover artículo hacia arriba" msgid "New article" msgstr "Nuevo artículo" -#: edit.py:70 +#: edit.py:58 msgid "Text" msgstr "Texto" -#: edit.py:75 +#: edit.py:63 msgid "Images" msgstr "Imágenes" -#: edit.py:80 -msgid "Journal Images" -msgstr "Imágenes del Diario" - -#: edit.py:85 -msgid "Choose Journal Images" -msgstr "Eliger las imágenes del Diario" - -#: edit.py:89 -msgid "Choose Journal Text" -msgstr "Eliger el texto del Diario" - -#: Infoslicer/widgets/Edit_Pane.py:53 +#: infoslicer/widgets/Edit_Pane.py:53 msgid "Snap selection to:" msgstr "Ajustar/alinear la selección a:" @@ -360,21 +348,17 @@ msgid "Simple English Wikipedia" msgstr "Wikipedia en inglés sencillo" #: library.py:241 -msgid "French Wikipedia" -msgstr "Wikipedia en francés" - -#: library.py:242 msgid "German Wikipedia" msgstr "Wikipedia en alemán" -#: library.py:243 -msgid "Polish Wikipedia" -msgstr "Wikipedia en polaco" - -#: library.py:244 +#: library.py:242 msgid "Spanish Wikipedia" msgstr "Wikipedia en español" +#: library.py:243 +msgid "French Wikipedia" +msgstr "Wikipedia en francés" + #: net.py:37 #, python-format msgid "\"%s\" download in progress..." @@ -273,3 +273,6 @@ msgstr "" #~ msgid "A bundle for current object was already created. " #~ msgstr "Juni t'i'él abal ax'é xi eyextaláb k'wajat ts'ejkadhits. " + +#~ msgid "Bundle exists" +#~ msgstr "T'i'él xi wa'tsits" |