mu-editor / mu

A small, simple editor for beginner Python programmers. Written in Python and Qt5.
http://codewith.mu
GNU General Public License v3.0
1.42k stars 437 forks source link

macOS tab close button is missing? #397

Closed carlosperate closed 6 years ago

carlosperate commented 6 years ago

Not sure how this has happened, or if maybe this is only on my current environment. So hoping other macOS users can replicate.

Basically this is the way Mu currently looks for me. The tab doesn't show the close button any more:

image

There is a clear space on the left side of the tab name, and if you click there it will close the tab, but that's it.

Tested on the latest master at the time of writting: 6121350e5261df15cd7542fa938c2e0aab6b4fc2

carlosperate commented 6 years ago

Looking at older screenshots from https://github.com/mu-editor/mu/issues/387 this was already an issue for a while:

image
ZanderBrown commented 6 years ago

So clearly I didn't break it :smile:!

Looking at the screenshot it's trying to put the close button on the left, which would make some sense, is there any hover / click sensitivity there at all?

ZanderBrown commented 6 years ago

An upstream bug Are you running against Qt 5.9.0 perhaps?

This looks interesting

carlosperate commented 6 years ago

Does that mean that changing the tab mode to "documet mode" would be a work around? To be honest, after reading the Qt documentation I don't quite understand what that does.

ZanderBrown commented 6 years ago

I'm not sure that it'll help with the close button (probably need newer/older Qt5 for that) but it should improve the behaviour of tabs, currently, they are working more like pages in a dialogue than documents on macOS

From my non-mac owning or using perspective I believe that property will change the tabs alignment and populate the Window menu but from the less than explanator docs much of its effect has already been achieved through CSS

Basically try it and see what happens?

ntoll commented 6 years ago

Hmmm... so the problem persists in Qt5.10 on OSX (I just checked). I'll report upstream since they believe it fixed.

ntoll commented 6 years ago

FYI: https://bugreports.qt.io/browse/QTBUG-61092?focusedCommentId=396123&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-396123

ntoll commented 6 years ago

@ZanderBrown WRT setDocumentMode(True), this does, indeed, make the tabs behave more like on Windows and Linux.

I've messed about with CSS to see we've broken something, but alas, it appears to be a regression in Qt5.10. :-(

ntoll commented 6 years ago

OK... this is definitely a bug in Qt5.10. I just left a comment in their bug tracker which says this appears only when you modify things (not even the QTabBar) with custom CSS. If I delete the contents of the day theme css file, the icon magically appears for me on OSX with QT5.10.

I guess we need to wait for upstream to fix this. :-/

carlosperate commented 6 years ago

I can confirm I was using PyQT 5.10.1 when I opened this issue, and PyQt 5.9.2 doesn't work either.

So https://bugreports.qt.io/browse/QTBUG-66213 is also the bug causing issues.

If the next release takes long we can set PyQt to version 5.8.2 (and Qscintilla to v2.10) until the issue is resolved upstream. I can confirm this version does work:

image
> pip freeze
alabaster==0.7.10
altgraph==0.15
appdirs==1.4.3
appnope==0.1.0
asn1crypto==0.24.0
attrs==17.4.0
Automat==0.6.0
Babel==2.5.3
beautifulsoup4==4.6.0
certifi==2018.1.18
cffi==1.11.5
chardet==3.0.4
constantly==15.1.0
cryptography==2.1.4
cssselect==1.0.3
cycler==0.10.0
decorator==4.2.1
docutils==0.14
future==0.16.0
hyperlink==18.0.0
idna==2.6
imagesize==1.0.0
incremental==17.5.0
ipykernel==4.8.2
ipython==6.2.1
ipython-genutils==0.2.0
jedi==0.11.1
Jinja2==2.10
jupyter-client==5.2.2
jupyter-core==4.4.0
kiwisolver==1.0.1
lxml==4.1.1
macholib==1.9
MarkupSafe==1.0
matplotlib==2.2.0
numpy==1.14.1
packaging==17.1
parsel==1.4.0
parso==0.1.1
pefile==2017.11.5
pexpect==4.4.0
pgzero==1.2
pickleshare==0.7.4
pkginfo==1.4.1
pluggy==0.6.0
prompt-toolkit==1.0.15
ptyprocess==0.5.2
py==1.5.2
pyasn1==0.4.2
pyasn1-modules==0.2.1
pycodestyle==2.3.1
pycparser==2.18
PyDispatcher==2.0.5
pyflakes==1.6.0
pygame==1.9.3
Pygments==2.2.0
PyInstaller==3.3.1
pynsist==2.1
pyOpenSSL==17.5.0
pyparsing==2.2.0
PyQt5==5.8.2
PyQtChart==5.10.1
pyserial==3.4
pytest==3.4.2
pytest-cov==2.5.1
pytest-faulthandler==1.4.1
python-dateutil==2.6.1
pytz==2018.3
pyzmq==17.0.0
QScintilla==2.10
qtconsole==4.3.1
queuelib==1.4.2
requests==2.18.4
requests-download==0.1.2
requests-toolbelt==0.8.0
Scrapy==1.5.0
service-identity==17.0.0
simplegeneric==0.8.1
sip==4.19.8
six==1.11.0
snowballstemmer==1.2.1
Sphinx==1.7.1
sphinxcontrib-websupport==1.0.1
tornado==5.0
tqdm==4.19.6
traitlets==4.3.2
twine==1.10.0
Twisted==17.9.0
urllib3==1.22
w3lib==1.19.0
wcwidth==0.1.7
win-cli-launchers==0.1
yarg==0.1.9
zope.interface==4.4.3
ntoll commented 6 years ago

Does PyQtChart still work in this configuration..?

carlosperate commented 6 years ago

The option is not shown as a button, so I guess the answer is no.

I guess it needs Qt 5.10. From the REPL:

>>> from PyQt5 import QtChart
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/microbit-carlos/.local/share/virtualenvs/mu-upstream-umoz5JlW/lib/python3.6/site-packages/PyQt5/QtChart.so, 2): Library not loaded: @rpath/QtWidgets.framework/Versions/5/QtWidgets
  Referenced from: /Users/microbit-carlos/.local/share/virtualenvs/mu-upstream-umoz5JlW/lib/python3.6/site-packages/PyQt5/QtChart.so
  Reason: Incompatible library version: QtChart.so requires version 5.10.0 or later, but QtWidgets provides version 5.8.0

Looks like https://github.com/mu-editor/mu/blob/981c909c3ca33f71a983fa4d1a50cbaace4fc36e/mu/interface/panes.py#L40-L45 takes care processing that incompatibility, might be a good idea to log it as well, as I couldn't find anything in the generated log:

Starting Mu 1.0.0.beta.15
2018-03-20 14:54:41,751 - root:95(run) INFO: uname_result(system='Darwin', node='Carlos-MBP.local', release='17.4.0', version='Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64', machine='x86_64', processor='i386')
2018-03-20 14:54:41,751 - root:96(run) INFO: Python path: ['/Users/microbit-carlos/workspace/mine/mu-upstream', '/Users/microbit-carlos/.local/share/virtualenvs/mu-upstream-umoz5JlW/lib/python36.zip', '/Users/microbit-carlos/.local/share/virtualenvs/mu-upstream-umoz5JlW/lib/python3.6', '/Users/microbit-carlos/.local/share/virtualenvs/mu-upstream-umoz5JlW/lib/python3.6/lib-dynload', '/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/Users/microbit-carlos/.local/share/virtualenvs/mu-upstream-umoz5JlW/lib/python3.6/site-packages', '/Users/microbit-carlos/.local/share/virtualenvs/mu-upstream-umoz5JlW/lib/python3.6/site-packages/IPython/extensions']
2018-03-20 14:54:41,961 - mu.logic:499(__init__) INFO: Setting up editor.
2018-03-20 14:54:41,961 - mu.logic:510(__init__) INFO: Settings path: /Users/microbit-carlos/Library/Application Support/mu/settings.json
2018-03-20 14:54:41,961 - mu.logic:511(__init__) INFO: Session path: /Users/microbit-carlos/Library/Application Support/mu/session.json
2018-03-20 14:54:41,962 - mu.logic:512(__init__) INFO: Log directory: /Users/microbit-carlos/Library/Logs/mu
2018-03-20 14:54:41,962 - mu.logic:513(__init__) INFO: Data directory: /Users/microbit-carlos/Library/Application Support/mu
2018-03-20 14:54:41,990 - mu.logic:521(setup) INFO: Available modes: python, adafruit, microbit, debugger, pygamezero
2018-03-20 14:54:42,599 - mu.logic:856(change_mode) INFO: Workspace directory: /Users/microbit-carlos/mu_code
2018-03-20 14:54:42,599 - mu.logic:560(restore_session) INFO: Restoring session from: /Users/microbit-carlos/Library/Application Support/mu/session.json
2018-03-20 14:54:42,599 - mu.logic:561(restore_session) DEBUG: {'theme': 'day', 'mode': 'python', 'paths': []}
2018-03-20 14:54:42,599 - mu.logic:580(restore_session) INFO: Loaded files.
2018-03-20 14:54:42,643 - mu.logic:589(restore_session) INFO: Starting with blank file.
2018-03-20 14:54:42,653 - mu.logic:856(change_mode) INFO: Workspace directory: /Users/microbit-carlos/mu_code
2018-03-20 14:54:43,219 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:43,896 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:44,881 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:45,883 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:46,883 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:47,882 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:48,884 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:49,690 - mu.logic:822(select_mode) INFO: Showing available modes: ['python', 'adafruit', 'microbit', 'debugger', 'pygamezero']
2018-03-20 14:54:50,122 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:50,882 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:51,885 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:51,903 - mu.logic:856(change_mode) INFO: Workspace directory: /Users/microbit-carlos/mu_code
2018-03-20 14:54:52,882 - mu.modes.base:127(find_device) INFO: Found device on port: cu.usbmodem14632
2018-03-20 14:54:53,056 - mu.logic:811(show_logs) INFO: Showing logs from /Users/microbit-carlos/Library/Logs/mu/mu.log
ntoll commented 6 years ago

Good catch WRT logging the missing QCharts. I'll address that now.

WRT the missing close button... I guess we need to wait for upstream Qt to fix the bug.

carlosperate commented 6 years ago

PyQtChart 5.8 does work though. So it would need PyQt 5.8.2, PyQtChart 5.8, and Qscintilla to v2.10.

I would expect the next PyQt5 release before Mu v1 is released, otherwise we know which versions of PyQt and deps we need.

ntoll commented 6 years ago

Aha... OK... perhaps these could be the basis of new minimum requirements for things like Debian and setup.py. Nice find! :-)

willingc commented 6 years ago

FYI I replicated the issue. While doing so, I realize that the functionality of close still works in the area that the close element would be. The close element is not displayed, but you can close each tab. On Mac 10.13.3.

mutab

ZanderBrown commented 6 years ago

Do you know what Qt version your running against? (Out of interest what happens with setDocumentMode(True)?)

ntoll commented 6 years ago

This confirms the behaviour I was observing with latest Qt.

It appears to be a problem in Qt itself and there's not anything we can do about it until upstream fix this (see the links to related tickets in Qt in the comments above).

@ZanderBrown I've also been experimenting with setDocumentMode(True) on Mac and while this makes the tabs on OSX look the same as in Windows and Linux, it changes some of the CSS attributes (specifically the borders) and ends up looking worse (to my untrained eye).

I guess this is a case of "wait and see" for upstream.

ZanderBrown commented 6 years ago

Unfortunately I don't really have access to a mac but I may investigate that further if I get a chance

Had a slightly left of field idea about a workaround for the close icon though

ntoll commented 6 years ago

This is fixed by #425 which I merged today.