diff --git a/examples/text/pango_demo.py b/examples/text/pango_demo.py index 4f556ab5d..9aa8de65f 100644 --- a/examples/text/pango_demo.py +++ b/examples/text/pango_demo.py @@ -4,11 +4,13 @@ from kivy.base import runTouchApp from kivy.lang import Builder from kivy.factory import Factory as F + class DemoBox(F.ButtonBehavior, F.BoxLayout): base_direction = F.StringProperty(None, allownone=True) font_context = F.StringProperty(None, allownone=True) font_size = F.NumericProperty(10) + runTouchApp(Builder.load_string(''' #:import F kivy.factory.Factory : @@ -79,8 +81,10 @@ runTouchApp(Builder.load_string(''' pop.text = lbl.text pop.ids.ti.halign = root.halign pop.ids.ti.font_size = root.font_size - pop.ids.ti.font_context = root.font_context != 'None' and root.font_context or None - pop.ids.ti.base_direction = root.base_direction != 'None' and root.base_direction or None + pop.ids.ti.font_context = root.font_context != 'None' \ + and root.font_context or None + pop.ids.ti.base_direction = root.base_direction != 'None' \ + and root.base_direction or None pop.title = 'Edit: {}'.format(root.language) pop.open() Label: @@ -105,8 +109,10 @@ runTouchApp(Builder.load_string(''' halign: root.halign text: root.text markup: root.markup - font_context: root.font_context != 'None' and root.font_context or None - base_direction: root.base_direction != 'None' and root.base_direction or None + font_context: root.font_context != 'None' and \ + root.font_context or None + base_direction: root.base_direction != 'None' and \ + root.base_direction or None font_size: root.font_size text_size: self.width, None canvas.before: @@ -120,7 +126,8 @@ runTouchApp(Builder.load_string(''' halign: root.halign cursor_width: 3 font_context: root.font_context != 'None' and root.font_context or None - base_direction: root.base_direction != 'None' and root.base_direction or None + base_direction: root.base_direction != 'None' and \ + root.base_direction or None font_size: root.font_size BoxLayout: orientation: 'vertical' @@ -138,7 +145,9 @@ BoxLayout: DemoBox: markup: True language: 'Arabic' - text: 'اَلْحَمْدُ لِلّٰهِ رَبِّ [color=ff0000]الْعَالَمِينَ\\nاَلرَّحْ[/color]مٰنِ الرَّحِيمِ' + text: 'اَلْحَمْدُ لِلّٰهِ رَبِّ \ + [color=ff0000]الْعَالَمِينَ\ + \\nاَلرَّحْ[/color]مٰنِ الرَّحِيمِ' DemoBox: language: 'Arabic + English' text: 'اِيَّاكَ نَعْبُدُ Kivyوَ اِيَّاكَ نَسْتَعِينُ\\nKivy' @@ -147,7 +156,8 @@ BoxLayout: text: 'Kivy\\nاِيَّاكَ نَعْبُدُ وَKivy اِيَّاكَ نَسْتَعِينُ' DemoBox: language: 'Hebrew' - text: 'בְּרֵאשִׁ֖ית בָּרָ֣א \\nאֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃' + text: 'בְּרֵאשִׁ֖ית בָּרָ֣א \ + \\nאֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃' DemoBox: language: 'Hebrew + English' text: 'בְּרֵאKivyשִׁ֖ית בָּרָ֣א \\nKivy' @@ -180,7 +190,8 @@ BoxLayout: text: ' འ Kivyབྲུག་རྒྱལ་ཁབ\\n་འདི་དགKivyའ་ཏོག་ཏོ་ཡོད།' DemoBox: language: 'English + Tibetan' - text: 'Regular letters\\n འབྲུག་རྒྱལ་ཁབ་འདི་དགའ་Kivyཏོག་ཏོ་ཡོད།' + text: 'Regular letters\\n\ + འབྲུག་རྒྱལ་ཁབ་འདི་དགའ་Kivyཏོག་ཏོ་ཡོད།' DemoBox: language: 'Braille (EN)' text: '⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀\\n⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑' @@ -190,7 +201,8 @@ BoxLayout: DemoBox: markup: True language: 'Braille (EN) + English' - text: '⠊⠀⠉⠁⠝⠀⠑⠁⠞Kivy\\n⠀⠛⠇⠁⠎⠎⠀⠁⠝Kivy⠙⠀⠊⠞⠀[color=ff0000]⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑[/color]' + text: '⠊⠀⠉⠁⠝⠀⠑⠁⠞Kivy\\n⠀⠛⠇⠁⠎⠎⠀⠁⠝Kivy\ + ⠙⠀⠊⠞⠀[color=ff0000]⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑[/color]' # --------------------------------------- HALIGN BoxLayout: __boxes: boxes diff --git a/kivy/core/camera/camera_android.py b/kivy/core/camera/camera_android.py index 3976a3ce1..df61ba068 100644 --- a/kivy/core/camera/camera_android.py +++ b/kivy/core/camera/camera_android.py @@ -67,7 +67,7 @@ class CameraAndroid(CameraBase): self._android_camera.setPreviewTexture(self._surface_texture) self._fbo = Fbo(size=self._resolution) - self._fbo['resolution'] = (float(width),float(height)) + self._fbo['resolution'] = (float(width), float(height)) self._fbo.shader.fs = ''' #extension GL_OES_EGL_image_external : require #ifdef GL_ES @@ -85,7 +85,8 @@ class CameraAndroid(CameraBase): void main() { - vec2 coord = vec2(tex_coord0.y*(resolution.y/resolution.x),1.-tex_coord0.x); + vec2 coord = vec2(tex_coord0.y * ( + resolution.y / resolution.x), 1. -tex_coord0.x); gl_FragColor = texture2D(texture1, tex_coord0); } ''' diff --git a/kivy/core/image/__init__.py b/kivy/core/image/__init__.py index cc6b84379..e4da2843b 100644 --- a/kivy/core/image/__init__.py +++ b/kivy/core/image/__init__.py @@ -77,9 +77,9 @@ class ImageData(object): ''' __slots__ = ('fmt', 'mipmaps', 'source', 'flip_vertical', 'source_image') - _supported_fmts = ('rgb', 'bgr', 'rgba', 'bgra', 'argb', 'abgr', 's3tc_dxt1', - 's3tc_dxt3', 's3tc_dxt5', 'pvrtc_rgb2', 'pvrtc_rgb4', - 'pvrtc_rgba2', 'pvrtc_rgba4', 'etc1_rgb8') + _supported_fmts = ('rgb', 'bgr', 'rgba', 'bgra', 'argb', 'abgr', + 's3tc_dxt1', 's3tc_dxt3', 's3tc_dxt5', 'pvrtc_rgb2', + 'pvrtc_rgb4', 'pvrtc_rgba2', 'pvrtc_rgba4', 'etc1_rgb8') def __init__(self, width, height, fmt, data, source=None, flip_vertical=True, source_image=None, @@ -906,10 +906,10 @@ class Image(EventDispatcher): bgr_flag = False if data.fmt == 'argb': - color.reverse() # bgra + color.reverse() # bgra bgr_flag = True elif data.fmt == 'abgr': - color.reverse() # rgba + color.reverse() # rgba # conversion for BGR->RGB, BGRA->RGBA format if bgr_flag or data.fmt in ('bgr', 'bgra'): diff --git a/kivy/core/text/text_pango.py b/kivy/core/text/text_pango.py index c9aac888b..b791a84df 100644 --- a/kivy/core/text/text_pango.py +++ b/kivy/core/text/text_pango.py @@ -12,8 +12,8 @@ Pango text provider Installation ------------ -1. Install pangoft2 (`apt install libfreetype6-dev libpango1.0-dev libpangoft2-1.0-0`) - or ensure it is available in pkg-config +1. Install pangoft2 (`apt install libfreetype6-dev libpango1.0-dev + libpangoft2-1.0-0`) or ensure it is available in pkg-config 2. Recompile kivy. Check that pangoft2 is found `use_pangoft2 = 1` 3. Test it! Enforce the text core renderer to pango using environment variable: `export KIVY_TEXT=pango` diff --git a/kivy/uix/colorpicker.py b/kivy/uix/colorpicker.py index edb440fb9..e1fb7e770 100644 --- a/kivy/uix/colorpicker.py +++ b/kivy/uix/colorpicker.py @@ -279,7 +279,8 @@ class ColorWheel(Widget): # _hsv based on the selected ColorArc piece = int((theta / (2 * pi)) * self._pieces_of_pie) division = int((r / self._radius) * self._piece_divisions) - hsva = list(self.arcs[self._pieces_of_pie * division + piece].color) + hsva = list( + self.arcs[self._pieces_of_pie * division + piece].color) self.color = list(hsv_to_rgb(*hsva[:3])) + hsva[-1:] def _get_touch_r(self, pos): @@ -384,7 +385,6 @@ class ColorPicker(RelativeLayout): self.set_color(value) hsv = AliasProperty(_get_hsv, _set_hsv, bind=('color', )) - #hsv = ListProperty((1, 1, 1)) '''The :attr:`hsv` holds the color currently selected in hsv format. :attr:`hsv` is a :class:`~kivy.properties.ListProperty` and defaults to