Skip to content

Commit

Permalink
fix the importing to html
Browse files Browse the repository at this point in the history
  • Loading branch information
assem-ch committed Feb 22, 2014
1 parent 6dec013 commit 1f63794
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
22 changes: 12 additions & 10 deletions src/alfanous-desktop/Gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import os
import gettext
from re import compile
import codecs

from pyparsing import ParseException
from configobj import ConfigObj
Expand Down Expand Up @@ -83,7 +84,8 @@ def __init__( self ):
self.last_results = None
self.currentQuery = 0
self.Queries = []
self.history = []
self.undo_stack = []
self.redo_stack = []

def exit( self ):
self.save_config()
Expand Down Expand Up @@ -273,12 +275,12 @@ def search_all( self, page = 1 ):
"""
The main search function
"""
# add to history
if self.o_query.currentText() in self.history:
self.history.remove( self.o_query.currentText() )
self.history.insert( 0, self.o_query.currentText() )
# add to undo stack
if self.o_query.currentText() in self.undo_stack:
self.undo_stack.remove( self.o_query.currentText() )
self.undo_stack.insert( 0, self.o_query.currentText() )
self.o_query.clear()
self.o_query.addItems( self.history )
self.o_query.addItems( self.undo_stack )
self.o_query.setCurrentIndex( 0 )

limit = int( self.limit_group.checkedAction().text() )
Expand Down Expand Up @@ -526,13 +528,13 @@ def save_results( self ):
filenames = diag.selectedFiles();

path = unicode( filenames[0] )
file = open( path, "w" )
file.write( self.o_results.toHtml().toUtf8().replace("<head>", "<head><meta charset=\"utf-8\">") + "<br><br>CopyRights(c)<a href='http://www.alfanous.org'>Alfanous</a> " )
file.close()
f = codecs.open( path, "w", "utf-8")
f.write( self.o_results.page().currentFrame().toHtml().replace("<head>", "<head><meta charset=\"utf-8\">") + "<br><br>CopyRights(c)<a href='http://www.alfanous.org'>Alfanous</a> " )
f.close()

def print_results( self ):
printer = QtGui.QPrinter()
printer.setCreator( self.o_results.toHtml() )
printer.setCreator( self.o_results.html() )
printer.setDocName( _( u"Results" ) + "-" + str( self.o_page.value() ) )
printer.setPageSize( printer.A4 )

Expand Down
8 changes: 4 additions & 4 deletions src/alfanous-desktop/Templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@
<span class='quran_decoration prev_aya'>
] </span>
<span style='direction:ltr;' class='prev_aya'>
({{ ayaresult_content.aya.prev_aya.sura }} {{ ayaresult_content.aya.prev_aya.id }})
({{ ayaresult_content.aya.prev_aya.sura_arabic }} {{ ayaresult_content.aya.prev_aya.id }})
</span>
</p>
Expand All @@ -956,7 +956,7 @@
] </span>
<span style='direction:rtl;' class='main_aya'>
({{ ayaresult_content.identifier.sura_name }} {{ ayaresult_content.aya.id }})
({{ ayaresult_content.identifier.sura_arabic_name }} {{ ayaresult_content.aya.id }})
</span>
Expand All @@ -976,7 +976,7 @@
<span style='direction:ltr;' class='next_aya'>
({{ ayaresult_content.aya.next_aya.sura }} {{ ayaresult_content.aya.next_aya.id }})
({{ ayaresult_content.aya.next_aya.sura_arabic }} {{ ayaresult_content.aya.next_aya.id }})
</span>
</p>
Expand Down Expand Up @@ -1015,7 +1015,7 @@
{% endif %}
{% if ayaresult_content.stat or ayaresult_content.position %}
<div class='aya_details'>
<div class='aya_details' style='text-align:center;'>
{% if ayaresult_content.stat %}
<div class='details_label aya_stat0 clickable'> {{ _("words") }} | {{ ayaresult_content.stat.words }} </div>
Expand Down

0 comments on commit 1f63794

Please sign in to comment.