add up to 3 decimals precision to the frame rate settings (#4571)

* add up to 3 decimals to fps

allows input 23.976 to the FPS settings both in Project Manager and the Project Anatomy.

* set fps and pixel aspect precision steps default values
This commit is contained in:
Alexey Bogomolov 2023-03-08 12:38:23 +03:00 committed by GitHub
parent 499348d4b2
commit fb0f39b3cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 6 deletions

View file

@ -10,7 +10,7 @@
"type": "number",
"key": "fps",
"label": "Frame Rate",
"decimal": 2,
"decimal": 3,
"minimum": 0
},
{

View file

@ -83,15 +83,18 @@ class NumberDelegate(QtWidgets.QStyledItemDelegate):
decimals(int): How many decimal points can be used. Float will be used
as value if is higher than 0.
"""
def __init__(self, minimum, maximum, decimals, *args, **kwargs):
def __init__(self, minimum, maximum, decimals, step, *args, **kwargs):
super(NumberDelegate, self).__init__(*args, **kwargs)
self.minimum = minimum
self.maximum = maximum
self.decimals = decimals
self.step = step
def createEditor(self, parent, option, index):
if self.decimals > 0:
editor = DoubleSpinBoxScrollFixed(parent)
editor.setSingleStep(self.step)
editor.setDecimals(self.decimals)
else:
editor = SpinBoxScrollFixed(parent)

View file

@ -26,10 +26,11 @@ class NameDef:
class NumberDef:
def __init__(self, minimum=None, maximum=None, decimals=None):
def __init__(self, minimum=None, maximum=None, decimals=None, step=None):
self.minimum = 0 if minimum is None else minimum
self.maximum = 999999999 if maximum is None else maximum
self.decimals = 0 if decimals is None else decimals
self.step = 1 if decimals is None else step
class TypeDef:
@ -73,14 +74,14 @@ class HierarchyView(QtWidgets.QTreeView):
"type": TypeDef(),
"frameStart": NumberDef(1),
"frameEnd": NumberDef(1),
"fps": NumberDef(1, decimals=2),
"fps": NumberDef(1, decimals=3, step=1),
"resolutionWidth": NumberDef(0),
"resolutionHeight": NumberDef(0),
"handleStart": NumberDef(0),
"handleEnd": NumberDef(0),
"clipIn": NumberDef(1),
"clipOut": NumberDef(1),
"pixelAspect": NumberDef(0, decimals=2),
"pixelAspect": NumberDef(0, decimals=2, step=0.01),
"tools_env": ToolsDef()
}
@ -96,6 +97,10 @@ class HierarchyView(QtWidgets.QTreeView):
"stretch": QtWidgets.QHeaderView.Interactive,
"width": 140
},
"fps": {
"stretch": QtWidgets.QHeaderView.Interactive,
"width": 65
},
"tools_env": {
"stretch": QtWidgets.QHeaderView.Interactive,
"width": 200
@ -148,7 +153,8 @@ class HierarchyView(QtWidgets.QTreeView):
delegate = NumberDelegate(
item_type.minimum,
item_type.maximum,
item_type.decimals
item_type.decimals,
item_type.step
)
elif isinstance(item_type, TypeDef):