clvLabs/PyATEMMax

switch.setTransitionWipePattern() not working

hallabalint opened this issue · 4 comments

I when I use wipe pattern set switch.setTransitionWipePattern(0, "leftToRight") it get back an key error Traceback (most recent call last): File "D:/Dokumentumok/py/atem/atem.py", line 19, in <module> btn = Button(root, text = 'Click me !', bd = '5', command =macup()) File "D:/Dokumentumok/py/atem/atem.py", line 16, in macup switch.setTransitionWipePattern(0, "leftToRight") File "C:\Users\halla\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PyATEMMax\ATEMSetterMethods.py", line 381, in setTransitionWipePattern pattern_val = self.atem.patternStyles[pattern] File "C:\Users\halla\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PyATEMMax\ATEMConstant.py", line 76, in __getitem__ found = self.byName(item) File "C:\Users\halla\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PyATEMMax\ATEMConstant.py", line 108, in byName return self._values[name] KeyError: 'leftToRight'

How can I fix it?

Try to use leftToRightBar instead of leftToRight...

In the Methods-Set section of the documentation, if you look for setTransitionWipePattern you'll see it says:

    Args:
        mE: see ATEMMixEffects
        pattern: see ATEMPatternStyles

Then, find ATEMPatternStyles in the Protocol constants section of the docs and you'll see the complete list of available options:

swicher.atem.patternStyles

  • leftToRightBar
  • topToBottomBar
  • horizontalBarnDoor
  • verticalBarnDoor
  • cornersInFourBox
  • rectangleIris
  • diamondIris
  • circleIris
  • topLeftBox
  • topRightBox
  • bottomRightBox
  • bottomLeftBox
  • topCentreBox
  • rightCentreBox
  • bottomCentreBox
  • leftCentreBox
  • topLeftDiagonal
  • topRightDiagonal

Please close the issue yourself if you find this solves it for you :)

I also try that. Now the code is: def macup(): switch.setPreviewInputVideoSource(0, camid) switch.setProgramInputVideoSource(0, "color1") switch.setTransitionStyle(0, "wipe") switch.setTransitionWipePattern(0, "leftToRightBar") switch.setKeyerOnAirEnabled(0,0,1)
but the error is same.

I've over-simplified the example code as follows:

import PyATEMMax
switcher = PyATEMMax.ATEMMax()
switcher.connect("192.168.1.111")
switcher.waitForConnection()
switcher.setTransitionWipePattern(0, "leftToRightBar")

and instead of the KeyError: 'leftToRight' now I'm getting this:

Traceback (most recent call last):
  File "dummy.py", line 5, in <module>
    switcher.setTransitionWipePattern(0, "leftToRightBar")
  File "/home/tony/src/python/PyATEMMax/local/PyATEMMax/ATEMSetterMethods.py", line 388, in setTransitionWipePattern
    self.switcher._outBuf.setU8(4, pattern_val)
  File "/home/tony/src/python/PyATEMMax/local/PyATEMMax/ATEMBuffer.py", line 313, in setU8
    self.setInt(offset, False, 8, value)
  File "/home/tony/src/python/PyATEMMax/local/PyATEMMax/ATEMBuffer.py", line 171, in setInt
    packedValue = struct.pack(self._getFormatChar(signed, bits), value)
struct.error: required argument is not an integer

This is a bug in the code, I just found it. It is only related to setTransitionWipePattern().

I will fix the bug and release a version as soon as possible.

In the meanwhile, could you please confirm if the error you're getting with your second attempt is struct.error: required argument is not an integer or you are still getting KeyError: 'leftToRight' ?

If you're still getting KeyError: 'leftToRight' when you use

switch.setTransitionWipePattern(0, "leftToRightBar")

we're talking about something different.

Thanks for the report! :)

Bug has been fixed, version 1.0b4 has been released.

I won't close the issue until you confirm it's working for you.