Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
moving from tkinter to wxpython
#41
Yes I was right but then again I was wrong CMUSphinx is a toolkit for Linux and it includes pocketsphinx
toolkit
Reply
#42
Then I think it's worth exploring.
Reply
#43
Would yo like to comment on some of the ugly bits?
Reply
#44
I haven't forgotten about you, but
I have been working on my own code but will get to yours later this evening, and into tomorrow if required.

But I do have some questions:
  • I imagine that the large buttons are so that your blind user can find the various chapters by touch screen, Is that correct?
  • what does '67' refer to in books list?
  • What are you planning on putting in the notebook tabs?
  • Would a listCtrl be a better choice? see example (image under (Accordance Bible Software) left side here: https://churchtechtoday.com/2016/11/25/5...ket-today/
Reply
#45
Here's my idea of how chapters, mp3 file locations and (coming up) text should be handled
I am adding King James text to the json file also, and will share all the code to create as soon as done:

do the following steps in order:
  • Create a directory named src
  • Save the __init__.py file to parent directory of src
  • Copy all other .py files to the src directory
  • run
    python BiblePaths.py
    once from command terminal to create sub directories
  • save .json file (attached) to src/data/json
  • run
    python DisplayBibleIndex.py

software:
__init__.py
    src\
        __init__.py
        BiblePaths.py
        DisplayBibleIndex.py
BiblePaths.py
from pathlib import Path

class BiblePaths:
    def __init__(self):
        self.homepage = Path('.')
        self.datapath = self.homepage / 'data'
        self.datapath.mkdir(exist_ok=True)
        self.jsonpath = self.datapath / 'json'
        self.jsonpath.mkdir(exist_ok=True)
        self.KingJamespath = self.datapath / 'KingJames'
        self.KingJamespath.mkdir(exist_ok=True)

        self.BibleIndex = self.jsonpath / 'BibleIndex.json'
        self.emptyinit = self.homepage / '__init__.py'
        self.emptyinit.touch(exist_ok=True)


def onetime():
    bp = BiblePaths()

if __name__ == '__main__':
    onetime()
DisplayBibleIndex.py
import BiblePaths
import json


class DisplayBibleIndex:
    def __init__(self):
        self.npath = BiblePaths.BiblePaths()
        with self.npath.BibleIndex.open() as f:
            self.BibleIndex = json.load(f)
        self.show_index()

    def show_index(self):
        for volume, contents in self.BibleIndex.items():
            for book, detail in contents.items():
                print()
                for chapter, description in detail.items():
                    if chapter == 'mp3':
                        print(f'mp3 file is located here: {description}')
                    else:
                        print(f'volume: {volume},  book: {book}, chapter: {chapter} {description}')

        # This is an example of how to get info on a particular Book, chapter:
        print(f"\nLeviticus Chapter 5: {self.BibleIndex['Old Testament']['Leviticus']['5']}")
        print(f"Mp3 file for Leviticus is here: {self.BibleIndex['Old Testament']['Leviticus']['mp3']}")


if __name__ == '__main__':
    DisplayBibleIndex()

Attached Files

.json   BibleIndex.json (Size: 34.42 KB / Downloads: 221)
Reply
#46
Okay I have followed the instructions but I get an error
Error:
File "DisplayBibleIndex.py", line 18 print(f'mp3 file is located here: {description}')
Reply
#47
f-string was introduced in python 3.6
replacement is like:
# f-string version
print(f'mp3 file is located here: {description}')
#pre python 3.6 version
print('mp3 file is located here: {}'.format(description))
just change all occurrences, or better you get up to date!

Had 5 or 6 power outages last night, plus 2 feet of snow. Slowed me down a bit.
I need sleep, be back i several hours.

But I do have some questions:
  • I imagine that the large buttons are so that your blind user can find the various chapters by touch screen, Is that correct?
  • what does '67' refer to in books list?
  • What are you planning on putting in the notebook tabs?
  • Would a listCtrl be a better choice? see example (image under (Accordance Bible Software) left side here: https://churchtechtoday.com/2016/11/25/5...ket-today/
Reply
#48
(Mar-07-2018, 04:01 AM)Larz60+ Wrote:
  • I imagine that the large buttons are so that your blind user can find the various chapters by touch screen, Is that correct?
Well she uses the touchpad and as she cannot see the buttons need to be quite big. While the mousepointer is over a button it says either the book name or chapter ( just once). immediately the mousepointer moves off the button it stops. This prevents it starting to say multiple words as she moves the mouse about otherwise they would all start and continue until the word is finished.
Quote:
  • what does '67' refer to in books?
It's the number of books in the bible + 1
Quote:
  • What are you planning on putting in the notebook tabs?
The names of the books are on the tabs so sighted people can click on them to navigate. They are too small for her to use and not all can be on screen at the same time due to the number of pages.
Quote:
Seems to be a completely different thing and not sure how I could write that sort of code to do what I set out to do.
I am still curious about which bits of my code are ugly. I would like to see why some is and how I could improve it. I do want to advance in this.
Reply
#49
Quote:I am still curious about which bits of my code are ugly. I would like to see why some is and how I could improve it. I do want to advance in this.
working on it, that's why the questions, and the JSON file.
I just got up for a few minutes, need more sleep, than back to it.
Last nights power failures slowed my down a lot.
Reply
#50
Not to worry, we are obviously in different time zones. We have never had more than 6" snow here. Very rare to have power cuts too.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020