Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alesyarabushka/mvc_kivy_python
an interface application written in Python Kivy using MVC
https://github.com/alesyarabushka/mvc_kivy_python
dom-parser kivy kivy-application kivy-language kivymd mvc mvc-pattern parser pyhton python python3 sax sax-parser xml
Last synced: 23 days ago
JSON representation
an interface application written in Python Kivy using MVC
- Host: GitHub
- URL: https://github.com/alesyarabushka/mvc_kivy_python
- Owner: AlesyaRabushka
- Created: 2022-03-19T07:15:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-29T10:32:00.000Z (over 2 years ago)
- Last Synced: 2024-10-14T06:40:41.403Z (23 days ago)
- Topics: dom-parser, kivy, kivy-application, kivy-language, kivymd, mvc, mvc-pattern, parser, pyhton, python, python3, sax, sax-parser, xml
- Language: Python
- Homepage:
- Size: 295 KB
- Stars: 3
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Vet Clinic
# Description
**Vet Clinic** is a simple interface application that was inspired by registration databaseIt contains add, search and delete dialogs to communicate with the data
## MVC pattern
The application has been created as an example of [MVC](https://developer.mozilla.org/en-US/docs/Glossary/MVC) pattern
with [Kivy](https://kivy.org/doc/stable/) and [KivyMD](https://kivymd.readthedocs.io/en/latest/) PythonIt contains model, controller and view classes
- **Model**:
Contains one class Model that is responsible for XML parsing
- **Controller**:
Is one class that filters the input data and provides communication between Model and View classes
- **View**:
Is presented by a set of classes each of which is responsible for the presentation of each dialog window
+ *MainScreen* - the main screen of the App from which all other windows are called
+ *AddPopup* - adds new pet records
+ *SearchPopup* - searches for particular records by the given parameters
+ *DeletePopup* - deletes particular records by the given parameters
+ *EmailLetterPopup* - is called from DeletePopup and provides a choice of sending an email to pet owner (opens *default browser* on [mail.ru](https://e.mail.ru/drafts/) page), *but only if one record has been found*
````
import webbrowser
def open_mail(self):
# opens default browser
webbrowser.open_new('https://e.mail.ru/drafts/')
````
+ *FoundPopup* - is opened from SearchPopup and is used for show the table with searched data records
+ *HandlerPopup* - adds pet handler information (is called after correct registration in AddPopup)
+ *InformationPopup* - shows more pet records information by clicking on checkbox on the main screen table
+ *WarningPopup* - appears as a result of XML Parsing Error
+ *HelperPopup* - has no methods, just shows the **Vet Clinic** contact info
## Interface
The whole interface of the App is placed in *[myscreen.kv](https://github.com/AlesyaRabushka/MVC_Kivy_Python/blob/main/View/myscreen.kv)* file and is written in special [Kivy Language](https://kivy.org/doc/stable/guide/lang.html)Here is the example of Main Screen
## XML Parsing
- In this App is used [Minimal DOM implementation](https://docs.python.org/3/library/xml.dom.minidom.html) for fill the XML file with information
- [SAX Parser](https://docs.python.org/3/library/xml.sax.handler.html) is used for reading XML file, it is placed in [Model/sax_parser.py](https://github.com/AlesyaRabushka/MVC_Kivy_Python/blob/main/Model/sax_parser.py)There are three XML files, to use one of them you should change the name of parsed file in [Model/myscreen.py](https://github.com/AlesyaRabushka/MVC_Kivy_Python/blob/main/Model/myscreen.py) where *'pet.xml'* - is the name of the file you want to use
````
# line 274
file = open('pet.xml', 'w')# line 330
file = open('pet.xml', 'w')# line 345
parser.parse('pet.xml')
````
First two lines are parts of [Minimal DOM implementation](https://docs.python.org/3/library/xml.dom.minidom.html) parsing
The third one - [SAX Parser](https://docs.python.org/3/library/xml.sax.handler.html)## How to use
To use this App it is required to install **kivy** and **kivymd** libraries
You can do it in a way provided by [PyCharm](https://www.jetbrains.com/pycharm/) (File -> Settings -> Project: your_project_name -> Python Interpreter)
or on your own using Terminal
````
pip install "kivy[base] @https://github.com/kivy/kivy/archive/master.zip"
pip install https://github.com/kivymd/KivyMD/archive/master.zip
````