Skip to content

Commit

Permalink
More formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
einarf committed Nov 28, 2024
1 parent 0b1940c commit 51d09d2
Show file tree
Hide file tree
Showing 16 changed files with 9 additions and 25 deletions.
5 changes: 3 additions & 2 deletions examples/advanced/fragment_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ def on_mouse_press_event(self, x, y, button):

# mouse coordinates starts in upper left corner
# pixel positions starts and lower left corner
pos = int(x * self.wnd.pixel_ratio), int(
self.wnd.buffer_height - (y * self.wnd.pixel_ratio)
pos = (
int(x * self.wnd.pixel_ratio),
int(self.wnd.buffer_height - (y * self.wnd.pixel_ratio)),
)
print("Picking mouse position", x, y)
print("Viewport position", pos)
Expand Down
1 change: 0 additions & 1 deletion examples/advanced/tetrahedral_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def __init__(self, **kwargs):
self.total_elapsed = 0

def on_render(self, time: float, frametime: float):

# Render background
self.ctx.wireframe = False
if not self.with_blending:
Expand Down
1 change: 0 additions & 1 deletion examples/integration_imgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def render_ui(self):
imgui.new_frame()
if imgui.begin_main_menu_bar():
if imgui.begin_menu("File", True):

clicked_quit, selected_quit = imgui.menu_item("Quit", "Cmd+Q", False, True)

if clicked_quit:
Expand Down
1 change: 0 additions & 1 deletion examples/integration_imgui_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def render_ui(self):
imgui.new_frame()
if imgui.begin_main_menu_bar():
if imgui.begin_menu("File", True):

clicked_quit, selected_quit = imgui.menu_item("Quit", "Cmd+Q", False, True)

if clicked_quit:
Expand Down
2 changes: 0 additions & 2 deletions examples/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class Decoder:

def __init__(self, path: Union[str, Path]):
self.container = av.open(str(path))
self.video = self.container.streams[0]
Expand Down Expand Up @@ -80,7 +79,6 @@ def gen_frames(self):


class Player:

def __init__(self, ctx: moderngl.Context, path: Union[str, Path]):
self._ctx = ctx
self._path = path
Expand Down
2 changes: 0 additions & 2 deletions moderngl_window/capture/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def __init__(
source: Union[moderngl.Texture, moderngl.Framebuffer],
framerate: Union[int, float] = 60,
):

self._source = source
self._framerate = framerate

Expand Down Expand Up @@ -141,7 +140,6 @@ def save(self) -> None:
dt = 1.0 / self._framerate

if self._timer.time - self._last_time > dt:

# start counting
self._last_time = self._timer.time

Expand Down
1 change: 0 additions & 1 deletion moderngl_window/context/pygame2/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ def process_events(self) -> None:
self.resize(event.size[0], event.size[1])

elif event.type == pygame.ACTIVEEVENT:

# # We might support these in the future
# Mouse cursor state
# if event.state == 0:
Expand Down
3 changes: 1 addition & 2 deletions moderngl_window/geometry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from moderngl_window.geometry.attributes import \
AttributeNames as AttributeNames
from moderngl_window.geometry.attributes import AttributeNames as AttributeNames
from moderngl_window.geometry.bbox import bbox as bbox
from moderngl_window.geometry.cube import cube as cube
from moderngl_window.geometry.quad import quad_2d as quad_2d
Expand Down
2 changes: 1 addition & 1 deletion moderngl_window/geometry/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def cube(
size: tuple[float, float, float] = (1.0, 1.0, 1.0),
center: tuple[float, float, float]=(0.0, 0.0, 0.0),
center: tuple[float, float, float] = (0.0, 0.0, 0.0),
normals: bool = True,
uvs: bool = True,
name: Optional[str] = None,
Expand Down
1 change: 0 additions & 1 deletion moderngl_window/integrations/imgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def unicode_char_entered(self, char):


class ModernGLRenderer(BaseOpenGLRenderer):

VERTEX_SHADER_SRC = """
#version 330
uniform mat4 ProjMtx;
Expand Down
1 change: 0 additions & 1 deletion moderngl_window/integrations/imgui_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def shutdown(self):


class ModernGLRenderer(BaseOpenGLRenderer):

VERTEX_SHADER_SRC = """
#version 330
uniform mat4 ProjMtx;
Expand Down
2 changes: 0 additions & 2 deletions moderngl_window/loaders/scene/gltf2.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ def __init__(self, data: dict[str, Any]):
self.accessor = None

def __init__(self, data: dict[str, Any], meta: SceneDescription):

self.meta = meta
self.name = data.get("name", "")
self.primitives = [GLTFMesh.Primitives(p) for p in data["primitives"]]
Expand All @@ -462,7 +461,6 @@ def load(self, materials: list[Material]) -> list[Mesh]:
# Read all primitives as separate meshes for now
# According to the spec they can have different materials and vertex format
for primitive in self.primitives:

vao = VAO(self.name, mode=primitive.mode or moderngl.TRIANGLES)

# Index buffer
Expand Down
2 changes: 1 addition & 1 deletion moderngl_window/meta/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
flip_y: bool = True,
mipmap: bool = False,
mipmap_levels: Optional[tuple[int, int]] = None,
anisotropy: float =1.0,
anisotropy: float = 1.0,
image: Optional[Image] = None,
layers: Optional[int] = None,
pos_x: Optional[str] = None,
Expand Down
6 changes: 2 additions & 4 deletions moderngl_window/opengl/vao.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def content(self, attributes: list[str]) -> Optional[tuple[object, ...]]:
formats = []
attrs = []
for attrib_format, attrib in zip(self.attrib_formats, self.attributes):

if attrib not in attributes:
formats.append(attrib_format.pad_str())
continue
Expand Down Expand Up @@ -92,7 +91,7 @@ class VAO:
Represents a vertex array object.
This is a wrapper class over ``moderngl.VertexArray`` to make interactions
with programs/shaders simpler. Named buffers are added correspoding with
with programs/shaders simpler. Named buffers are added corresponding with
attribute names in a vertex shader. When rendering the VAO an internal
``moderngl.VertextArray`` is created automatically mapping the named buffers
compatible with the supplied program. This program is cached internally.
Expand Down Expand Up @@ -153,7 +152,7 @@ def __init__(self, name: str = "", mode: int = moderngl.TRIANGLES):

@property
def ctx(self) -> moderngl.Context:
"""moderngl.Context: The actite moderngl context"""
"""moderngl.Context: The active moderngl context"""
return mglw.ctx()

def render(
Expand Down Expand Up @@ -339,7 +338,6 @@ def instance(self, program: moderngl.Program) -> moderngl.VertexArray:

# Make sure all attributes are covered
for attrib_name in program_attributes:

# Do we have a buffer mapping to this attribute?
if not sum(buffer.has_attribute(attrib_name) for buffer in self._buffers):
raise VAOError(
Expand Down
1 change: 0 additions & 1 deletion moderngl_window/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from moderngl_window.exceptions import ImproperlyConfigured
from moderngl_window.resources.data import data as data
from moderngl_window.resources.programs import programs as programs
# from moderngl_window.resources.tracks import tracks # noqa
from moderngl_window.resources.scenes import scenes as scenes
from moderngl_window.resources.textures import TextureAny as TextureAny
from moderngl_window.resources.textures import textures as textures
Expand Down
3 changes: 1 addition & 2 deletions moderngl_window/text/bitmapped/text_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import numpy

from moderngl_window import resources
from moderngl_window.meta import (DataDescription, ProgramDescription,
TextureDescription)
from moderngl_window.meta import DataDescription, ProgramDescription, TextureDescription
from moderngl_window.opengl.vao import VAO

from .base import BaseText, FontMeta
Expand Down

0 comments on commit 51d09d2

Please sign in to comment.