From 02c30a4e9fa8fe17fbe16632c974de2a57eace3b Mon Sep 17 00:00:00 2001 From: Charles Merriam Date: Sun, 1 Feb 2015 17:09:20 -0800 Subject: [PATCH] Fix examples/ PEP8 errors. Mostly white space. This fixes a large number of white space errors in the examples/ directory. When I upgraded Makefile to check the 'make style' on the examples directory, the output was hundreds of lines long. Currently, the output is managable and consists solely of "lines too long", as kv lines cannot be split. This commit touches an obscene number of files in trivial ways. --- examples/3Drendering/main.py | 6 +- examples/RST_Editor/main.py | 8 +- examples/android/compass/main.py | 3 +- examples/android/takepicture/main.py | 13 +- examples/animation/animate.py | 2 +- examples/application/app_suite.py | 44 ++-- examples/audio/main.py | 6 +- examples/camera/main.py | 4 +- examples/canvas/bezier.py | 11 +- examples/canvas/canvas_stress.py | 4 +- examples/canvas/circle.py | 12 +- examples/canvas/fbo_canvas.py | 8 +- examples/canvas/lines.py | 4 +- examples/canvas/lines_extended.py | 16 +- examples/canvas/mesh.py | 4 +- examples/canvas/rotation.py | 1 + examples/canvas/stencil_canvas.py | 2 +- examples/canvas/tesselate.py | 3 +- examples/canvas/texture.py | 2 +- examples/demo/camera_puzzle.py | 10 +- examples/demo/pictures/main.py | 2 +- examples/demo/shadereditor/main.py | 3 + examples/demo/touchtracer/main.py | 2 +- .../frameworks/twisted/echo_client_app.py | 5 +- .../frameworks/twisted/echo_server_app.py | 12 +- examples/gestures/gesture_board.py | 23 +- examples/gestures/my_gestures.py | 16 +- examples/guide/firstwidget/2_print_touch.py | 1 + examples/guide/quickstart/main.py | 2 +- examples/includes/main.py | 2 +- examples/keyboard/main.py | 3 +- examples/kv/kvrun.py | 1 + examples/shader/plasma.py | 8 +- examples/svg/benchmark.py | 3 +- examples/svg/main-smaa.py | 6 +- examples/svg/main.py | 2 +- examples/tutorials/notes/final/main.py | 1 - examples/widgets/accordion_1.py | 1 + examples/widgets/asyncimage.py | 2 +- examples/widgets/boxlayout_poshint.py | 1 + examples/widgets/carousel_buttons.py | 2 + examples/widgets/codeinput.py | 7 +- examples/widgets/colorpicker.py | 22 +- examples/widgets/image_mipmap.py | 1 + examples/widgets/label_mipmap.py | 1 + examples/widgets/label_text_size.py | 26 +- examples/widgets/label_with_markup.py | 1 + examples/widgets/lists/fixtures.py | 223 ++++++++++-------- examples/widgets/lists/list_composite.py | 32 +-- examples/widgets/lists/list_ops.py | 5 +- examples/widgets/popup_with_kv.py | 2 + examples/widgets/rstexample.py | 1 + examples/widgets/scatter.py | 2 + examples/widgets/scrollview.py | 3 +- examples/widgets/sequenced_images/main.py | 85 +++---- .../sequenced_images/uix/custom_button.py | 31 ++- examples/widgets/shorten_text.py | 1 + examples/widgets/spinner.py | 1 + examples/widgets/tabbedpanel.py | 2 + examples/widgets/unicode_textinput.py | 12 +- examples/widgets/videoplayer.py | 1 + 61 files changed, 412 insertions(+), 308 deletions(-) diff --git a/examples/3Drendering/main.py b/examples/3Drendering/main.py index 474b29c317..a1272c0a75 100644 --- a/examples/3Drendering/main.py +++ b/examples/3Drendering/main.py @@ -2,13 +2,13 @@ 3Drendering Example ================= -This example demonstrates using OpenGL to display rotating monkey head. This +This example demonstrates using OpenGL to display rotating monkey head. This includes loading a Blender OBJ file, shaders written in OpenGL's Shading Language (GLSL), and using scheduled callbacks. The file monkey.obj is a OBJ file output form the Blender free 3D creation -software. The file is text, listing vertices and faces. It is loaded -into a scene using objloader.py's ObjFile class. The file simple.glsl is +software. The file is text, listing vertices and faces. It is loaded +into a scene using objloader.py's ObjFile class. The file simple.glsl is a simple vertex and fragment shader written in GLSL. ''' diff --git a/examples/RST_Editor/main.py b/examples/RST_Editor/main.py index aa5f59bbd1..0a978ea262 100644 --- a/examples/RST_Editor/main.py +++ b/examples/RST_Editor/main.py @@ -7,6 +7,7 @@ import os + class LoadDialog(FloatLayout): load = ObjectProperty(None) cancel = ObjectProperty(None) @@ -28,12 +29,14 @@ def dismiss_popup(self): def show_load(self): content = LoadDialog(load=self.load, cancel=self.dismiss_popup) - self._popup = Popup(title="Load file", content=content, size_hint=(0.9, 0.9)) + self._popup = Popup(title="Load file", content=content, + size_hint=(0.9, 0.9)) self._popup.open() def show_save(self): content = SaveDialog(save=self.save, cancel=self.dismiss_popup) - self._popup = Popup(title="Save file", content=content, size_hint=(0.9, 0.9)) + self._popup = Popup(title="Save file", content=content, + size_hint=(0.9, 0.9)) self._popup.open() def load(self, path, filename): @@ -52,7 +55,6 @@ def save(self, path, filename): class Editor(App): pass - Factory.register('Root', cls=Root) Factory.register('LoadDialog', cls=LoadDialog) Factory.register('SaveDialog', cls=SaveDialog) diff --git a/examples/android/compass/main.py b/examples/android/compass/main.py index c258a96508..4e7818ee23 100644 --- a/examples/android/compass/main.py +++ b/examples/android/compass/main.py @@ -16,7 +16,6 @@ ./build.py --package org.test.compass --name compass \ --private ~/code/kivy/examples/android/compass \ --window --version 1.0 debug installd - ''' @@ -47,7 +46,7 @@ def update_compass(self, *args): (x, y, z) = Hardware.magneticFieldSensorReading() # calculate the angle - needle_angle = Vector(x , y).angle((0, 1)) + 90. + needle_angle = Vector(x, y).angle((0, 1)) + 90. # animate the needle if self._anim: diff --git a/examples/android/takepicture/main.py b/examples/android/takepicture/main.py index ecfbc55d23..7a0391953e 100644 --- a/examples/android/takepicture/main.py +++ b/examples/android/takepicture/main.py @@ -35,7 +35,7 @@ PythonActivity = autoclass('org.renpy.android.PythonActivity') MediaStore = autoclass('android.provider.MediaStore') Uri = autoclass('android.net.Uri') -Environment = autoclass('android.os.Environment') +Environment = autoclass('android.os.Environment') class Picture(Scatter): @@ -50,10 +50,10 @@ def build(self): def get_filename(self): while True: self.index += 1 - fn = Environment.getExternalStorageDirectory().getPath()+'/takepicture{}.jpg'.format(self.index) + fn = (Environment.getExternalStorageDirectory().getPath() + + '/takepicture{}.jpg'.format(self.index)) if not exists(fn): return fn - def take_picture(self): intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) @@ -62,7 +62,7 @@ def take_picture(self): self.uri = cast('android.os.Parcelable', self.uri) intent.putExtra(MediaStore.EXTRA_OUTPUT, self.uri) PythonActivity.mActivity.startActivityForResult(intent, 0x123) - + def on_activity_result(self, requestCode, resultCode, intent): if requestCode == 0x123: Clock.schedule_once(partial(self.add_picture, self.last_fn), 0) @@ -70,11 +70,10 @@ def on_activity_result(self, requestCode, resultCode, intent): def add_picture(self, fn, *args): im = Image.open(fn) width, height = im.size - im.thumbnail( (width/4,height/4) , Image.ANTIALIAS) - im.save(fn,quality=95) + im.thumbnail((width / 4, height / 4), Image.ANTIALIAS) + im.save(fn, quality=95) self.root.add_widget(Picture(source=fn, center=self.root.center)) - def on_pause(self): return True diff --git a/examples/animation/animate.py b/examples/animation/animate.py index 31d3a7ab70..e918dd29a4 100644 --- a/examples/animation/animate.py +++ b/examples/animation/animate.py @@ -3,7 +3,7 @@ ================ This example demonstrates creating and applying a multi-part animation to -a button widget. You should see a button labelled 'plop' that will move with +a button widget. You should see a button labelled 'plop' that will move with an animation when clicked. ''' diff --git a/examples/application/app_suite.py b/examples/application/app_suite.py index bf319fd2c4..fcca457480 100644 --- a/examples/application/app_suite.py +++ b/examples/application/app_suite.py @@ -2,8 +2,8 @@ Application Suite ================= -Explore how applications start. Starts applications one after another, waiting for -each to be closed first. +Explore how applications start. Starts applications one after another, +waiting for each to be closed first. ''' from __future__ import print_function import sys @@ -11,7 +11,7 @@ from random import choice import kivy -kivy.require('1.8.0') # Minimum API as 1.8 is when kv_directory became part of app. +kivy.require('1.8.0') # 1.8 is when kv_directory became part of app. from kivy.app import App from kivy.uix.button import Button from kivy.lang import Builder @@ -21,6 +21,7 @@ # starting up the Logger and some other messages. print("** In main program, done with imports") + class TestBuildApp(App): """ Use build() function to return a widget. """ def build(self): @@ -31,38 +32,47 @@ def build(self): print("** inside build()") return Button(text='hello from TestBuildApp') -class TestKVFileApp(App): - """ Empty class, but name used to find .kv file. - The filename is the lowercase version of the class, i.e., - 'testkvfileapp.kv'. If not found, it strips off the final 'app', i.e., - 'testkvfile.kv'. - If not file is found, and no other method sets the self.root, the program will - run with an empty screen. """ +class TestKVFileApp(App): + """ + Empty class, but name used to find .kv file. The filename is the lowercase + version of the class, i.e., 'testkvfileapp.kv'. If not found, it strips + off the final 'app', i.e., 'testkvfile.kv'. If not file is found, and no + other method sets the self.root, the program will run with an empty screen. + """ pass + class TestKVDirApp(App): - """ Empty class except for setting class variable kv_directory. + """ + Empty class except for setting class variable kv_directory. This directory sets the directory in which to search for the .kv file. The name of the kv file is still governed by the class name and the .kv - file should still have one root widget. """ + file should still have one root widget. + """ kv_directory = 'app_suite_data' + class TestKVStringApp(App): - """ Use a build() function and use the kivy.lang.Builder function to parse up a - Kivy language string. """ + """ + Use a build() function and use the kivy.lang.Builder function to parse up a + Kivy language string. + """ def build(self): """ Called by kivy run(). """ print("** inside build()") - widget = Builder.load_string("Button:\n text: 'hello from TestKVStringApp'") + widget = Builder.load_string( + "Button:\n text: 'hello from TestKVStringApp'") print("** widget built") return widget + class TestPrebuiltApp(App): """ Use the Builder to create a top level widget at the beginning of the Python program, then use a dummy class for that widget. This costs a bit more in start-up time. """ - Builder.load_string("\n Button:\n text:'hello from TestPrebuiltApp'") + kv = "\n Button:\n text:'hello from TestPrebuiltApp'" + Builder.load_string(kv) print("** in TestPrebuiltApp, class initialization built ") class Prebuilt(FloatLayout): @@ -81,7 +91,7 @@ def print_class(class_name): with open(filename) as f: data = f.read() regex = "^(class " + class_name + "\\b.*?)^\\S" - match = re.search(regex, data, flags=re.MULTILINE|re.DOTALL) + match = re.search(regex, data, flags=re.MULTILINE | re.DOTALL) if match: print(match.group(1)) diff --git a/examples/audio/main.py b/examples/audio/main.py index 3af967b7b9..d5e459d40e 100644 --- a/examples/audio/main.py +++ b/examples/audio/main.py @@ -2,9 +2,9 @@ Audio example ============= -This example plays sounds of different formats. You should see a grid of -buttons labelled with filenames. Clicking on the buttons will play, or -restart, each sound. Not all sound formats will play on all platforms. +This example plays sounds of different formats. You should see a grid of +buttons labelled with filenames. Clicking on the buttons will play, or +restart, each sound. Not all sound formats will play on all platforms. All the sounds are from the http://woolyss.com/chipmusic-samples.php "THE FREESOUND PROJECT", Under Creative Commons Sampling Plus 1.0 License. diff --git a/examples/camera/main.py b/examples/camera/main.py index fb45964313..129a83e5ae 100644 --- a/examples/camera/main.py +++ b/examples/camera/main.py @@ -2,8 +2,8 @@ Camera Example ============== -This example demonstrates a simple use of the camera. It shows a window with -a buttoned labelled 'play' to turn the camera on and off. Note that +This example demonstrates a simple use of the camera. It shows a window with +a buttoned labelled 'play' to turn the camera on and off. Note that not finding a camera, perhaps because gstreamer is not installed, will throw an exception during the kv language processing. diff --git a/examples/canvas/bezier.py b/examples/canvas/bezier.py index 2a6278a77a..72e13bcd1a 100644 --- a/examples/canvas/bezier.py +++ b/examples/canvas/bezier.py @@ -3,9 +3,9 @@ Bezier Example ============== -This example shows a closed Bezier curve computed from a polygon. You +This example shows a closed Bezier curve computed from a polygon. You should see a purple polygon, a red bezier curve computed from the polygon, -and two sliders. You can drag points on the polygon to recompute the curve. +and two sliders. You can drag points on the polygon to recompute the curve. The two sliders control the dash length of the dashed lines making up the two shapes. @@ -37,7 +37,7 @@ def __init__(self, points=[], loop=False, *args, **kwargs): Color(1.0, 0.0, 1.0) self.line = Line( - points=self.points+self.points[:2], + points=self.points + self.points[:2], dash_offset=10, dash_length=100) @@ -61,8 +61,9 @@ def _set_line_dash_offset(self, instance, value): def on_touch_down(self, touch): if self.collide_point(touch.pos[0], touch.pos[1]): - for i, p in enumerate(list(zip(self.points[::2], self.points[1::2]))): - if ( abs(touch.pos[0] - self.pos[0] - p[0]) < self.d and + for i, p in enumerate(list(zip(self.points[::2], + self.points[1::2]))): + if (abs(touch.pos[0] - self.pos[0] - p[0]) < self.d and abs(touch.pos[1] - self.pos[1] - p[1]) < self.d): self.current_point = i + 1 return True diff --git a/examples/canvas/canvas_stress.py b/examples/canvas/canvas_stress.py index 034bbd4a91..9b039ddcb8 100644 --- a/examples/canvas/canvas_stress.py +++ b/examples/canvas/canvas_stress.py @@ -3,8 +3,8 @@ ============= This example tests the performance of our Graphics engine by drawing large -numbers of small sqaures. You should see a black canvas with buttons and a -label at the bottom. Pressing the buttons adds small colored squares to the +numbers of small sqaures. You should see a black canvas with buttons and a +label at the bottom. Pressing the buttons adds small colored squares to the canvas. ''' diff --git a/examples/canvas/circle.py b/examples/canvas/circle.py index 093dc1d320..4b464ffada 100644 --- a/examples/canvas/circle.py +++ b/examples/canvas/circle.py @@ -2,10 +2,10 @@ Circle Example ============== -This example exercises circle (ellipse) drawing. You should see sliders at the -top of the screen with the Kivy logo below it. The sliders control the -angle start and stop and the height and width scales. There is a button -to reset the sliders. The entire example is coded in the +This example exercises circle (ellipse) drawing. You should see sliders at the +top of the screen with the Kivy logo below it. The sliders control the +angle start and stop and the height and width scales. There is a button +to reset the sliders. The entire example is coded in the kv language description. ''' @@ -60,9 +60,8 @@ Button: text: 'Reset ratios' on_press: wm.value = 1; hm.value = 1 - + FloatLayout: - canvas: Color: rgb: 1, 1, 1 @@ -75,6 +74,7 @@ ''' + class CircleApp(App): def build(self): return Builder.load_string(kv) diff --git a/examples/canvas/fbo_canvas.py b/examples/canvas/fbo_canvas.py index bd7680fdf7..b18f4b01d5 100644 --- a/examples/canvas/fbo_canvas.py +++ b/examples/canvas/fbo_canvas.py @@ -3,8 +3,8 @@ ========== This demonstrates a layout using an FBO (Frame Buffer Off-screen) -instead of a plain canvas. You should see a black canvas with a -button labelled 'FBO' in the bottom left corner. Clicking it +instead of a plain canvas. You should see a black canvas with a +button labelled 'FBO' in the bottom left corner. Clicking it animates the button moving right to left. ''' @@ -34,7 +34,7 @@ def __init__(self, **kwargs): self.fbo_rect = Rectangle() with self.fbo: - ClearColor(0,0,0,0) + ClearColor(0, 0, 0, 0) ClearBuffers() # wait that all the instructions are in the canvas to set texture @@ -79,7 +79,7 @@ def build(self): def anim_btn(*args): if b.pos[0] == 0: - Animation(x=f.width-b.width).start(b) + Animation(x=f.width - b.width).start(b) else: Animation(x=0).start(b) b.bind(on_press=anim_btn) diff --git a/examples/canvas/lines.py b/examples/canvas/lines.py index 0f83b419ce..b20e5e31b7 100644 --- a/examples/canvas/lines.py +++ b/examples/canvas/lines.py @@ -3,11 +3,11 @@ ============================ This demonstrates the experimental and unfinished SmoothLine feature -for fast line drawing. You should see a multi-segment +for fast line drawing. You should see a multi-segment path at the top of the screen, and sliders and buttons along the bottom. You can click to add new points to the segment, change the transparency and width of the line, or hit 'Animate' to see a set of sine and cosine -animations. The Cap and Joint buttons don't work: SmoothLine has not +animations. The Cap and Joint buttons don't work: SmoothLine has not implemented these features yet. ''' diff --git a/examples/canvas/lines_extended.py b/examples/canvas/lines_extended.py index fc17563b7d..720fe06458 100644 --- a/examples/canvas/lines_extended.py +++ b/examples/canvas/lines_extended.py @@ -3,7 +3,7 @@ =================== This demonstrates how to use the extended line drawing routines such -as circles, elipses, and rectangles. You should see a static image of +as circles, elipses, and rectangles. You should see a static image of labelled shapes on the screen. ''' @@ -105,49 +105,55 @@ center: root.center text: 'Rectangle' - : canvas: Color: rgba: .1, .1, 1, .9 Line: width: 2. - bezier: (self.x, self.y, self.center_x - 40, self.y + 100, self.center_x + 40, self.y - 100, self.right, self.y) + bezier: (self.x, self.y, self.center_x - 40, self.y + 100, self.center_x + 40, self.y - 100, self.right, self.y) Label: center: root.center text: 'Bezier' - - ''') class LineEllipse1(Widget): pass + class LineEllipse2(Widget): pass + class LineEllipse3(Widget): pass + class LineCircle1(Widget): pass + class LineCircle2(Widget): pass + class LineCircle3(Widget): pass + class LineCircle4(Widget): pass + class LineRectangle(Widget): pass + class LineBezier(Widget): pass + class LineExtendedApp(App): def build(self): root = GridLayout(cols=2, padding=50, spacing=50) diff --git a/examples/canvas/mesh.py b/examples/canvas/mesh.py index 2769644284..a9d0921d07 100644 --- a/examples/canvas/mesh.py +++ b/examples/canvas/mesh.py @@ -2,8 +2,8 @@ Mesh test ========= -This demonstrates the use of a mesh mode to distort an image. You should see -a line of buttons across the bottom of a canvas. Pressing them displays +This demonstrates the use of a mesh mode to distort an image. You should see +a line of buttons across the bottom of a canvas. Pressing them displays the mesh, a small circle of points, with different mesh.mode settings. ''' diff --git a/examples/canvas/rotation.py b/examples/canvas/rotation.py index e328c3c2ac..19241f63f5 100644 --- a/examples/canvas/rotation.py +++ b/examples/canvas/rotation.py @@ -17,6 +17,7 @@ PopMatrix ''' + class RotationApp(App): def build(self): return Builder.load_string(kv) diff --git a/examples/canvas/stencil_canvas.py b/examples/canvas/stencil_canvas.py index c2b5042190..92ff878de7 100644 --- a/examples/canvas/stencil_canvas.py +++ b/examples/canvas/stencil_canvas.py @@ -31,7 +31,7 @@ def on_touch_down(self, touch): self.size = (1, 1) def on_touch_move(self, touch): - self.size = (touch.x-touch.ox, touch.y-touch.oy) + self.size = (touch.x - touch.ox, touch.y - touch.oy) class StencilCanvasApp(App): diff --git a/examples/canvas/tesselate.py b/examples/canvas/tesselate.py index f4c5d9f4f6..2ee0f4bdb1 100644 --- a/examples/canvas/tesselate.py +++ b/examples/canvas/tesselate.py @@ -116,7 +116,8 @@ def build(self): with self.canvas.after: Color(1, 1, 1, 1) for vertices, indices in tess.meshes: - Mesh(vertices=vertices, indices=indices, mode="triangle_fan") + Mesh(vertices=vertices, indices=indices, + mode="triangle_fan") self.ids.status.text = "Vertex: {} - Elements: {}".format( tess.vertex_count, tess.element_count) diff --git a/examples/canvas/texture.py b/examples/canvas/texture.py index aec1674124..d55c6b7ae2 100644 --- a/examples/canvas/texture.py +++ b/examples/canvas/texture.py @@ -107,7 +107,7 @@ def on_texture_wrap(self, instance, value): value: 1. on_value: taw.tex_coords[2] = self.value on_value: taw.tex_coords[4] = self.value - + BoxLayout: size_hint_y: None height: dp(50) diff --git a/examples/demo/camera_puzzle.py b/examples/demo/camera_puzzle.py index a357d7d002..c472b266f7 100644 --- a/examples/demo/camera_puzzle.py +++ b/examples/demo/camera_puzzle.py @@ -9,12 +9,14 @@ from random import randint, random from functools import partial + class Puzzle(Camera): blocksize = NumericProperty(100) def on_texture_size(self, instance, value): self.build() + def on_blocksize(self, instance, value): self.build() @@ -30,7 +32,8 @@ def build(self): bx = x * bs by = y * bs subtexture = texture.get_region(bx, by, bs, bs) - #node = PuzzleNode(texture=subtexture, size=(bs, bs), pos=(bx, by)) + #node = PuzzleNode(texture=subtexture, + # size=(bs, bs), pos=(bx, by)) node = Scatter(pos=(bx, by), size=(bs, bs)) with node.canvas: Color(1, 1, 1) @@ -51,7 +54,8 @@ def shuffle(self): x = bs * (index % int(tw / bs)) y = bs * int(index / int(tw / bs)) child = self.children[childindex] - a = Animation(d=random() / 4.) + Animation(pos=(x, y), t='out_quad', d=.4) + a = Animation(d=random() / 4.) + Animation(pos=(x, y), + t='out_quad', d=.4) a.start(child) childindex += 1 @@ -78,6 +82,4 @@ def on_value(self, puzzle, instance, value): puzzle.blocksize = value instance.value = value - - PuzzleApp().run() diff --git a/examples/demo/pictures/main.py b/examples/demo/pictures/main.py index 4caf05e21a..e5169938dd 100755 --- a/examples/demo/pictures/main.py +++ b/examples/demo/pictures/main.py @@ -44,7 +44,7 @@ def build(self): for filename in glob(join(curdir, 'images', '*')): try: # load the image - picture = Picture(source=filename, rotation=randint(-30,30)) + picture = Picture(source=filename, rotation=randint(-30, 30)) # add to the main field root.add_widget(picture) except Exception as e: diff --git a/examples/demo/shadereditor/main.py b/examples/demo/shadereditor/main.py index 51a4e19908..b3966f9839 100755 --- a/examples/demo/shadereditor/main.py +++ b/examples/demo/shadereditor/main.py @@ -47,6 +47,7 @@ uniform vec4 color; ''' + class ShaderViewer(FloatLayout): fs = StringProperty(None) vs = StringProperty(None) @@ -71,6 +72,7 @@ def on_vs(self, instance, value): Factory.register('ShaderViewer', cls=ShaderViewer) + class ShaderEditor(FloatLayout): source = StringProperty('data/logo/kivy-icon-512.png') @@ -108,6 +110,7 @@ def compile_shaders(self, *largs): print('-->', vs) self.viewer.vs = vs + class ShaderEditorApp(App): def build(self): kwargs = {} diff --git a/examples/demo/touchtracer/main.py b/examples/demo/touchtracer/main.py index 7c0c101c7f..05949aa8a2 100755 --- a/examples/demo/touchtracer/main.py +++ b/examples/demo/touchtracer/main.py @@ -88,7 +88,7 @@ def on_touch_move(self, touch): try: lp = ud['lines'][-1].add_point for idx in range(0, len(points), 2): - lp(points[idx], points[idx+1]) + lp(points[idx], points[idx + 1]) except GraphicException: pass diff --git a/examples/frameworks/twisted/echo_client_app.py b/examples/frameworks/twisted/echo_client_app.py index 5ce9d3d20f..4f392752c4 100644 --- a/examples/frameworks/twisted/echo_client_app.py +++ b/examples/frameworks/twisted/echo_client_app.py @@ -6,6 +6,7 @@ #A simple Client that send messages to the echo server from twisted.internet import reactor, protocol + class EchoClient(protocol.Protocol): def connectionMade(self): self.factory.app.on_connection(self.transport) @@ -13,8 +14,10 @@ def connectionMade(self): def dataReceived(self, data): self.factory.app.print_message(data) + class EchoFactory(protocol.ClientFactory): protocol = EchoClient + def __init__(self, app): self.app = app @@ -30,6 +33,7 @@ def clientConnectionFailed(self, conn, reason): from kivy.uix.textinput import TextInput from kivy.uix.boxlayout import BoxLayout + # A simple kivy App, with a textbox to enter messages, and # a large label to display all the messages received from # the server @@ -66,6 +70,5 @@ def send_message(self, *args): def print_message(self, msg): self.label.text += msg + "\n" - if __name__ == '__main__': TwistedClientApp().run() diff --git a/examples/frameworks/twisted/echo_server_app.py b/examples/frameworks/twisted/echo_server_app.py index 23d5087ef2..e08450c8c6 100644 --- a/examples/frameworks/twisted/echo_server_app.py +++ b/examples/frameworks/twisted/echo_server_app.py @@ -6,14 +6,17 @@ from twisted.internet import reactor from twisted.internet import protocol + class EchoProtocol(protocol.Protocol): def dataReceived(self, data): response = self.factory.app.handle_message(data) if response: self.transport.write(response) + class EchoFactory(protocol.Factory): protocol = EchoProtocol + def __init__(self, app): self.app = app @@ -21,6 +24,7 @@ def __init__(self, app): from kivy.app import App from kivy.uix.label import Label + class TwistedServerApp(App): def build(self): self.label = Label(text="server started\n") @@ -28,10 +32,12 @@ def build(self): return self.label def handle_message(self, msg): - self.label.text = "received: %s\n" % msg + self.label.text = "received: %s\n" % msg - if msg == "ping": msg = "pong" - if msg == "plop": msg = "kivy rocks" + if msg == "ping": + msg = "pong" + if msg == "plop": + msg = "kivy rocks" self.label.text += "responded: %s\n" % msg return msg diff --git a/examples/gestures/gesture_board.py b/examples/gestures/gesture_board.py index 9f31d19376..df21c66108 100644 --- a/examples/gestures/gesture_board.py +++ b/examples/gestures/gesture_board.py @@ -10,6 +10,7 @@ from my_gestures import cross, circle, check, square + def simplegesture(name, point_list): """ A simple helper function @@ -20,6 +21,7 @@ def simplegesture(name, point_list): g.name = name return g + class GestureBoard(FloatLayout): """ Our application main widget, derived from touchtracer example, use data @@ -43,7 +45,7 @@ def on_touch_down(self, touch): with self.canvas: Color(1, 1, 0) d = 30. - Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d)) + Ellipse(pos=(touch.x - d / 2, touch.y - d / 2), size=(d, d)) userdata['line'] = Line(points=(touch.x, touch.y)) return True @@ -58,10 +60,8 @@ def on_touch_move(self, touch): def on_touch_up(self, touch): # touch is over, display informations, and check if it matches some # known gesture. - g = simplegesture( - '', - list(zip(touch.ud['line'].points[::2], touch.ud['line'].points[1::2])) - ) + g = simplegesture('', list(zip(touch.ud['line'].points[::2], + touch.ud['line'].points[1::2]))) # gestures to my_gestures.py print("gesture representation:", self.gdb.gesture_to_str(g)) @@ -76,15 +76,20 @@ def on_touch_up(self, touch): print(g2) if g2: - if g2[1] == circle: print("circle") - if g2[1] == square: print("square") - if g2[1] == check: print("check") - if g2[1] == cross: print("cross") + if g2[1] == circle: + print("circle") + if g2[1] == square: + print("square") + if g2[1] == check: + print("check") + if g2[1] == cross: + print("cross") # erase the lines on the screen, this is a bit quick&dirty, since we # can have another touch event on the way... self.canvas.clear() + class DemoGesture(App): def build(self): return GestureBoard() diff --git a/examples/gestures/my_gestures.py b/examples/gestures/my_gestures.py index f8904c9b88..fd7f8512f4 100644 --- a/examples/gestures/my_gestures.py +++ b/examples/gestures/my_gestures.py @@ -3,14 +3,14 @@ gdb = GestureDat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6epx3m5/ny0V/uy1X4wamLaWVt+PeY7qfoQ8wG8wGvcKACjMGiDMsj/EDpApRB8gV0lhdKpSxulaoI7QKDQfoDfIAY4Cyyf4lc4lsJaSV4FotYYDzCd69bC6BfYloU5XUQ88GeYBLA9JD+6BfqX0J1VZtGThVKD72i+cS3k+NUKvWZkFbhMwfVMu+BOXYHy8lENqcaMuM2vyWp+WB2kJpoLrQNhOqI21Toa3HJAttw5c2fOKFtvGzjrSNmWikbdAAI11WMw8U23L2HCkOdBkxUk8/msyyCVsj0IeAKAP9aI5R+yJ1+mZqPXVYqPc0fjUSA82FZk9zmWNqo45hG5WfSB1lWOaCqDMwLDkTD/SXoQy0nTzPu5en52P9f4BO25jbLfTvl8fjc4VWoDZ4fPu+e79/fdjVL7we0jC+cC63nJJ/7N/fHn88NHdM29xw+VUXOp+Mzm7FcPi6+ReGcFi7') diff --git a/examples/guide/firstwidget/2_print_touch.py b/examples/guide/firstwidget/2_print_touch.py index bd26e43d3b..8bc4db2236 100644 --- a/examples/guide/firstwidget/2_print_touch.py +++ b/examples/guide/firstwidget/2_print_touch.py @@ -6,6 +6,7 @@ class MyPaintWidget(Widget): def on_touch_down(self, touch): print(touch) + class MyPaintApp(App): def build(self): return MyPaintWidget() diff --git a/examples/guide/quickstart/main.py b/examples/guide/quickstart/main.py index 481b8bccb6..a1f8070838 100644 --- a/examples/guide/quickstart/main.py +++ b/examples/guide/quickstart/main.py @@ -1,5 +1,5 @@ import kivy -kivy.require('1.0.6') # replace with your current kivy version ! +kivy.require('1.0.6') # replace with your current kivy version ! from kivy.app import App from kivy.uix.button import Button diff --git a/examples/includes/main.py b/examples/includes/main.py index d56d745bde..587eb7a830 100644 --- a/examples/includes/main.py +++ b/examples/includes/main.py @@ -15,4 +15,4 @@ class TestApp(App): pass if __name__ == '__main__': - TestApp().run() \ No newline at end of file + TestApp().run() diff --git a/examples/keyboard/main.py b/examples/keyboard/main.py index 8fdf5bab8c..256de5e1da 100755 --- a/examples/keyboard/main.py +++ b/examples/keyboard/main.py @@ -22,8 +22,7 @@ # custom json files from the app folder require("1.8.0") -Builder.load_string( -''' +Builder.load_string(''' : displayLabel: displayLabel kbContainer: kbContainer diff --git a/examples/kv/kvrun.py b/examples/kv/kvrun.py index 33a0a5d93b..a7dd865bab 100644 --- a/examples/kv/kvrun.py +++ b/examples/kv/kvrun.py @@ -5,6 +5,7 @@ from kivy.lang import Builder from kivy.core.window import Window + class KvApp(App): def _print_fps(self, *largs): print('FPS: %2.4f (real draw: %d)' % ( diff --git a/examples/shader/plasma.py b/examples/shader/plasma.py index 91a4f9ff7a..5522bbabb0 100644 --- a/examples/shader/plasma.py +++ b/examples/shader/plasma.py @@ -2,8 +2,8 @@ Plasma Shader ============= -This shader example have been taken from http://www.iquilezles.org/apps/shadertoy/ -with some adapation. +This shader example have been taken from +http://www.iquilezles.org/apps/shadertoy/ with some adaptation. This might become a Kivy widget when experimentation will be done. ''' @@ -43,12 +43,14 @@ float mov1 = y / resolution.y / 0.2 + time; float mov2 = x / resolution.x / 0.2; float c1 = abs(sin(mov1+time)/2.+mov2/2.-mov1-mov2+time); - float c2 = abs(sin(c1+sin(mov0/1000.+time)+sin(y/40.+time)+sin((x+y)/100.)*3.)); + float c2 = abs(sin(c1+sin(mov0/1000.+time) + +sin(y/40.+time)+sin((x+y)/100.)*3.)); float c3 = abs(sin(c2+cos(mov1+mov2+c2)+cos(mov2)+sin(x/1000.))); gl_FragColor = vec4( c1,c2,c3,1.0); } ''' + class ShaderWidget(FloatLayout): # property to set the source code for fragment shader diff --git a/examples/svg/benchmark.py b/examples/svg/benchmark.py index 7089fe321c..39c28d55cd 100644 --- a/examples/svg/benchmark.py +++ b/examples/svg/benchmark.py @@ -6,7 +6,8 @@ filename = sys.argv[1] if "PROFILE" in os.environ: - import pstats, cProfile + import pstats + import cProfile cProfile.runctx("Svg(filename)", globals(), locals(), "Profile.prof") s = pstats.Stats("Profile.prof") s.sort_stats("time").print_callers() diff --git a/examples/svg/main-smaa.py b/examples/svg/main-smaa.py index fa1242e581..455815ed91 100644 --- a/examples/svg/main-smaa.py +++ b/examples/svg/main-smaa.py @@ -73,6 +73,7 @@ def __init__(self, filename): self.size = svg.width, svg.height + class SvgApp(App): def build(self): @@ -98,7 +99,8 @@ def build(self): if 1: #from kivy.uix.image import Image - #root.add_widget(Image(source='data/logo/kivy-icon-512.png', size=(800, 600))) + #root.add_widget(Image(source='data/logo/kivy-icon-512.png', + # size=(800, 600))) filenames = sys.argv[1:] if not filenames: @@ -132,7 +134,6 @@ def build(self): effect.add_widget(Button(text='Hello World')) effect.add_widget(Slider(pos=(200, 200))) - control_ui = Builder.load_string(smaa_ui) self.root.add_widget(control_ui) @@ -151,4 +152,3 @@ def _on_keyboard_handler(self, instance, key, *args): if __name__ == '__main__': SvgApp().run() - diff --git a/examples/svg/main.py b/examples/svg/main.py index 6488457589..ea9203690b 100644 --- a/examples/svg/main.py +++ b/examples/svg/main.py @@ -16,6 +16,7 @@ def __init__(self, filename, **kwargs): svg = Svg(filename) self.size = svg.width, svg.height + class SvgApp(App): def build(self): @@ -33,4 +34,3 @@ def build(self): if __name__ == '__main__': SvgApp().run() - diff --git a/examples/tutorials/notes/final/main.py b/examples/tutorials/notes/final/main.py index 9fe36589be..a75f83d3f3 100644 --- a/examples/tutorials/notes/final/main.py +++ b/examples/tutorials/notes/final/main.py @@ -54,7 +54,6 @@ def check_focus_and_view(self, textinput): self.view() - class NoteView(Screen): note_index = NumericProperty() diff --git a/examples/widgets/accordion_1.py b/examples/widgets/accordion_1.py index c76854c251..6d36187f87 100644 --- a/examples/widgets/accordion_1.py +++ b/examples/widgets/accordion_1.py @@ -2,6 +2,7 @@ from kivy.uix.label import Label from kivy.app import App + class AccordionApp(App): def build(self): root = Accordion() diff --git a/examples/widgets/asyncimage.py b/examples/widgets/asyncimage.py index f2975bdae2..c04f5b8f59 100644 --- a/examples/widgets/asyncimage.py +++ b/examples/widgets/asyncimage.py @@ -27,7 +27,7 @@ class CenteredAsyncImage(AsyncImage): class TestAsyncApp(App): def build(self): return CenteredAsyncImage( - source='http://kivy.org/funny-pictures-cat-is-expecting-you.jpg') + source='http://kivy.org/funny-pictures-cat-is-expecting-you.jpg') if __name__ == '__main__': TestAsyncApp().run() diff --git a/examples/widgets/boxlayout_poshint.py b/examples/widgets/boxlayout_poshint.py index fd2513b434..7e2f6a7766 100644 --- a/examples/widgets/boxlayout_poshint.py +++ b/examples/widgets/boxlayout_poshint.py @@ -40,6 +40,7 @@ text: 'pos_hint: top=1' ''') + class Demo(GridLayout): pass diff --git a/examples/widgets/carousel_buttons.py b/examples/widgets/carousel_buttons.py index 12bf3dedd4..a77cc84498 100644 --- a/examples/widgets/carousel_buttons.py +++ b/examples/widgets/carousel_buttons.py @@ -33,9 +33,11 @@ root.parent.parent.load_next() ''') + class Page(GridLayout): pass + class TestApp(App): def build(self): root = Carousel() diff --git a/examples/widgets/codeinput.py b/examples/widgets/codeinput.py index a2871f0d2b..e1aa6a4058 100644 --- a/examples/widgets/codeinput.py +++ b/examples/widgets/codeinput.py @@ -8,7 +8,8 @@ from kivy.core.window import Window from pygments import lexers from pygame import font as fonts -import codecs, os +import codecs +import os example_text = ''' ---------------------Python---------------------------------- @@ -66,7 +67,7 @@ class LoadDialog(Popup): def load(self, path, selection): self.choosen_file = [None, ] self.choosen_file = selection - Window.title = selection[0][selection[0].rfind(os.sep)+1:] + Window.title = selection[0][selection[0].rfind(os.sep) + 1:] self.dismiss() def cancel(self): @@ -78,7 +79,7 @@ class SaveDialog(Popup): def save(self, path, selection): _file = codecs.open(selection, 'w', encoding='utf8') _file.write(self.text) - Window.title = selection[selection.rfind(os.sep)+1:] + Window.title = selection[selection.rfind(os.sep) + 1:] _file.close() self.dismiss() diff --git a/examples/widgets/colorpicker.py b/examples/widgets/colorpicker.py index 59e056c15c..29bb7b72de 100644 --- a/examples/widgets/colorpicker.py +++ b/examples/widgets/colorpicker.py @@ -111,6 +111,8 @@ LeftPanel: ''') + + def calculate_points(x1, y1, x2, y2, steps=5): dx = x2 - x1 dy = y2 - y1 @@ -126,9 +128,11 @@ def calculate_points(x1, y1, x2, y2, steps=5): o.extend([lastx, lasty]) return o + class ColorSelector(Popup): pass + class Picture(Scatter): source = StringProperty(None) @@ -146,13 +150,13 @@ def on_touch_down(self, touch): return super(Picture, self).on_touch_down(touch) ud = touch.ud ud['group'] = g = str(touch.uid) - _pos =list(self.ids.image.to_widget(*touch.pos)) + _pos = list(self.ids.image.to_widget(*touch.pos)) _pos[0] += self.parent.x with self.ids.image.canvas.after: ud['color'] = Color(*_app.color_selector.color, group=g) ud['lines'] = Point(points=(_pos), - source='../examples/demo/touchtracer/particle.png', - pointsize=5, group=g) + source='../examples/demo/touchtracer/particle.png', + pointsize=5, group=g) touch.grab(self) return True @@ -163,7 +167,7 @@ def on_touch_move(self, touch): if _app.color_mode[0] == 'c' or not self.collide_point(*touch.pos): return super(Picture, self).on_touch_move(touch) ud = touch.ud - _pos =list(self.ids.image.to_widget(*touch.pos)) + _pos = list(self.ids.image.to_widget(*touch.pos)) _pos[0] += self.parent.x points = ud['lines'].points oldx, oldy = points[-2], points[-1] @@ -172,7 +176,7 @@ def on_touch_move(self, touch): try: lp = ud['lines'].add_point for idx in range(0, len(points), 2): - lp(points[idx], points[idx+1]) + lp(points[idx], points[idx + 1]) except GraphicException: pass @@ -190,16 +194,15 @@ def on_touch_up(self, touch): class MainRootWidget(BoxLayout): clent_area = ObjectProperty(None) - '''The Client Area in which all editing is Done - ''' + # The Client Area in which all editing is Done def on_parent(self, instance, parent): if parent: _dir = join(dirname(__file__), 'lists/fruit_images/') for image in list(walk(_dir))[0][2]: if image.find('512') > -1: - self.client_area.add_widget(Picture( - source=_dir+image)) + self.client_area.add_widget(Picture(source=_dir + image)) + class MainApp(App): @@ -215,7 +218,6 @@ class MainApp(App): adding brush strokes to the currently selected Image. ''' - def build(self): self.color_selector = ColorSelector() self.main_root_widget = MainRootWidget() diff --git a/examples/widgets/image_mipmap.py b/examples/widgets/image_mipmap.py index 9961672513..c6cb627c56 100644 --- a/examples/widgets/image_mipmap.py +++ b/examples/widgets/image_mipmap.py @@ -14,6 +14,7 @@ from kivy.uix.image import Image from os.path import join + class LabelMipmapTest(App): def build(self): s = ScatterPlane(scale=.5) diff --git a/examples/widgets/label_mipmap.py b/examples/widgets/label_mipmap.py index 57590e94e2..d437846c9a 100644 --- a/examples/widgets/label_mipmap.py +++ b/examples/widgets/label_mipmap.py @@ -13,6 +13,7 @@ from kivy.uix.scatter import ScatterPlane from kivy.uix.label import Label + class LabelMipmapTest(App): def build(self): s = ScatterPlane(scale=.5) diff --git a/examples/widgets/label_text_size.py b/examples/widgets/label_text_size.py index 402fa68b71..2694e5b96c 100644 --- a/examples/widgets/label_text_size.py +++ b/examples/widgets/label_text_size.py @@ -14,18 +14,32 @@ from kivy.uix.label import Label -_long_text = """ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus odio nisi, pellentesque molestie adipiscing vitae, aliquam at tellus. Fusce quis est ornare erat pulvinar elementum ut sed felis. Donec vel neque mauris. In sit amet nunc sit amet diam dapibus lacinia. In sodales placerat mauris, ut euismod augue laoreet at. Integer in neque non odio fermentum volutpat nec nec nulla. Donec et risus non mi viverra posuere. Phasellus cursus augue purus, eget volutpat leo. Phasellus sed dui vitae ipsum mattis facilisis vehicula eu justo. - -Quisque neque dolor, egestas sed venenatis eget, porta id ipsum. Ut faucibus, massa vitae imperdiet rutrum, sem dolor rhoncus magna, non lacinia nulla risus non dui. Nulla sit amet risus orci. Nunc libero justo, interdum eu pulvinar vel, pulvinar et lectus. Phasellus sed luctus diam. Pellentesque non feugiat dolor. Cras at dolor velit, gravida congue velit. Aliquam erat volutpat. Nullam eu nunc dui, quis sagittis dolor. Ut nec dui eget odio pulvinar placerat. Pellentesque mi metus, tristique et placerat ac, pulvinar vel quam. Nam blandit magna a urna imperdiet molestie. Nullam ut nisi eget enim laoreet sodales sit amet a felis. -""" +_long_text = ("""Lorem ipsum dolor sit amet, consectetur adipiscing elit. """ + """Phasellus odio nisi, pellentesque molestie adipiscing vitae, aliquam """ + """at tellus. Fusce quis est ornare erat pulvinar elementum ut sed """ + """felis. Donec vel neque mauris. In sit amet nunc sit amet diam dapibus """ + """lacinia. In sodales placerat mauris, ut euismod augue laoreet at. """ + """Integer in neque non odio fermentum volutpat nec nec nulla. Donec et """ + """risus non mi viverra posuere. Phasellus cursus augue purus, eget """ + """volutpat leo. Phasellus sed dui vitae ipsum mattis facilisis vehicula """ + """eu justo.\n\n""" + """Quisque neque dolor, egestas sed venenatis eget, porta id ipsum. Ut """ + """faucibus, massa vitae imperdiet rutrum, sem dolor rhoncus magna, non """ + """lacinia nulla risus non dui. Nulla sit amet risus orci. Nunc libero """ + """justo, interdum eu pulvinar vel, pulvinar et lectus. Phasellus sed """ + """luctus diam. Pellentesque non feugiat dolor. Cras at dolor velit, """ + """gravida congue velit. Aliquam erat volutpat. Nullam eu nunc dui, quis """ + """sagittis dolor. Ut nec dui eget odio pulvinar placerat. Pellentesque """ + """mi metus, tristique et placerat ac, pulvinar vel quam. Nam blandit """ + """magna a urna imperdiet molestie. Nullam ut nisi eget enim laoreet """ + """sodales sit amet a felis.\n""") class LabelTextSizeTest(App): def build(self): l = Label( text=_long_text, - text_size = (600,None), + text_size=(600, None), line_height=1.5 ) return l diff --git a/examples/widgets/label_with_markup.py b/examples/widgets/label_with_markup.py index a11794d43d..fe37c379c6 100644 --- a/examples/widgets/label_with_markup.py +++ b/examples/widgets/label_with_markup.py @@ -11,6 +11,7 @@ font_size: '64pt' ''') + class LabelWithMarkup(App): def build(self): return root diff --git a/examples/widgets/lists/fixtures.py b/examples/widgets/lists/fixtures.py index 2f84d12089..2cac425112 100644 --- a/examples/widgets/lists/fixtures.py +++ b/examples/widgets/lists/fixtures.py @@ -1,9 +1,8 @@ # ---------------------------------------------------------------------------- # A dictionary of dicts, with only the minimum required is_selected attribute, # for use with examples using a simple list of integers in a list view. -integers_dict = \ - { str(i): {'text': str(i), 'is_selected': False} for i in range(100)} - +integers_dict = {str(i): {'text': str(i), 'is_selected': False} + for i in range(100)} # ---------------------------------------------------------------------------- # A dataset of fruit category and fruit data for use in examples. @@ -21,105 +20,129 @@ # fruit_data_list_of_dicts # fruit_data # -fruit_categories = \ - {'Melons': {'name': 'Melons', - 'fruits': ['Cantaloupe', 'Honeydew', 'Watermelon'], - 'is_selected': False}, - 'Tree Fruits': {'name': 'Tree Fruits', - 'fruits': ['Apple', 'Avocado', 'Banana', 'Nectarine', - 'Peach', 'Pear', 'Pineapple', 'Plum', - 'Cherry'], - 'is_selected': False}, - 'Citrus Fruits': {'name': 'Citrus Fruits', - 'fruits': ['Grapefruit', 'Lemon', 'Lime', 'Orange', - 'Tangerine'], - 'is_selected': False}, - 'Other Fruits': {'name': 'Other Fruits', - 'fruits': ['Grape', 'Kiwifruit', - 'Strawberry'], - 'is_selected': False}} +fruit_categories = { + 'Melons': { + 'name': 'Melons', + 'fruits': ['Cantaloupe', 'Honeydew', 'Watermelon'], + 'is_selected': False}, + 'Tree Fruits': { + 'name': 'Tree Fruits', + 'fruits': ['Apple', 'Avocado', 'Banana', 'Nectarine', 'Peach', 'Pear', + 'Pineapple', 'Plum', 'Cherry'], + 'is_selected': False}, + 'Citrus Fruits': { + 'name': 'Citrus Fruits', + 'fruits': ['Grapefruit', 'Lemon', 'Lime', 'Orange', 'Tangerine'], + 'is_selected': False}, + 'Other Fruits': { + 'name': 'Other Fruits', + 'fruits': ['Grape', 'Kiwifruit', 'Strawberry'], + 'is_selected': False}} fruit_data_list_of_dicts = [ -{'name':'Apple', - 'Serving Size': '1 large (242 g/8 oz)', - 'data': [130, 0, 0, 0, 0, 0, 260, 7, 34, 11, 5, 20, 25, 1, 2, 8, 2, 2], - 'is_selected': False}, -{'name':'Avocado', - 'Serving Size': '1/5 medium (30 g/1.1 oz)', - 'data': [50, 35, 4.5, 7, 0, 0, 140, 4, 3, 1, 1, 4, 0, 1, 0, 4, 0, 2], - 'is_selected': False}, -{'name':'Banana', - 'Serving Size': '1 medium (126 g/4.5 oz)', - 'data': [110, 0, 0, 0, 0, 0, 450, 13, 30, 10, 3, 12, 19, 1, 2, 15, 0, 2], - 'is_selected': False}, -{'name':'Cantaloupe', - 'Serving Size': '1/4 medium (134 g/4.8 oz)', - 'data': [50, 0, 0, 0, 20, 1, 240, 7, 12, 4, 1, 4, 11, 1, 120, 80, 2, 2], - 'is_selected': False}, -{'name':'Grapefruit', - 'Serving Size': '1/2 medium (154 g/5.5 oz)', - 'data': [60, 0, 0, 0, 0, 0, 160, 5, 15, 5, 2, 8, 11, 1, 35, 100, 4, 0], - 'is_selected': False}, -{'name':'Grape', - 'Serving Size': '3/4 cup (126 g/4.5 oz)', - 'data': [90, 0, 0, 0, 15, 1, 240, 7, 23, 8, 1, 4, 20, 0, 0, 2, 2, 0], - 'is_selected': False}, -{'name':'Honeydew', - 'Serving Size': '1/10 medium melon (134 g/4.8 oz)', - 'data': [50, 0, 0, 0, 30, 1, 210, 6, 12, 4, 1, 4, 11, 1, 2, 45, 2, 2], - 'is_selected': False}, -{'name':'Kiwifruit', - 'Serving Size': '2 medium (148 g/5.3 oz)', - 'data': [90, 10, 1, 2, 0, 0, 450, 13, 20, 7, 4, 16, 13, 1, 2, 240, 4, 2], - 'is_selected': False}, -{'name':'Lemon', - 'Serving Size': '1 medium (58 g/2.1 oz)', - 'data': [15, 0, 0, 0, 0, 0, 75, 2, 5, 2, 2, 8, 2, 0, 0, 40, 2, 0], - 'is_selected': False}, -{'name':'Lime', - 'Serving Size': '1 medium (67 g/2.4 oz)', - 'data': [20, 0, 0, 0, 0, 0, 75, 2, 7, 2, 2, 8, 0, 0, 0, 35, 0, 0], - 'is_selected': False}, -{'name':'Nectarine', - 'Serving Size': '1 medium (140 g/5.0 oz)', - 'data': [60, 5, 0.5, 1, 0, 0, 250, 7, 15, 5, 2, 8, 11, 1, 8, 15, 0, 2], - 'is_selected': False}, -{'name':'Orange', - 'Serving Size': '1 medium (154 g/5.5 oz)', - 'data': [80, 0, 0, 0, 0, 0, 250, 7, 19, 6, 3, 12, 14, 1, 2, 130, 6, 0], - 'is_selected': False}, -{'name':'Peach', - 'Serving Size': '1 medium (147 g/5.3 oz)', - 'data': [60, 0, 0.5, 1, 0, 0, 230, 7, 15, 5, 2, 8, 13, 1, 6, 15, 0, 2], - 'is_selected': False}, -{'name':'Pear', - 'Serving Size': '1 medium (166 g/5.9 oz)', - 'data': [100, 0, 0, 0, 0, 0, 190, 5, 26, 9, 6, 24, 16, 1, 0, 10, 2, 0], - 'is_selected': False}, -{'name':'Pineapple', - 'Serving Size': '2 slices, 3" diameter, 3/4" thick (112 g/4 oz)', - 'data': [50, 0, 0, 0, 10, 0, 120, 3, 13, 4, 1, 4, 10, 1, 2, 50, 2, 2], - 'is_selected': False}, -{'name':'Plum', - 'Serving Size': '2 medium (151 g/5.4 oz)', - 'data': [70, 0, 0, 0, 0, 0, 230, 7, 19, 6, 2, 8, 16, 1, 8, 10, 0, 2], - 'is_selected': False}, -{'name':'Strawberry', - 'Serving Size': '8 medium (147 g/5.3 oz)', - 'data': [50, 0, 0, 0, 0, 0, 170, 5, 11, 4, 2, 8, 8, 1, 0, 160, 2, 2], - 'is_selected': False}, -{'name':'Cherry', - 'Serving Size': '21 cherries; 1 cup (140 g/5.0 oz)', - 'data': [100, 0, 0, 0, 0, 0, 350, 10, 26, 9, 1, 4, 16, 1, 2, 15, 2, 2], - 'is_selected': False}, -{'name':'Tangerine', - 'Serving Size': '1 medium (109 g/3.9 oz)', - 'data': [50, 0, 0, 0, 0, 0, 160, 5, 13, 4, 2, 8, 9, 1, 6, 45, 4, 0], - 'is_selected': False}, -{'name':'Watermelon', - 'Serving Size': '1/18 medium melon; 2 cups diced pieces (280 g/10.0 oz)', - 'data': [80, 0, 0, 0, 0, 0, 270, 8, 21, 7, 1, 4, 20, 1, 30, 25, 2, 4], - 'is_selected': False}] + { + 'name':'Apple', + 'Serving Size': '1 large (242 g/8 oz)', + 'data': [130, 0, 0, 0, 0, 0, 260, 7, 34, 11, 5, 20, 25, 1, 2, 8, 2, 2], + 'is_selected': False}, + { + 'name':'Avocado', + 'Serving Size': '1/5 medium (30 g/1.1 oz)', + 'data': [50, 35, 4.5, 7, 0, 0, 140, 4, 3, 1, 1, 4, 0, 1, 0, 4, 0, 2], + 'is_selected': False}, + { + 'name':'Banana', + 'Serving Size': '1 medium (126 g/4.5 oz)', + 'data': [110, 0, 0, 0, 0, 0, 450, 13, 30, 10, 3, 12, 19, + 1, 2, 15, 0, 2], + 'is_selected': False}, + { + 'name':'Cantaloupe', + 'Serving Size': '1/4 medium (134 g/4.8 oz)', + 'data': [50, 0, 0, 0, 20, 1, 240, 7, 12, 4, 1, 4, 11, 1, 120, 80, 2, 2], + 'is_selected': False}, + { + 'name':'Grapefruit', + 'Serving Size': '1/2 medium (154 g/5.5 oz)', + 'data': [60, 0, 0, 0, 0, 0, 160, 5, 15, 5, 2, 8, 11, 1, 35, 100, 4, 0], + 'is_selected': False}, + { + 'name':'Grape', + 'Serving Size': '3/4 cup (126 g/4.5 oz)', + 'data': [90, 0, 0, 0, 15, 1, 240, 7, 23, 8, 1, 4, 20, 0, 0, 2, 2, 0], + 'is_selected': False}, + { + 'name':'Honeydew', + 'Serving Size': '1/10 medium melon (134 g/4.8 oz)', + 'data': [50, 0, 0, 0, 30, 1, 210, 6, 12, 4, 1, 4, 11, 1, 2, 45, 2, 2], + 'is_selected': False}, + { + 'name':'Kiwifruit', + 'Serving Size': '2 medium (148 g/5.3 oz)', + 'data': [90, 10, 1, 2, 0, 0, 450, 13, 20, 7, 4, 16, 13, + 1, 2, 240, 4, 2], + 'is_selected': False}, + { + 'name':'Lemon', + 'Serving Size': '1 medium (58 g/2.1 oz)', + 'data': [15, 0, 0, 0, 0, 0, 75, 2, 5, 2, 2, 8, 2, 0, 0, 40, 2, 0], + 'is_selected': False}, + { + 'name':'Lime', + 'Serving Size': '1 medium (67 g/2.4 oz)', + 'data': [20, 0, 0, 0, 0, 0, 75, 2, 7, 2, 2, 8, 0, 0, 0, 35, 0, 0], + 'is_selected': False}, + { + 'name':'Nectarine', + 'Serving Size': '1 medium (140 g/5.0 oz)', + 'data': [60, 5, 0.5, 1, 0, 0, 250, 7, 15, 5, 2, 8, 11, 1, 8, 15, 0, 2], + 'is_selected': False}, + { + 'name':'Orange', + 'Serving Size': '1 medium (154 g/5.5 oz)', + 'data': [80, 0, 0, 0, 0, 0, 250, 7, 19, 6, 3, 12, 14, 1, 2, 130, 6, 0], + 'is_selected': False}, + { + 'name':'Peach', + 'Serving Size': '1 medium (147 g/5.3 oz)', + 'data': [60, 0, 0.5, 1, 0, 0, 230, 7, 15, 5, 2, 8, 13, 1, 6, 15, 0, 2], + 'is_selected': False}, + { + 'name':'Pear', + 'Serving Size': '1 medium (166 g/5.9 oz)', + 'data': [100, 0, 0, 0, 0, 0, 190, 5, 26, 9, 6, 24, 16, 1, 0, 10, 2, 0], + 'is_selected': False}, + { + 'name':'Pineapple', + 'Serving Size': '2 slices, 3" diameter, 3/4" thick (112 g/4 oz)', + 'data': [50, 0, 0, 0, 10, 0, 120, 3, 13, 4, 1, 4, 10, 1, 2, 50, 2, 2], + 'is_selected': False}, + { + 'name':'Plum', + 'Serving Size': '2 medium (151 g/5.4 oz)', + 'data': [70, 0, 0, 0, 0, 0, 230, 7, 19, 6, 2, 8, 16, 1, 8, 10, 0, 2], + 'is_selected': False}, + { + 'name':'Strawberry', + 'Serving Size': '8 medium (147 g/5.3 oz)', + 'data': [50, 0, 0, 0, 0, 0, 170, 5, 11, 4, 2, 8, 8, 1, 0, 160, 2, 2], + 'is_selected': False}, + { + 'name':'Cherry', + 'Serving Size': '21 cherries; 1 cup (140 g/5.0 oz)', + 'data': [100, 0, 0, 0, 0, 0, 350, 10, 26, 9, 1, 4, 16, 1, 2, 15, 2, 2], + 'is_selected': False}, + { + 'name':'Tangerine', + 'Serving Size': '1 medium (109 g/3.9 oz)', + 'data': [50, 0, 0, 0, 0, 0, 160, 5, 13, 4, 2, 8, 9, 1, 6, 45, 4, 0], + 'is_selected': False}, + { + 'name':'Watermelon', + 'Serving Size': + '1/18 medium melon; 2 cups diced pieces (280 g/10.0 oz)', + 'data': [80, 0, 0, 0, 0, 0, 270, 8, 21, 7, 1, 4, 20, 1, 30, 25, 2, 4], + 'is_selected': False}] fruit_data_attributes = ['(gram weight/ ounce weight)', 'Calories', diff --git a/examples/widgets/lists/list_composite.py b/examples/widgets/lists/list_composite.py index a54d5833ce..11201388ef 100644 --- a/examples/widgets/lists/list_composite.py +++ b/examples/widgets/lists/list_composite.py @@ -20,21 +20,23 @@ def __init__(self, **kwargs): # This is quite an involved args_converter, so we should go through the # details. A CompositeListItem instance is made with the args # returned by this converter. The first three, text, size_hint_y, - # height are arguments for CompositeListItem. The cls_dicts list contains - # argument sets for each of the member widgets for this composite: - # ListItemButton and ListItemLabel. - args_converter = \ - lambda row_index, rec: \ - {'text': rec['text'], - 'size_hint_y': None, - 'height': 25, - 'cls_dicts': [{'cls': ListItemButton, - 'kwargs': {'text': rec['text']}}, - {'cls': ListItemLabel, - 'kwargs': {'text': "Middle-{0}".format(rec['text']), - 'is_representing_cls': True}}, - {'cls': ListItemButton, - 'kwargs': {'text': rec['text']}}]} + # height are arguments for CompositeListItem. The cls_dicts list + # contains argument sets for each of the member widgets for this + # composite: ListItemButton and ListItemLabel. + args_converter = lambda row_index, rec: { + 'text': rec['text'], + 'size_hint_y': None, + 'height': 25, + 'cls_dicts': [{'cls': ListItemButton, + 'kwargs': {'text': rec['text']}}, + { + 'cls': ListItemLabel, + 'kwargs': { + 'text': "Middle-{0}".format(rec['text']), + 'is_representing_cls': True}}, + { + 'cls': ListItemButton, + 'kwargs': {'text': rec['text']}}]} item_strings = ["{0}".format(index) for index in range(100)] diff --git a/examples/widgets/lists/list_ops.py b/examples/widgets/lists/list_ops.py index 91fce1c511..615eca2083 100644 --- a/examples/widgets/lists/list_ops.py +++ b/examples/widgets/lists/list_ops.py @@ -111,7 +111,7 @@ def update_sel_count_6(self, adapter, *args): class OpsView(BoxLayout): '''Seven list views are shown at the bottom, each focusing on one of the available operations for collection adapters: scroll_to, trim_to_sel, - trim_left_of_sel, etc. At the top is a display that shows individual + trim_left_of_sel, etc. At the top is a display that shows individual items selected across the seven lists, along with a total of all selected items for the lists. ''' @@ -157,7 +157,8 @@ def __init__(self, **kwargs): size_hint=(.5, 1.0), background_color=[.25, .25, .6, 1.0]) selection_monitor = SelectionMonitor() - selection_monitor.bind(count_string=total_selection_button.setter('text')) + selection_monitor.bind( + count_string=total_selection_button.setter('text')) upper_panel.add_widget(total_selection_button) diff --git a/examples/widgets/popup_with_kv.py b/examples/widgets/popup_with_kv.py index 0a42c45279..7eda6dea32 100644 --- a/examples/widgets/popup_with_kv.py +++ b/examples/widgets/popup_with_kv.py @@ -17,9 +17,11 @@ ''') + class CustomPopup(Popup): pass + class TestApp(App): def build(self): b = Button(on_press=self.show_popup) diff --git a/examples/widgets/rstexample.py b/examples/widgets/rstexample.py index 2dc723a78b..bf54c4c7fc 100644 --- a/examples/widgets/rstexample.py +++ b/examples/widgets/rstexample.py @@ -118,6 +118,7 @@ from kivy.uix.rst import RstDocument from kivy.app import App + class RstApp(App): def build(self): return RstDocument(text=__doc__) diff --git a/examples/widgets/scatter.py b/examples/widgets/scatter.py index 49f6c3b57c..26482c8fcb 100644 --- a/examples/widgets/scatter.py +++ b/examples/widgets/scatter.py @@ -1,9 +1,11 @@ from kivy.uix.scatter import Scatter from kivy.app import App + class MyScatter(Scatter): pass + class ScatterApp(App): def build(self): s = MyScatter(size=(400, 400), size_hint=(None, None)) diff --git a/examples/widgets/scrollview.py b/examples/widgets/scrollview.py index 44a2ab8426..ffb184ce7e 100644 --- a/examples/widgets/scrollview.py +++ b/examples/widgets/scrollview.py @@ -29,8 +29,7 @@ def build(self): # create a scroll view, with a size < size of the grid root = ScrollView(size_hint=(None, None), size=(500, 320), - pos_hint={'center_x': .5, 'center_y': .5} - , do_scroll_x=False) + pos_hint={'center_x': .5, 'center_y': .5}, do_scroll_x=False) root.add_widget(layout) return root diff --git a/examples/widgets/sequenced_images/main.py b/examples/widgets/sequenced_images/main.py index f2bc045d7a..ba21312193 100644 --- a/examples/widgets/sequenced_images/main.py +++ b/examples/widgets/sequenced_images/main.py @@ -35,14 +35,15 @@ def __init__(self, **kwargs): def on_value(self, *l): if self.currentObj: - if abs(l[1]) <= 0 : + if abs(l[1]) <= 0: self.currentObj.anim_delay = -1 - l[2].text = 'Animation speed: %f FPS' %0 + l[2].text = 'Animation speed: %f FPS' % 0 else: - self.currentObj.anim_delay = 1/l[1] - l[2].text = 'Animation speed: %f FPS' %(1/self.currentObj.anim_delay) + self.currentObj.anim_delay = 1 / l[1] + l[2].text = 'Animation speed: %f FPS' % ( + 1 / self.currentObj.anim_delay) else: - l[0].max = 0 + l[0].max = 0 l[2].text = 'No Image selected' @@ -57,58 +58,61 @@ def __init__(self, **kwargs): self.sign = .10 #setup Layouts - layout = GridLayout( size_hint = (1, 1), cols = 3, rows = 1) - left_frame = GridLayout( size_hint = (.25, 1), cols = 1) - client_frame = FloatLayout( size_hint = (1, 1)) - self.right_frame = Right_Frame() + layout = GridLayout(size_hint=(1, 1), cols=3, rows=1) + left_frame = GridLayout(size_hint=(.25, 1), cols=1) + client_frame = FloatLayout(size_hint=(1, 1)) + self.right_frame = Right_Frame() #setup buttons in left frame - but_load_gif = AnimatedButton(text = 'load gif', halign = 'center') - but_load_zip_png = AnimatedButton(text = 'load zipped\n png/s', halign = 'center') - but_load_zip_jpg = AnimatedButton(text = 'load zipped\n jpg/s', halign = 'center') - but_animated = AnimatedButton(text = 'animated button\n'+\ - 'made using\nSequenced Images\n press to animate', halign = 'center',\ - background_normal = 'data/images/button_white.png',\ - background_down = 'data/images/button_white_animated.zip') - but_animated_normal = AnimatedButton(text = 'borderless\n'+\ - 'animated button\npress to stop', halign = 'center',\ - background_down = 'data/images/button_white.png',\ - background_normal = 'data/images/button_white_animated.zip') - but_animated_borderless = AnimatedButton(text = 'Borderless',\ - background_normal = 'data/images/info.png',\ - background_down = 'data/images/info.zip', halign = 'center') - but_animated_bordered = AnimatedButton(text = 'With Border',\ - background_normal = 'data/images/info.png',\ - background_down = 'data/images/info.zip', halign = 'center') + but_load_gif = AnimatedButton(text='load gif', halign='center') + but_load_zip_png = AnimatedButton(text='load zipped\n png/s', + halign='center') + but_load_zip_jpg = AnimatedButton(text='load zipped\n jpg/s', + halign='center') + but_animated = AnimatedButton(text='animated button\n' + 'made using\nSequenced Images\n press to animate', + halign='center', + background_normal='data/images/button_white.png', + background_down='data/images/button_white_animated.zip') + but_animated_normal = AnimatedButton(text='borderless\n' + 'animated button\npress to stop', + halign='center', + background_down='data/images/button_white.png', + background_normal='data/images/button_white_animated.zip') + but_animated_borderless = AnimatedButton(text='Borderless', + background_normal='data/images/info.png', + background_down='data/images/info.zip', halign='center') + but_animated_bordered = AnimatedButton(text='With Border', + background_normal='data/images/info.png', + background_down='data/images/info.zip', halign='center') #Handle button press/release def load_images(*l): - if l[0].text == 'load gif' or l[0].text == 'load gif\n from cache': l[0].text = 'load gif\n from cache' sctr = gifScatter() - if l[0].text == 'load zipped\n png/s' or\ - l[0].text == 'load zipped\n png/s from cache': + if (l[0].text == 'load zipped\n png/s' or + l[0].text == 'load zipped\n png/s from cache'): l[0].text = 'load zipped\n png/s from cache' sctr = zipScatter() - if l[0].text == 'load zipped\n jpg/s' or l[0].text == 'load zipped\n jpg/s from cache': + if (l[0].text == 'load zipped\n jpg/s' or + l[0].text == 'load zipped\n jpg/s from cache'): l[0].text = 'load zipped\n jpg/s from cache' sctr = jpgScatter() client_frame.add_widget(sctr, 1) #position scatter - sctr.pos = (240 + self.sign, 200+ self.sign ) + sctr.pos = (240 + self.sign, 200 + self.sign) self.sign += 10 - if self.sign >200: + if self.sign > 200: self.sign = 10 - sctr.pos = (300, 200 - self.sign) - + sctr.pos = (300, 200 - self.sign) #bind function on on_release - but_load_gif.bind(on_release = load_images) - but_load_zip_png.bind(on_release = load_images) - but_load_zip_jpg.bind(on_release = load_images) + but_load_gif.bind(on_release=load_images) + but_load_zip_png.bind(on_release=load_images) + but_load_zip_jpg.bind(on_release=load_images) #add widgets to left frame left_frame.add_widget(but_load_gif) @@ -120,7 +124,8 @@ def load_images(*l): left_frame.add_widget(but_animated_bordered) #set/remove border for borderless widgets (16,16,16,16) by default - but_animated_normal.border = but_animated_borderless.border = (0,0,0,0) + but_animated_normal.border = \ + but_animated_borderless.border = (0, 0, 0, 0) #add widgets to the main layout layout.add_widget(left_frame) @@ -138,8 +143,8 @@ class mainApp(App): def build(self): upl = mainclass() - upl.size_hint = (1,1) - upl.pos_hint = {'top':0, 'right':1} + upl.size_hint = (1, 1) + upl.pos_hint = {'top': 0, 'right': 1} return upl diff --git a/examples/widgets/sequenced_images/uix/custom_button.py b/examples/widgets/sequenced_images/uix/custom_button.py index 00b12353eb..7e3e1b2bb9 100644 --- a/examples/widgets/sequenced_images/uix/custom_button.py +++ b/examples/widgets/sequenced_images/uix/custom_button.py @@ -5,27 +5,20 @@ from kivy.uix.label import Label from kivy.uix.image import Image from kivy.graphics import * -from kivy.properties import StringProperty, OptionProperty,\ - ObjectProperty, BooleanProperty +from kivy.properties import StringProperty, OptionProperty, \ + ObjectProperty, BooleanProperty class AnimatedButton(Label): state = OptionProperty('normal', options=('normal', 'down')) - allow_stretch = BooleanProperty(True) - keep_ratio = BooleanProperty(False) - border = ObjectProperty(None) - anim_delay = ObjectProperty(None) - background_normal = StringProperty( - 'atlas://data/images/defaulttheme/button') - + 'atlas://data/images/defaulttheme/button') texture_background = ObjectProperty(None) - background_down = StringProperty( 'atlas://data/images/defaulttheme/button_pressed') @@ -37,22 +30,28 @@ def __init__(self, **kwargs): #borderImage.border by default is ... self.border = (16, 16, 16, 16) #Image to display depending on state - self.img = Image(source = self.background_normal, - allow_stretch = self.allow_stretch, - keep_ratio = self.keep_ratio, mipmap = True) + self.img = Image( + source=self.background_normal, + allow_stretch=self.allow_stretch, + keep_ratio=self.keep_ratio, + mipmap=True) + #reset animation if anim_delay is changed def anim_reset(*l): self.img.anim_delay = self.anim_delay - self.bind(anim_delay = anim_reset) + + self.bind(anim_delay=anim_reset) self.anim_delay = .1 #update self.texture when image.texture changes - self.img.bind(texture = self.on_tex_changed) + self.img.bind(texture=self.on_tex_changed) self.on_tex_changed() + #update image source when background image is changed def background_changed(*l): self.img.source = self.background_normal self.anim_delay = .1 - self.bind(background_normal = background_changed) + + self.bind(background_normal=background_changed) def on_tex_changed(self, *largs): self.texture_background = self.img.texture diff --git a/examples/widgets/shorten_text.py b/examples/widgets/shorten_text.py index 3f0be1696a..bbde229398 100644 --- a/examples/widgets/shorten_text.py +++ b/examples/widgets/shorten_text.py @@ -71,6 +71,7 @@ text: 'Michaelangelo Smith' ''' + class ShortenText(App): def build(self): return Builder.load_string(kv) diff --git a/examples/widgets/spinner.py b/examples/widgets/spinner.py index 13034c2af6..751c50417f 100644 --- a/examples/widgets/spinner.py +++ b/examples/widgets/spinner.py @@ -7,6 +7,7 @@ size_hint=(None, None), size=(100, 44), pos_hint={'center_x': .5, 'center_y': .5}) + def show_selected_value(spinner, text): print('The spinner', spinner, 'have text', text) diff --git a/examples/widgets/tabbedpanel.py b/examples/widgets/tabbedpanel.py index 49fcb3bb22..67b1223abb 100644 --- a/examples/widgets/tabbedpanel.py +++ b/examples/widgets/tabbedpanel.py @@ -35,9 +35,11 @@ """) + class Test(TabbedPanel): pass + class TabbedPanelApp(App): def build(self): return Test() diff --git a/examples/widgets/unicode_textinput.py b/examples/widgets/unicode_textinput.py index 7dc1c43ab7..c306f254ca 100644 --- a/examples/widgets/unicode_textinput.py +++ b/examples/widgets/unicode_textinput.py @@ -10,8 +10,7 @@ import os -Builder.load_string( -''' +Builder.load_string(''' #: import utils kivy #: import os os #: import font pygame.font @@ -110,9 +109,11 @@ (filechooser.path, filechooser.selection) ''') + class FntSpinnerOption(SpinnerOption): pass + class LoadDialog(FloatLayout): load = ObjectProperty(None) cancel = ObjectProperty(None) @@ -121,7 +122,7 @@ class LoadDialog(FloatLayout): class Unicode_TextInput(BoxLayout): txt_input = ObjectProperty(None) - unicode_string = StringProperty('''Latin-1 suppliment: éé çç ßß + unicode_string = StringProperty('''Latin-1 supplement: éé çç ßß List of major languages taken from Google Translate ____________________________________________________ @@ -198,14 +199,13 @@ def dismiss_popup(self): def load(self, _path, _fname): self.txt_input.font_name = _fname[0] - _f_name = _fname[0][_fname[0].rfind(os.sep) + 1:] + _f_name = _fname[0][_fname[0].rfind(os.sep) + 1:] self.spnr_fnt.text = _f_name[:_f_name.rfind('.')] - self._popup.dismiss() def show_load(self): content = LoadDialog(load=self.load, cancel=self.dismiss_popup) - self._popup = Popup(title="load file", content=content, \ + self._popup = Popup(title="load file", content=content, size_hint=(0.9, 0.9)) self._popup.open() diff --git a/examples/widgets/videoplayer.py b/examples/widgets/videoplayer.py index 0c38eea830..41284036be 100644 --- a/examples/widgets/videoplayer.py +++ b/examples/widgets/videoplayer.py @@ -10,6 +10,7 @@ #for example try h264 video and acc audo for android using an mp4 #container + class VideoPlayerApp(App): def build(self):