Skip to content

Commit

Permalink
Merge pull request #1 from kivy/master
Browse files Browse the repository at this point in the history
from master to my fork
  • Loading branch information
DerThorsten committed Feb 29, 2016
2 parents 62ba255 + 4789b54 commit 55bc27b
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 69 deletions.
47 changes: 22 additions & 25 deletions .travis.yml
Expand Up @@ -8,8 +8,7 @@ matrix:
dist: trusty
- language: python
python: 3.5
env:
- RUN=unit COVERALLS=true
env: RUN=unit COVERALLS=true
os: linux
dist: trusty
- language: python
Expand All @@ -23,10 +22,10 @@ matrix:
os: linux
dist: trusty
- language: generic
env: RUN=build PY=2
env: RUN=unit PY=2
os: osx
- language: generic
env: RUN=build PY=3
env: RUN=unit PY=3
os: osx

install:
Expand Down Expand Up @@ -95,10 +94,10 @@ before_script:
export PYTHONPATH=$PYTHONPATH:$(pwd);
fi;
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
export USE_SDL2=1;
export CC=clang;
export CXX=clang;
export FFLAGS=-ff2c;
export USE_OPENGL_MOCK=1;
fi;

script:
Expand All @@ -116,12 +115,10 @@ script:
fi;
if [ "${RUN}" == "docs" ]; then
make html;
make pdf || true;
make pdf;
fi;
fi;
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
export USE_OPENGL_MOCK=1;
if [ "${PY}" == "3" ]; then
python3 setup.py build_ext --inplace;
python3 -m nose.core kivy/tests;
Expand All @@ -133,24 +130,24 @@ script:


after_success:
- if [ "${TRAVIS_OS_NAME}" == "os" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
openssl aes-256-cbc -K $encrypted_675f1a0c317c_key -iv $encrypted_675f1a0c317c_iv -in ./kivy/tools/travis/id_rsa.enc -out ~/.ssh/id_rsa -d;
chmod 600 ~/.ssh/id_rsa;
echo -e "Host kivy.org\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config;
git clone https://github.com/kivy/kivy-sdk-packager;
cd kivy-sdk-packager/osx;
if [ "${PY}" == "3" ]; then
yes | ./create-osx-bundle.sh python3 master > output.txt;
mv Kivy.app Kivy3.app;
/Volumes/Keka/Keka.app/Contents/Resources/keka7z a Kivy3.7z Kivy3.app;
rsync --delete --force -r -e ssh ./Kivy3.7z kivy@kivy.org:~/kivy.org/downloads/tests/Kivy3.7z;
else
./create-osx-bundle.sh python2 master > output.txt;
mv Kivy.app Kivy2.app;
/Volumes/Keka/Keka.app/Contents/Resources/keka7z a Kivy2.7z Kivy2.app;
rsync --delete --force -r -e ssh ./Kivy2.7z kivy@kivy.org:~/kivy.org/downloads/tests/Kivy2.7z;
fi;
fi;
# - if [ "${TRAVIS_OS_NAME}" == "osx" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
# openssl aes-256-cbc -K $encrypted_675f1a0c317c_key -iv $encrypted_675f1a0c317c_iv -in ./kivy/tools/travis/id_rsa.enc -out ~/.ssh/id_rsa -d;
# chmod 600 ~/.ssh/id_rsa;
# echo -e "Host kivy.org\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config;
# git clone https://github.com/kivy/kivy-sdk-packager;
# cd kivy-sdk-packager/osx;
# if [ "${PY}" == "3" ]; then
# yes | ./create-osx-bundle.sh python3 master > output.txt;
# mv Kivy.app Kivy3.app;
# /Volumes/Keka/Keka.app/Contents/Resources/keka7z a Kivy3.7z Kivy3.app;
# rsync --delete --force -r -e ssh ./Kivy3.7z kivy@kivy.org:~/kivy.org/downloads/tests/Kivy3.7z;
# else
# ./create-osx-bundle.sh python2 master > output.txt;
# mv Kivy.app Kivy2.app;
# /Volumes/Keka/Keka.app/Contents/Resources/keka7z a Kivy2.7z Kivy2.app;
# rsync --delete --force -r -e ssh ./Kivy2.7z kivy@kivy.org:~/kivy.org/downloads/tests/Kivy2.7z;
# fi;
# fi;
- if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ "${RUN}" == "docs" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ] && [ "${TRAVIS_BRANCH}" == "master" ]; then
openssl aes-256-cbc -K $encrypted_675f1a0c317c_key -iv $encrypted_675f1a0c317c_iv -in ./kivy/tools/travis/id_rsa.enc -out ~/.ssh/id_rsa -d;
chmod 600 ~/.ssh/id_rsa;
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -64,7 +64,7 @@ ios:
cp -R "iosbuild/usr/local/lib/python2.7/site-packages/kivy" "$(BUILDROOT)/python/lib/python2.7/site-packages"

pdf: build
cd doc && $(MAKE) pdf
-cd doc && $(MAKE) pdf
cd doc && $(MAKE) pdf

html: build
Expand Down
3 changes: 3 additions & 0 deletions kivy/factory_registers.py
Expand Up @@ -37,6 +37,9 @@
r('ReferenceListProperty', module='kivy.properties')
r('AliasProperty', module='kivy.properties')
r('NumericProperty', module='kivy.properties')
r('DictProperty', module='kivy.properties')
r('VariableListProperty', module='kivy.properties')
r('ConfigParserProperty', module='kivy.properties')
r('Property', module='kivy.properties')
r('SafeList', module='kivy.utils')
r('Vector', module='kivy.vector')
Expand Down
7 changes: 6 additions & 1 deletion kivy/input/providers/wm_touch.py
Expand Up @@ -14,7 +14,8 @@
TOUCHEVENTF_MOVE, SM_CYCAPTION)
from kivy.input.motionevent import MotionEvent
from kivy.input.shape import ShapeRect
from kivy.core.window import Window

Window = None


class WM_MotionEvent(MotionEvent):
Expand Down Expand Up @@ -134,6 +135,10 @@ class RECT(Structure):
class WM_MotionEventProvider(MotionEventProvider):

def start(self):
global Window
if not Window:
from kivy.core.window import Window

self.touch_events = deque()
self.touches = {}
self.uid = 0
Expand Down
46 changes: 22 additions & 24 deletions kivy/uix/gridlayout.py
Expand Up @@ -198,7 +198,8 @@ class GridLayout(Layout):
'''

cols_minimum = DictProperty({})
'''List of minimum sizes for each column.
'''Dict of minimum width for each column. The dictionary keys are the
column numbers, e.g. 0, 1, 2...
.. versionadded:: 1.0.7
Expand All @@ -207,7 +208,8 @@ class GridLayout(Layout):
'''

rows_minimum = DictProperty({})
'''List of minimum sizes for each row.
'''Dict of minimum height for each row. The dictionary keys are the
row numbers, e.g. 0, 1, 2...
.. versionadded:: 1.0.7
Expand All @@ -216,31 +218,32 @@ class GridLayout(Layout):
'''

minimum_width = NumericProperty(0)
'''Minimum width needed to contain all children.
'''Automatically computed minimum width needed to contain all children.
.. versionadded:: 1.0.8
:attr:`minimum_width` is a :class:`~kivy.properties.NumericProperty` and
defaults to 0.
defaults to 0. It is read only.
'''

minimum_height = NumericProperty(0)
'''Minimum height needed to contain all children.
'''Automatically computed minimum height needed to contain all children.
.. versionadded:: 1.0.8
:attr:`minimum_height` is a :class:`~kivy.properties.NumericProperty` and
defaults to 0.
defaults to 0. It is read only.
'''

minimum_size = ReferenceListProperty(minimum_width, minimum_height)
'''Minimum size needed to contain all children.
'''Automatically computed minimum size needed to contain all children.
.. versionadded:: 1.0.8
:attr:`minimum_size` is a
:class:`~kivy.properties.ReferenceListProperty` of
(:attr:`minimum_width`, :attr:`minimum_height`) properties.
(:attr:`minimum_width`, :attr:`minimum_height`) properties. It is read
only.
'''

def __init__(self, **kwargs):
Expand Down Expand Up @@ -391,14 +394,10 @@ def do_layout(self, *largs):
for index in range(len(cols)):
# if the col don't have strech information, nothing to do
col_stretch = cols_sh[index]
if col_stretch is None:
if not col_stretch:
continue
# calculate the column stretch, and take the maximum from
# minimum size and the calculated stretch
col_width = cols[index]
col_width = max(col_width,
strech_w * col_stretch / cols_weigth)
cols[index] = col_width
# add to the min width whatever remains from size_hint
cols[index] += strech_w * col_stretch / cols_weigth

# same algo for rows
if self.row_force_default:
Expand All @@ -413,14 +412,10 @@ def do_layout(self, *largs):
for index in range(len(rows)):
# if the row don't have strech information, nothing to do
row_stretch = rows_sh[index]
if row_stretch is None:
if not row_stretch:
continue
# calculate the row stretch, and take the maximum from minimum
# size and the calculated stretch
row_height = rows[index]
row_height = max(row_height,
strech_h * row_stretch / rows_weigth)
rows[index] = row_height
# add to the min height whatever remains from size_hint
rows[index] += strech_h * row_stretch / rows_weigth

# reposition every child
i = len_children - 1
Expand All @@ -433,8 +428,11 @@ def do_layout(self, *largs):
c = children[i]
c.x = x
c.y = y - row_height
c.width = col_width
c.height = row_height
shx, shy = c.size_hint
if shx is not None:
c.width = col_width
if shy is not None:
c.height = row_height
i = i - 1
x = x + col_width + spacing_x
y -= row_height + spacing_y
2 changes: 1 addition & 1 deletion kivy/uix/listview.py
Expand Up @@ -703,7 +703,7 @@ def __init__(self, **kwargs):
if cls_kwargs:
cls_kwargs['index'] = index

if 'text' not in cls_kwargs:
if 'text' not in cls_kwargs and text:
cls_kwargs['text'] = text

if 'is_representing_cls' in cls_kwargs:
Expand Down
5 changes: 3 additions & 2 deletions kivy/uix/slider.py
Expand Up @@ -117,13 +117,14 @@ def get_norm_value(self):

def set_norm_value(self, value):
vmin = self.min
vmax = self.max
step = self.step
val = value * (self.max - vmin) + vmin
val = min(value * (vmax - vmin) + vmin, vmax)
if step == 0:
self.value = val
else:
self.value = min(round((val - vmin) / step) * step + vmin,
self.max)
vmax)
value_normalized = AliasProperty(get_norm_value, set_norm_value,
bind=('value', 'min', 'max', 'step'))
'''Normalized value inside the :attr:`range` (min/max) to 0-1 range::
Expand Down
38 changes: 23 additions & 15 deletions kivy/uix/textinput.py
Expand Up @@ -447,7 +447,6 @@ class TextInput(FocusBehavior, Widget):

def __init__(self, **kwargs):
self.is_focusable = kwargs.get('is_focusable', True)
self._cursor_blink_time = Clock.get_time()
self._cursor = [0, 0]
self._selection = False
self._selection_finished = True
Expand Down Expand Up @@ -527,6 +526,8 @@ def handle_readonly(instance, value):
self._position_handles)
self._trigger_show_handles = Clock.create_trigger(
self._show_handles, .05)
self._trigger_cursor_reset = Clock.create_trigger(
self._reset_cursor_blink)
self._trigger_update_cutbuffer = Clock.create_trigger(
self._update_cutbuffer)
refresh_line_options()
Expand Down Expand Up @@ -1293,6 +1294,9 @@ def on_touch_down(self, touch):
if super(TextInput, self).on_touch_down(touch):
return True

if self.focus:
self._trigger_cursor_reset()

# Check for scroll wheel
if 'button' in touch.profile and touch.button.startswith('scroll'):
scroll_type = touch.button[6:]
Expand Down Expand Up @@ -1634,7 +1638,7 @@ def _on_textinput_focused(self, instance, value, *largs):
if value:
if (not (self.readonly or self.disabled) or _is_desktop and
self._keyboard_mode == 'system'):
Clock.schedule_interval(self._do_blink_cursor, 1 / 2.)
self._trigger_cursor_reset()
self._editable = True
else:
self._editable = False
Expand Down Expand Up @@ -1714,15 +1718,19 @@ def _get_text_width(self, text, tab_width, _label_cached):
return width

def _do_blink_cursor(self, dt):
# Callback called by the timer to blink the cursor, according to the
# last activity in the widget
b = (Clock.get_time() - self._cursor_blink_time)
self.cursor_blink = int(b * 2) % 2
# Callback for blinking the cursor.
self.cursor_blink = not self.cursor_blink

def _reset_cursor_blink(self, *args):
Clock.unschedule(self._do_blink_cursor)
self.cursor_blink = 0
Clock.schedule_interval(self._do_blink_cursor, .5)

def on_cursor(self, instance, value):
# When the cursor is moved, reset the activity timer, and update all
# the graphics.
self._cursor_blink_time = Clock.get_time()
# When the cursor is moved, reset cursor blinking to keep it showing,
# and update all the graphics.
if self.focus:
self._trigger_cursor_reset()
self._trigger_update_graphics()

def _delete_line(self, idx):
Expand Down Expand Up @@ -2762,15 +2770,15 @@ def on_padding_y(self, instance, value):
'''

suggestion_text = StringProperty('')
'''Shows a suggestion text/word from currentcursor position onwards,
that can be used as a possible completion. Usefull for suggesting completion
text. This can also be used by the IME to setup the current word being
edited
'''Shows a suggestion text at the end of the current line.
The feature is useful for text autocompletion, and it does not implement
validation (accepting the suggested text on enter etc.).
This can also be used by the IME to setup the current word being edited.
.. versionadded:: 1.9.0
:attr:`suggestion_text` is a :class:`~kivy.properties.StringProperty`
defaults to `''`
:attr:`suggestion_text` is a :class:`~kivy.properties.StringProperty` and
defaults to `''`.
'''

def on_suggestion_text(self, instance, value):
Expand Down

0 comments on commit 55bc27b

Please sign in to comment.