andreikop / enki

A text editor for programmers
http://enki-editor.org
GNU General Public License v2.0
161 stars 39 forks source link

Windows installation issues #376

Closed andreikop closed 8 years ago

andreikop commented 8 years ago

I tried to install Enki on my home Windows with v15.11.0 installer and got the error failed-to-start on Enki startup.

Than I tried to build my own installer with Pyinstaller 3.0 and got

Traceback (most recent call last):
  File "<string>", line 20, in <module>
  File "c:\github\enki\enki\main.py", line 277, in main
    core.init(profiler, cmdLine)
  File "c:\github\enki\enki\core\core.py", line 138, in init
    self._loadPlugin(name)
  File "c:\github\enki\enki\core\core.py", line 204, in _loadPlugin
    exec("import enki.plugins.%s as module" % name)  # pylint: disable=W0122
  File "<string>", line 1, in <module>
  File "c:\github\enki\dist\enki\enki\plugins\appshortcuts\__init__.py", line 31, in <module>
    from action_shortcut_editor import ActionShortcutEditor
  File "c:\github\enki\dist\enki\enki\plugins\appshortcuts\action_shortcut_editor.py", line 14, in <module>
    from enki.widgets.lineedit import LineEdit
ImportError: No module named lineedit

when executing the binary

Minor issue. Enki logos in the installer and in the menu look badly on windows. Can we try to use svg?

andreikop commented 8 years ago

... @bjones1, could you try to build the binary on Pyinstaller3? You are better with it

andreikop commented 8 years ago

Forgot to mention one more thing. I have this build problem on branch hotfix-15.11.1. If you managed to build it - publish it or send to me for publishing.

bjones1 commented 8 years ago

Hmmm. Strange. I'll take a look! Probably after I get tests passing...

bjones1 commented 8 years ago

I pushed a missing commit to the hotfix branch and got the py2.7 version building. It's at https://www.dropbox.com/s/uw698j3es48832r/Install_Enki.exe?dl=0, since I'm not sure where to publish this.

bjones1 commented 8 years ago

Re: Enki logo in the installer, I don't know how to fix this. Per http://www.jrsoftware.org/ishelp/index.php?topic=setup_wizardimagefile, this size of limited and VERY small. What do you mean that the Enki logo in the menu looks bad?

bjones1 commented 8 years ago

Oh, you mean the icon at the very left of the menu bar? If so, it must be an icon (see https://htmlpreview.github.io/?https://github.com/pyinstaller/pyinstaller/blob/develop/doc/Manual.html#windows-and-mac-os-x-specific-options). http://stackoverflow.com/questions/3236115/which-icon-sizes-should-my-windows-applications-icon-include has a nice discussion of icon sizes we can include.

andreikop commented 8 years ago

Sorry for not clear explanation. I mean

bjones1 commented 8 years ago

Looking a bit, we need Enki PNG images at 16x16 (missing), 32x32 (have already), 48x48 (have already), and 256x256 (missing). There's a 128x128 existing, but it should be deleted. Then, a tool like http://icoconvert.com/Multi_Image_to_one_icon/ would hopefully produce a since .ico file from these images, since a single .ico can hold several images in various sizes.

bjones1 commented 8 years ago

I updated both of these, but haven't tried them yet...

Note on tools: I use the (free) Greenfish icon editor pro to create the icon. I used Adobe Illustrator CS2 to save the .SVG in various resolutions. A bit of Paint and Irfanview to update the installer logo.

bjones1 commented 8 years ago

I now have all Windows tests passing in Py3/Qt5. Thanks for doing the port -- that's a lot of work and I'm really excited to be using modern tools. Now, I'm working on packaging. I can't reproduce the error you had above, but found another minor PyQt5 packaging bug I'll fix in PyInstaller. I'll comment here when that's ready.

On a side note -- I deleted the 128x128 Enki icon, then realized that it might be used for Linux. Should I restore it? Or was that actually unused?

andreikop commented 8 years ago

Will see about icon. I'm happy you have the tests passing. They still freeze and crash for me on Linux Mint. Trying to understand why

bjones1 commented 8 years ago

I'm currently running the tests 100 times on Windows to see how stable they are. I'll let you know when I have some results.

What version of Mint? I can try to reproduce there. Occasional failures are so hard to debug.

andreikop commented 8 years ago

17.3 mate edition. I have freezes on 2 desktops but old laptop with the same os works fine 7 янв. 2016 г. 18:47 пользователь "Bryan A. Jones" notifications@github.com написал:

I'm currently running the tests 100 times on Windows to see how stable they are. I'll let you know when I have some results.

What version of Mint? I can try to reproduce there. Occasional failures are so hard to debug.

— Reply to this email directly or view it on GitHub https://github.com/hlamer/enki/issues/376#issuecomment-169701847.

bjones1 commented 8 years ago

Hmmm. I ran about 150 iterations of the tests, with 1 crash (no useful traceback, unfortunately), and 1 warning from QFileSystemWatcher, complaining that the test directory was deleted.

An idea: There are still some instances of _del__ in the code. Perhaps removing them would help.

An idea: a debug build of Python and PyQt -- would the traceback help?

An idea: what if base.py could avoid using exec_ when running the test function? (Perhaps better, use processEvents instead of the exec_ after func completed?) Something like (untested code):

def inMainLoop(func, *args):
    """Decorator executes test method in the QApplication main loop.
    QAction shortcuts doesn't work, if main loop is not running.
    Do not use for tests, which doesn't use main loop, because it slows down execution.
    """
    def wrapper(*args):
        core.mainWindow().show()
        QTest.qWaitForWindowExposed(core.mainWindow())
        app = QApplication.instance()
        app.setActiveWindow(core.mainWindow())
        assert app.focusWidget() is not None
        func(*args)

        QTimer.singleShot(0, QApplication.instance().quit)

        # Catch any exceptions which the EventLoop would otherwise catch
        # and not re-raise.
        exceptions = []

        def excepthook(type_, value, tracebackObj):
            exceptions.append((value, tracebackObj))
            QApplication.instance().exit()
        oldExcHook = sys.excepthook
        sys.excepthook = excepthook

        try:
            # Run the requested function in the application's main loop.
            QApplication.instance().exec_()
            # If an exception occurred in the event loop, re-raise it.
            if exceptions:
                value, tracebackObj = exceptions[0]
                raise value.with_traceback(tracebackObj)
        finally:
            # Restore the old exception hook
            sys.excepthook = oldExcHook

    wrapper.__name__ = func.__name__  # for unittest test runner
    return wrapper
bjones1 commented 8 years ago

Packaging now works with the latest PyInstaller.

andreikop commented 8 years ago

An idea: There are still some instances of _del__ in the code. Perhaps removing them would help. This is good idea in any case.

An idea: a debug build of Python and PyQt -- would the traceback help?

Probably it cool. But need to dive deeply to the Qt sources. Debug build shows that Qt locks internally when trying to connect signal or do some other primitive operation

An idea: what if base.py could avoid using exec_ when running the test function?

Since I have freezes if Qt main loop is not running, I moved another direction and tried to execute all in main loop. https://github.com/hlamer/enki/blob/singleloop/tests/run_all.py#L18 It is better but still bad. Now Qt randomly crashes after any other loop has been run. I.e. QMessageBox.warning('blabla') runs a loop internally. I'll probably try the latest Qt.

bjones1 commented 8 years ago

I'll work on removing __del__ unless you want to. I'll try out the tests on Linux when I get a chance. On a side note, I now have access to a Mac and got Enki up and running on it. I'll try packaging with PyInstaller so we can provide Mac binaries for the next release.

andreikop commented 8 years ago

Bryan, I tried to make icons from original SVG in enki-art repository Converted with Inkspace. Antialiasing switched on in the settings. My localy built version starts without the error in my first image. Could you check if it installs fine and starts on your computer? See https://github.com/hlamer/enki/releases/tag/untagged-789c79488cc1d50b0f69

andreikop commented 8 years ago

.ico file was generated by http://www.icoconverter.com/ according to your SO link.

bjones1 commented 8 years ago

Installs and runs just time! The icons looks good. The image in the installer needs a bit of whitespace around the border. This was win7.

bjones1 commented 8 years ago

How did you get the binary so small? I usually end up with about 40 MB for the installer .exe.

andreikop commented 8 years ago

Hmm. Probably missed something :-/ I used PyInstaller develop branch.

On Sat, Jan 9, 2016 at 7:21 PM, Bryan A. Jones notifications@github.com wrote:

How did you get the binary so small? I usually end up with about 40 MB for the installer .exe.

— Reply to this email directly or view it on GitHub https://github.com/hlamer/enki/issues/376#issuecomment-170257429.

bjones1 commented 8 years ago

I haven't checked the size after building with Python 3.0, just with 2.7. Perhaps things work a bit differently there...

andreikop commented 8 years ago

PyInstaller is v3. Python is still 2.7

I recreated the installer logo. Now it has more space.

bjones1 commented 8 years ago

OK, I see. Perhaps you have fewer libraries installed, so PyInstaller includes less junk. I need to build in a virtualenv with only the minimum installed to make Enki run.

Thanks for the updated logo!