Kivy layout that adapts dimensions based off children elements.
Bash Variables
_module_name='adaptive-grid-layout'
_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}"
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
Incorporate the adaptive-grid-layout.kv
file within some layout...
kivi/some_screen.kv
#:include lib/modules/adaptive_grid_layout/adaptive-grid-layout.kv
Some_Screen:
id: Some_Screen
name: 'Some Screen'
group: 'screens'
ScrollView:
Adaptive_GridLayout:
cols: 1
id: Some_GridLayout
size_hint_y: None
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_grid_layout import Adaptive_GridLayout
class Some_Screen(Screen):
def __init__(self, arg):
super(Some_Screen, self).__init__()
def attach_adaptive_grid(self, grid_id, parent, clear = False):
if clear:
parent.clear_widgets(children = parent.children)
new_grid = Adaptive_GridLayout(cols = 1, id = grid_id, grow_rows = True, size_hint_y = None)
return parent.add_widget(new_grid)
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.
git add .gitmodules
git add lib/modules/adaptive-grid-layout
## Add any changed files too
git commit -F- <<'EOF'
:heavy_plus_sign: Adds `kivy-utilities/adaptive-grid-layout#1` submodule
**Additions**
- `.gitmodules`, tracks submodules AKA Git within Git _fanciness_
- `README.md`, updates installation and updating guidance
- `lib/modules/adaptive-grid-layout`, 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!
To ensure that Kivy honors height
and/or width
set size_hint_y
and/or size_hint_x
for each element within layout.
The trigger_refresh_y_dimension()
method may be called to force an update of layout hight.
Set both rows
and cols
to enable grow_cols
or grow_rows
within on_children
method.
Python requires a __init__.py
within each directory that may be imported...
touch lib/__init__.py
touch lib/modules/__init__.py
Legal bits of Open Source software
Adaptive Grid Layout 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/>.