[dots/remove-assistant: 2/38] Remove import_assistant and use open
- From: Fernando Herrera de las Heras <fherrera src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dots/remove-assistant: 2/38] Remove import_assistant and use open
- Date: Thu, 15 Jul 2010 21:07:09 +0000 (UTC)
commit 6bfa3a5a9f0624a2900055a19c2b9fc8b525b2f2
Author: Fernando Herrera <fherrera onirica com>
Date: Thu Jul 8 03:26:12 2010 +0200
Remove import_assistant and use open
data/app_window.xml | 2 +
dots/app_window.py | 46 +++++++++-
dots/import_assistant.py | 224 ----------------------------------------------
3 files changed, 43 insertions(+), 229 deletions(-)
---
diff --git a/data/app_window.xml b/data/app_window.xml
index 8f5ad68..0fb4ebb 100644
--- a/data/app_window.xml
+++ b/data/app_window.xml
@@ -234,10 +234,12 @@
</object>
<object class="GtkAction" id="action_save">
<property name="stock_id">gtk-save</property>
+ <property name="sensitive">False</property>
<signal name="activate" handler="_onSave"/>
</object>
<object class="GtkAction" id="action_save_as">
<property name="stock_id">gtk-save-as</property>
+ <property name="sensitive">False</property>
<signal name="activate" handler="_onSaveAs"/>
</object>
<object class="GtkAction" id="action_quit">
diff --git a/dots/app_window.py b/dots/app_window.py
index 14a75e8..b319fda 100644
--- a/dots/app_window.py
+++ b/dots/app_window.py
@@ -19,8 +19,8 @@ import gtk, glib
import os, tempfile
from config_builder import ConfigBuilder
import host_settings
-from import_assistant import ImportAssistant
from dots_project import DotsProject
+from document_builder import document_new
class AppWindow(object):
def __init__(self):
@@ -34,11 +34,47 @@ class AppWindow(object):
self.config_builder = ConfigBuilder()
def _onOpen(self, action):
- print '_onOpen', action
-
- def _onImport(self, action):
- ia = ImportAssistant(self)
- ia.run()
+ chooser = gtk.FileChooserDialog(title=None,action=gtk.FILE_CHOOSER_ACTION_OPEN,
+ buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
+ filter = gtk.FileFilter()
+ filter.set_name("All files")
+ filter.add_pattern("*")
+ chooser.add_filter(filter)
+
+ filter = gtk.FileFilter()
+ filter.set_name("Documents")
+ filter.add_mime_type("application/pdf")
+ filter.add_mime_type("application/vnd.oasis.opendocument.text")
+ filter.add_mime_type("application/xhtml+xml")
+ filter.add_mime_type("application/xml")
+ filter.add_mime_type("text/plain")
+ filter.add_mime_type("text/html")
+ filter.add_pattern("*.pdf")
+ filter.add_pattern("*.odt")
+ filter.add_pattern("*.txt")
+ filter.add_pattern("*.html")
+ filter.add_pattern("*.xhtml")
+ filter.add_pattern("*.xml")
+ chooser.add_filter(filter)
+ response = chooser.run()
+ filename = chooser.get_filename()
+ chooser.destroy()
+ if response == gtk.RESPONSE_OK:
+ print chooser.get_filename()
+ document = document_new (filename)
+ config = ConfigBuilder()
+ config['xml']['semanticFiles'] = '*'
+ config['xml']['semanticFiles'] += ',nemeth.sem'
+ config['xml']['internetAccess'] = 'yes'
+ config['translation']['literaryTextTable'] = "Es-Es-g1.utb"
+ config['outputFormat']['cellsPerLine'] = 40
+ config['outputFormat']['braillePages'] = 'yes'
+ config['outputFormat']['formatFor'] = 'textDevice'
+ config['outputFormat']['LinesPerPage'] = 25
+ config['outputFormat']['braillePageNumberAt'] = 'bottom'
+ self.translate (document, config)
+
+
def _OnBrailleViewToggle(self, ascii_item):
current_project = self._getCurrentProject()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]