Skip to content

Commit

Permalink
Issue #46: Linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
MattClarkson committed May 27, 2022
1 parent 524d0d1 commit 2c6e366
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions sksurgeryutils/ui/sksurgeryvideocalibration_app.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# coding=utf-8

""" Functions to run video calibration, in interactive or non-interactive mode. """
""" Functions to run video calibration. """

import os
import sys
import cv2
import time
from datetime import datetime
import cv2
from PySide2 import QtWidgets
from PySide2.QtWidgets import QWidget, QHBoxLayout, QApplication
from PySide2.QtCore import QTimer
from sksurgeryvtk.widgets.vtk_overlay_window import VTKOverlayWindow
import sksurgeryimage.calibration.chessboard_point_detector as cpd
import sksurgerycalibration.video.video_calibration_driver_mono as mc

# pylint:disable=too-many-nested-blocks,too-many-branches
# pylint: disable=protected-access,unused-argument,unused-variable


class CalibrationDriver:
Expand Down Expand Up @@ -44,7 +43,8 @@ def __init__(self,
# but each would have their own parameters etc.
method = configuration.get("method", "chessboard")
if method != "chessboard":
raise ValueError("Only chessboard calibration is currently supported")
raise ValueError("Only chessboard calibration"
" is currently supported")

source = configuration.get("source", 0)
window_size = configuration.get("window size", None)
Expand Down Expand Up @@ -164,7 +164,8 @@ def __init__(self,
self.vtk_overlay_window = VTKOverlayWindow()
self.layout.addWidget(self.vtk_overlay_window)

self.keypress_delay_in_milliseconds = configuration.get("keypress delay", 1000)
self.keypress_delay_in_milliseconds \
= configuration.get("keypress delay", 1000)

self.vtk_overlay_window.AddObserver("KeyPressEvent",
self.on_key_press_event)
Expand Down Expand Up @@ -200,7 +201,7 @@ def finalize(self):

def on_key_press_event(self, obj, event):
"""
Called when a key is pressed, if 'q', exit the app, if 'c' capture image.
Called when a key is pressed, if 'q', exit, if 'c' capture image.
"""
if self.vtk_overlay_window.GetKeySym() == 'q':
print("Detected 'q' key press, exiting.")
Expand Down Expand Up @@ -284,7 +285,7 @@ def __init__(self,

def run(self):
"""
Main loop that will process frames from the video source, until no frames.
Process frames from the video source, until no frames.
"""
while True:

Expand Down

0 comments on commit 2c6e366

Please sign in to comment.