morevnaproject-org / papagayo-ng

Papagayo is a lip-syncing program designed to help you line up phonemes (mouth shapes) with the actual recorded sound of actors speaking. Papagayo makes it easy to lip sync animated characters by making the process very simple - just type in the words being spoken (or copy/paste them from the animation's script), then drag the words on top of the sound's waveform until they line up with the proper sounds.
236 stars 51 forks source link

Python 3 Port #6

Closed steveway closed 3 years ago

steveway commented 8 years ago

I've created a first version of a port to python3 and phoenix http://wiki.wxpython.org/ProjectPhoenix It works mostly, but is a bit hacky and seems to be not as smooth. If anyone wants to test this then you can find it here: https://github.com/steveway/papagayo-1/tree/py3phoenix Not sure if I personally want to muck around with the python 3 / phoenix port, spent the whole day on it today and I currently don't want to see it, glad I got it to mostly work.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/32786978-python-3-port?utm_campaign=plugin&utm_content=tracker%2F418652&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F418652&utm_medium=issues&utm_source=github).
steveway commented 8 years ago

Just a note about the smootheness, it actually runs pretty much exactly like the regular version on Python 2 with wxPython 3.0.2.0 here. So, it's not that bad maybe.

morevnaproject commented 8 years ago

Great work, @steveway! I need some time to test this. ^__^

morevnaproject commented 8 years ago

To be honest, this issue made me think a lot.

From one side, migration to Python 3 is essential, because Python 2 gets outdated.

From the other side, I found no easy way to install wxPython Phoenix on my Ubuntu Linux. There are no such package. The only installation method I found is PIP, but honestly I didn't tested it. If we migrate to Phoenix, this will make difficult for users to install Papagayo.

From the third side, the amount of work you done is too significant to be neglected. I really want to keep it.

I have found that it is possible to make the same Python code run on both Python 2 and 3. So I have made a few tweaks to your code, so it should run fine on both conditions. The code is merged into master branch now.

Regarding the future of Papagayo and Python3 - I have many doubts about Phoenix, since it isn't included into major linux distros and thus making distributing of Papagayo harder.

One of the promising options is to port from wxPython to PyQt5. But this is surely not a trivial task.

Thank you for contributing!

steveway commented 8 years ago

Yeah, I see what you mean. While porting this to phoenix I was a bit annoyed while looking up the status of developement of all things regarding wx. While I like QT, I'm not to fond of it's different competing python bindings, also the kinda competing different ways to create user interfaces are a bit annoying, in my humble opinion. Since I had a tiny bit of experience with another graphical framework for python, I've actually looked into porting papagayo to kivy, or rather rewriting it more. I haven't started yet on this but would like to try this when I've got the time and desire to tackle this. It would open up a few more possibilities, like compability with android and ios. Also, yes you are right, it should support both python 3 and 2.

MaskedRetriever commented 8 years ago

Agreed on all counts. Also the wxPhoenix code introduced a flicker bug that I haven't been able to fix in my merge branch. (I want upstream to have my beautiful scroll wheel code!)

andeon commented 8 years ago

Recently, I upgrade to Ubuntu 16.04 and check that not have support to papagayo.

I tried use this script to update papagayo code: https://anonscm.debian.org/cgit/collab-maint/wx-migration-tools.git/tree/wxpy30-update It change few things, but not enough to work. I just tried :)

I also was trying read the https://wxpython.org/migrationguide.php, but a bit hard to me.

Any tip to run the Papagayo?

steveway commented 8 years ago

Oh, you are talking about wxPython 3.0, I thought you meant wxPhoenix, so my answer below refers to that. What exactly fails if you try this with wxPython 3.0? I haven't tested this yet myself with the current version of papagayo.

Change line 722 in WaveformView.py to something like this:

        try:
            dc.EndDrawing()
        except AttributeError:
            print(_("EndDrawing is not support by WxPhoenix."))

And replace papagayo-ng.py with this:

#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
#
# generated by wxGlade 0.7.0 on Sat Apr 16 23:14:31 2016
#

# This is an automatically generated file.
# Manual changes will be overwritten without warning!

import warnings
try:
    import wxversion
except ImportError:
    pass
try:
    if wxversion.checkInstalled('2.8'):
        wxversion.select('2.8')
    else:
        warnings.warn("You are running an unsupported Version of wx. Please test this with wx Version 2.8 before reporting errors!")
except NameError:
    warnings.warn("Wxversion was not found. Please test this with wx Version 2.8 before reporting errors!")
import wx
import os
import sys
import gettext
from LipsyncFrame import LipsyncFrame

class LipsyncApp(wx.App):
    def OnInit(self):
        wx.InitAllImageHandlers()
        self.mainFrame = LipsyncFrame(None, wx.ID_ANY, "")
        self.SetTopWindow(self.mainFrame)
        self.mainFrame.Show()
        return 1

# end of class LipsyncApp

if __name__ == "__main__":
    try:
        gettext.install("papagayo-ng", unicode=True) # Python 2
    except TypeError:
        gettext.install("papagayo-ng") # Python 3
    papagayo = LipsyncApp(0)
    papagayo.mainFrame.TheApp = papagayo
    papagayo.mainFrame.waveformView.TheApp = papagayo
    if len(sys.argv) > 1:
        papagayo.mainFrame.Open(os.path.abspath(sys.argv[1]))
    papagayo.MainLoop()

With these changes it works here on Windows with Python 3.5.1 and the current snapshot of WxPhoenix.

andeon commented 8 years ago

Oh, wxPhoenix I dont have it!

So, I tried a little bit and now I got it. I gonna update my repository with the old code now it works on ubuntu 16.04.

andeon commented 8 years ago

Here: https://github.com/andeon/papagayo/commit/fe8dfdf8f02632fdf7cdf85e3fb5fd67d6b6558f It work on both of Ubuntus LTS (on derivatives too)

morevnaproject commented 8 years ago

@andeon Thanks for fixes! I have applied your changes to the master branch. Please check if the latest commit on master will work for you. ^__^

andeon commented 8 years ago

@morevnaproject I test it in Ubuntu, need check the textbox "spoken text". It works but is not possible see, I tried to resize and maximize window but not show the textbox in Ubuntu 14.04

Spoken text

And the "right click mouse" not edit the "breakdown" words in waveform view in Ubuntu 14.04 and Ubuntu 16.04.

I created a .deb package to previous version: https://github.com/andeon/papagayo/releases while we wait for fixes and improvements from NG version!

steveway commented 3 years ago

We switched to using QT via PySide2 for some time now. It works smoother than before and has now a lot more features.