Commits

Ali Gholami Rudi  committed 3e2de5b

noorgtk: M-return goes to the number-the sajda in the aya

  • Participants
  • Parent commits c7f7750
  • Tags 0.6

Comments (0)

Files changed (3)

 
 When using noorgtk interface, you can just type any number and press
 enter; it will take you to the aya with that number.  Pressing ``Esc``
-or ``C-g`` will clear the number typed so far.
+or ``C-g`` will clear the number typed so far.  There are keys for
+going to other places in a sura; see `noorgtk keys`_.
 
 For noorhtmls interface, aya anchor names has been added.  For
 instance ``003.html#50`` points to the 50\ `th`:sub: aya.
 clear number               escape, C-g
 goto aya                   return
 goto the page before aya   S-return
+goto juz start             C-return
+goto sajda                 M-return
 quit                       q
 =========================  ============================
 
+Note that all goto actions use the entered number.
+
 
 Configuration File
 ==================

File noor/data/suras.txt

 المسد	5
 الإخلاص	4
 الفلق	5
-الناس	6
+الناس	6
         # handling aya sign
         if number is not None:
             sign = str(number)
-            sign_tag = self.tag5
+            sign_tag = self.tag4
             if sajda == 'minor':
                 sign = '*%s*' % sign
             elif sajda == 'major':
                 sign = '**%s**' % sign
-            else:
-                sign_tag = self.tag4
+            if sajda is not None:
+                self._set_sajda_mark()
+                sign_tag = self.tag5
             self._insert('[', self.tag4)
             self._insert('%s' % sign, sign_tag)
             self._insert(']\n', self.tag4)
         self.juz_number += 1
         self._set_mark('j' + str(self.juz_number))
 
+    def _set_sajda_mark(self):
+        self.sajda_number += 1
+        self._set_mark('s' + str(self.sajda_number))
+
     def _set_mark(self, name):
         textiter = self.buffer.get_iter_at_mark(self.buffer.get_insert())
         mark = self.buffer.create_mark(name, textiter, left_gravity=True)
 
     def _goto_juz_start(self):
         name = 'j' + str(self.number)
-        self._goto_mark(name, location=1.0)
+        self._goto_mark(name)
+
+    def _goto_sajda(self):
+        name = 's' + str(self.number)
+        self._goto_mark(name, location=0.5)
 
     def run(self):
         self.window.show_all()
               ord('p'): _prev_line, ord('a'): _start, ord('e'): _end,
               ord('l'): _redraw, ord('g'): _clear_number,
               gtk.keysyms.Return: _goto_juz_start}
-    m_keys = {ord('v'): _prev_page}
+    m_keys = {ord('v'): _prev_page, gtk.keysyms.Return: _goto_sajda}
     s_keys = {ord(' '): _prev_page, gtk.keysyms.Return: _goto_before_aya}