Skip to content

Commit

Permalink
fix menu undefined key
Browse files Browse the repository at this point in the history
  • Loading branch information
arch committed Feb 6, 2022
1 parent 4b6488a commit 605cb3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
7 changes: 4 additions & 3 deletions funscript_editor/ui/funscript_generator_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from funscript_editor.ui.settings_dialog import SettingsDialog
import funscript_editor.definitions as definitions
from funscript_editor.ui.theme import setup_theme
from funscript_editor.utils.config import SETTINGS
from funscript_editor.utils.config import SETTINGS, PROJECTION

from PyQt5 import QtCore, QtGui, QtWidgets

Expand Down Expand Up @@ -122,6 +122,7 @@ def __funscript_generated(self, funscript, msg, success) -> None:
def run(self) -> None:
""" start generator """
self.__logger.info('settings: %s', str(self.settings))
self.settings['videoType'] = list(filter(lambda x: PROJECTION[x]['name'] == self.settings['videoType'], PROJECTION.keys()))[0]
self.funscript_generator = FunscriptGeneratorThread(
FunscriptGeneratorParameter(
video_path = self.video_file,
Expand All @@ -133,10 +134,10 @@ def run(self) -> None:
invert = "inverted" in self.settings['trackingMetric'],
start_frame = self.start_frame,
end_frame = self.end_frame,
number_of_trackers = int(self.settings['numberOfTrackers']),
number_of_trackers = int(self.settings['numberOfTracker']),
points = self.settings['points'].lower().replace(' ', '_'),
additional_points = self.settings['additionalPoints'].lower().replace(' ', '_'),
skip_frames = int(self.settings['skipFrames']),
skip_frames = int(self.settings['processingSpeed']),
top_points_offset = self.settings['topPointOffset'],
bottom_points_offset = self.settings['bottomPointOffset']
),
Expand Down
18 changes: 2 additions & 16 deletions funscript_editor/ui/settings_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ def __save_settings(self):
for key in self.dialog_elements.keys():
if isinstance(self.dialog_elements[key], QtWidgets.QComboBox):
settings[key] = self.dialog_elements[key].currentText()
self.__set_str_setting(key, settings[key])
elif isinstance(self.dialog_elements[key], QtWidgets.QSpinBox):
settings[key] = self.dialog_elements[key].value()
self.__set_number_setting(key, settings[key])
else:
raise NotImplementedError(str(type(self.dialog_elements[key])) + " type is not implemented")

Expand All @@ -97,20 +99,7 @@ def __save_settings(self):

def __setup_ui_bindings(self):
self.ui.okButton.clicked.connect(self.__apply)
self.ui.videoTypeComboBox.currentTextChanged.connect(
lambda value: self.__set_str_setting(
'videoType',
list(filter(lambda x: PROJECTION[x]['name'] == value, PROJECTION.keys()))[0]
)
)
self.ui.trackingMetricComboBox.currentTextChanged.connect(self.__set_tracking_metric)
self.ui.trackingMethodComboBox.currentTextChanged.connect(lambda value: self.__set_str_setting('trackingMethod', value))
self.ui.numberOfTrackerComboBox.currentTextChanged.connect(lambda value: self.__set_str_setting('numberOfTrackers', value))
self.ui.pointsComboBox.currentTextChanged.connect(lambda value: self.__set_str_setting('points', value))
self.ui.additionalPointsComboBox.currentTextChanged.connect(lambda value: self.__set_str_setting('additionalPoints', value))
self.ui.processingSpeedComboBox.currentTextChanged.connect(lambda value: self.__set_str_setting('skipFrames', value))
self.ui.topPointOffsetSpinBox.valueChanged.connect(lambda value: self.__set_number_setting("topPointOffset", value))
self.ui.bottomPointOffsetSpinBox.valueChanged.connect(lambda value: self.__set_number_setting("bottomPointOffset", value))
self.ui.docsButton.clicked.connect(self.__open_documentation)


Expand Down Expand Up @@ -184,9 +173,6 @@ def __set_tracking_metric(self, value):
self.ui.trackingMethodComboBox.setCurrentIndex(index)


self.__set_str_setting('trackingMetric', value)


def __apply(self):
self.__save_settings()
self.form.hide()
Expand Down

0 comments on commit 605cb3c

Please sign in to comment.