Skip to content

kivy-utilities/adaptive-text-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Adaptive Text Input

Kivy layout that adapts dimensions based off text volume and active state.

Byte size of adaptive-text-input.py Open Issues Open Pull Requests Latest commits


Table of Contents


Quick Start

Bash Variables

_module_name='adaptive-text-input'
_module_https_url="https://github.com/kivy-utilities/${_module_name}.git"
_module_relative_path="lib/modules/${_module_name//-/_}"

Bash Submodule Commands

cd "<your-git-project-path>"
mkdir -vp "lib/modules"

git submodule add\
 -b master --name "${_module_name}"\
 "${_module_https_url}" "${_module_relative_path}"

Your ReadMe File

Suggested additions for your ReadMe.md file so everyone has a good time with submodules

Clone with the following to avoid incomplete downloads


    git clone --recurse-submodules <url-for-your-project>


Update/upgrade submodules via


    git submodule update --init --merge --recursive

Utilize Adaptive Text Input

Incorporate the adaptive-text-input.kv file within some layout...

kivi/some_screen.kv

#:include lib/adaptive_text_input/adaptive-text-input.kv


Some_Screen:
  id: Some_Screen
  name: 'Some Screen'
  group: 'screens'

  ScrollView:
    GridLayout:
      cols: 1
      id: Some_GridLayout

      Adaptive_TextInput:
        synopsis_line_limit: 2
        id: Some_TextInput

And/or import and utilize Python class directly...

lib/some_screen.py

#!/usr/bin/env python


from kivy.uix.screenmanager import Screen

from lib.modules.adaptive_text_input import Adaptive_TextInput


class Some_Screen(Screen):
  def __init__(self, arg):
    super(Some_Screen, self).__init__()

  def attach_adaptive_text_input(self, input_id, parent, clear = False):
    if clear:
      parent.clear_widgets(children = parent.children)

    new_text_input = Adaptive_TextInput(synopsis_line_limit = 2, id = input_id)
    return parent.add_widget(new_text_input)

Test that things operate as expected and if it's a bug report it as such, otherwise an adjustment of expectations and/or code may be necessary.

Commit and Push

git add .gitmodules
git add lib/modules/adaptive-text-input


## Add any changed files too


git commit -F- <<'EOF'
:heavy_plus_sign: Adds `kivy-utilities/adaptive-text-input#1` submodule



**Additions**


- `.gitmodules`, tracks submodules AKA Git within Git _fanciness_

- `README.md`, updates installation and updating guidance

- `lib/modules/adaptive-text-input`, builds list of pages for a named collection
EOF


git push origin master

🎉 Excellent 🎉 your site is now ready to begin unitizing code from this repository!


Notes

To ensure that Kivy honors height and/or width set size_hint_y and/or size_hint_x to None for each element within layout.

Fonts and Unicode may cause spacing and sizing to become a bit fiddly; or in other words code is not fully tested for internationalization.

To make full use of this project consider utilizing the Adaptive_GridLayout source code within projects make use of Adaptive_TextInput layouts.

Some portions of logic may seem illogical, please open Pull Requests to correct bugs and/or add features.

Python requires a __init__.py within each directory that may be imported...

touch lib/__init__.py
touch lib/modules/__init__.py

License

Legal bits of Open Source software

Adaptive Text Input ReadMe documenting how things like this could be utilized
Copyright (C) 2019  S0AndS0

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation; version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

About

Kivy layout that adapts dimensions based off text volume and active state.

Resources

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages