mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
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:
parent
499348d4b2
commit
fb0f39b3cc
3 changed files with 15 additions and 6 deletions
|
|
@ -10,7 +10,7 @@
|
|||
"type": "number",
|
||||
"key": "fps",
|
||||
"label": "Frame Rate",
|
||||
"decimal": 2,
|
||||
"decimal": 3,
|
||||
"minimum": 0
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue