pyblish / pyblish-qml

Pyblish QML frontend for Maya 2013+, Houdini 11+, Nuke 8+ and more
GNU Lesser General Public License v3.0
115 stars 44 forks source link

Make terminal selectable #50

Open ghost opened 9 years ago

ghost commented 9 years ago

It would be great if we could change the way the terminal behaves.I would week mouse wheel to move up and down. Having said that, instead of left click to do the same, I would use right click. (leaving left click for selection of text).

That would make easier to copy contents of the terminal and send them through email or accessing an URL.

Would that be feasible?

mottosso commented 9 years ago

I'm all for it.

I don't use a mouse so I haven't thought of it, but I could certainly see the value of middle button scrolling. And I like the idea of using left click + drag for selecting, and right click + drag for scrolling. Ideally I'd not introduce scrollbars (for pure cosmetic reasons), but we could potentially have a look at having them too.

mkolar commented 9 years ago

About scrollbars. Without them it took me quite a while to realise that it actually scrolls. Left mouse drag was discovered purely by accident.

Maybe just a not clickable thin indicator (scrollbar like) on the side to show where the current location is in relation to the rest of it's content

mottosso commented 9 years ago

Adding an indicator of sorts is definitely needed, I was thinking of a one-off overlay of sorts hinting towards the ability to scroll.

Having implemented a scrollbar for Perspective, it became obvious that scrollbars are a bit more complex that I first anticipated. It has to do with the fact that the full length of the list isn't known at run-time. Items are generated on-the-fly so as to facilitate large lists, or complex items, like those in the Terminal. The benefit is that there is no performance drop regardless of how many items you have in the list, but the disadvantage is, like I said, no way of telling how long the list actually is. This makes a scrollbar very difficult to get right.

I was considering adding a an "infinite slider" without handle that the user could drag on, just like an actual scrollbar, but without the physical handle. It hasn't been top priority however, as I think it's a very small part of the learning curve and a non-issue afterwards.

The ability to select however is still high on the list.

BigRoy commented 7 years ago

+1 👍. Artists have asked for this feature here too. That is not the scrollbar, but the selectable text!

mottosso commented 7 years ago

I would recommend having a look at making each item selectable, rather than each individual character as is custom in web browsers etc. It'd be a little simpler, with as much value.

Try selecting items in Pyblish Lite for a good reference.

BigRoy commented 7 years ago

I would recommend having a look at making each item selectable, rather than each individual character as is custom in web browsers etc. It'd be a little simpler, with as much value.

What is the item you are referring to? What I'm looking for is a way to selected the documentation text of a plug-in so the artist can easily copy-paste that elsewhere or alike. I'm specifically talking about that text area there.

mottosso commented 7 years ago

This issue is about the Terminal. The Terminal is a ListView, where each line of text is a "item". What I'm saying is that you can make each item selectable, as opposed to each character within each item.

Selecting text in Perspective is a different challenge; I'd open up a separate issue for it.

darkvertex commented 6 years ago

Hi guys! I gave this a quick try the other day cause it annoyed me too when I had some failures and my friends couldn't copy and paste the exception log messages from the Terminal.

I managed to make it selectable and (as far as I could see) render the same EXCEPT it broke "elide" support (that's what adds the "..." at the end of something when it's longer than can fit.)

It's possible to do it by simply swapping use of Label for a TextEdit QML object with readOnly: true and selectByMouse: true, but I got stuck trying to figure out how to "elide" it as it is not a feature of TextEdits. This means it becomes selectable, but if a log entry is very long, it extends freely sideways instead of eliding/wordwrapping.

To try it crudely yourself, duplicate pyblish_qml/qml/Pyblish/Label.qml as, let's say, LabelSelectable.qml, then add the line: LabelSelectable 0.1 LabelSelectable.qml inside pyblish_qml/qml/Pyblish/qmldir and open your pyblish_qml/qml/Pyblish/LabelSelectable.qml file: and near the beginning of the file, where it says:

Text {

swap it for:

TextEdit {

then somewhere inside that block of curly braces, add the lines:

    readOnly: true
    selectByMouse: true

Now you have to find the qml object you want to give selectability superpowers to, for example for LogRecords it appears to be in pyblish_qml/qml/delegates/RecordDelegate.qml where it says:

            Label {

you would swap it for:

            LabelSelectable {

and lower down there is a declaration you need to comment out or it won't work:

                // elide: Text.ElideRight

@mottosso: After some intense googling it seems this could be fixable via use of a TextMetrics object (to be able to correctly compute elided text on its own) and reuse the result elsewhere, like in a TextEdit's "text" property. The problem is it's only available in QtQuick 2.11+ and pyblish-qml uses 2.0-2.6. Do you foresee any major negative side effects to using a newer version of QtQuick to solve this?

Also, how do you feel about LabelSelectable.qml being its own separate file? I'm still quite a QML noob so forgive any dumb question, but is there a reasonable way to reuse/inherit the styling/typography stuff from Label and simply swap the type? Or is there a way to make both Label and LabelSelectable inherit properties from a common file? I'm all ears.

tokejepsen commented 6 years ago

The problem is it's only available in QtQuick 2.11+ and pyblish-qml uses 2.0-2.6. Do you foresee any major negative side effects to using a newer version of QtQuick to solve this?

TextMetrics have been in Qt since 5.4. So don't think it'll be a problem.

mottosso commented 6 years ago

If I'm not mistaken, that approach only lets you select the text within a single row in the list?

To select multiple rows, even all of the output, I would suggest looking into something like this: https://stackoverflow.com/questions/9400002/qml-listview-selected-item-highlight-on-click

With that, you could either click a row and CTRL+C to copy, or if we move scrolling to a scrollbar then we could drag-select multiple rows and copy those.

As another (low hanging fruit) option, we could add a button the the terminal called "Copy" that would copy all of the text into the clipboard, so you could sort out what you wanted elsewhere, like in a text editor.

darkvertex commented 6 years ago

If I'm not mistaken, that approach only lets you select the text within a single row in the list?

Yes, you are correct.

With that, you could either click a row and CTRL+C to copy, or if we move scrolling to a scrollbar then we could drag-select multiple rows and copy those.

That would be very cool!

As another (low hanging fruit) option, we could add a button the the terminal called "Copy" that would copy all of the text into the clipboard, so you could sort out what you wanted elsewhere, like in a text editor.

I like this idea too, it'd make it easy for artists to paste the output to a support ticket when a plugin fails in an unusual manner.