Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save image dialog box opens if text is pasted in ReText #385

Closed
holzkohlengrill opened this issue Sep 12, 2018 · 5 comments
Closed

Save image dialog box opens if text is pasted in ReText #385

holzkohlengrill opened this issue Sep 12, 2018 · 5 comments

Comments

@holzkohlengrill
Copy link

When I paste text into ReText sometimes it opens the save image dialog box instead of pasting the text. To resolve this I have to paste it first in another plain text editor (like Notepad++, gedit, ...) to paste it in ReText. This happens for me since several major ReText versions.

I still can't give you a totally reproducable scenario for this.

Data when I copy text from ReText:

image

Data when I copy (formatted) text from MS OneNote (this does only sometime occur using OneNote but also with different applications):

image

Text pasted in Notepad++ and then copied again:

image

==============

ReText: 7.1.0 (Git)
PyMarkups: 3.0.0
Qt: 5.10.1
Python: 3.7.0b5

@mitya57
Copy link
Member

mitya57 commented Sep 12, 2018

We are not doing any magic here, and relying on a standard Qt method, QMimeData::hasImage(). So it may indicate a bug somewhere in Qt.

Can you try to actually save the image, and check its contents after saving? Maybe this will give us some clue.

@mitya57
Copy link
Member

mitya57 commented Sep 12, 2018

Actually CF_DIB in your second screenshot is an image — according to the docs it is “a memory object containing a BITMAPINFO structure followed by the bitmap bits”.

So ReText is more or less right here. The question is what should we do when the clipboard contains both image and text data? Maybe we should ignore the image and just paste text?

@holzkohlengrill
Copy link
Author

holzkohlengrill commented Sep 18, 2018

Can you try to actually save the image, and check its contents after saving? Maybe this will give us some clue.

Than python crashes 😄

Connected to pydev debugger (build 181.4892.52)
Using configuration file: C:/Users/holzkohlengrill/AppData/Roaming/ReText project/ReText.ini
Traceback (most recent call last):
  File "C:\Users\holzkohlengrill\AppData\Local\Programs\retext\ReText\editor.py", line 403, in insertFromMimeData
    fileName, link = self.getImageFilenameAndLink()
  File "C:\Users\holzkohlengrill\AppData\Local\Programs\retext\ReText\editor.py", line 393, in getImageFilenameAndLink
    link = os.path.relpath(chosenFileName, saveDir)
  File "C:\Program Files (x86)\Python37-32\lib\ntpath.py", line 564, in relpath
    path_drive, start_drive))
ValueError: path is on mount 'C:', start on mount 'E:'

What is strange is that regardless on which drive (c: or e:) I am trying to save the image I get ValueError: path is on mount 'C:', start on mount 'E:'
Just figured it out: This was because some documents were opened on drive e: (that's where I pasted my clipboard into).

Otherwise (when on drive c:; open documents + saved image) ![image0001](image0001.png) gets pasted into ReText and a proper image (.png) was saved. Proof:

image0001

My proposal would be to paste it as text by default but to add another option in the context menu like "Paste as image" if an image is available in the clipboard (otherwise greyed out).

I did not take a deep look into the drive issue but I expect this is probably a bug which should be fixed.

Have not tried it under Linux yet. Maybe we get a different behaviour here.

mitya57 added a commit that referenced this issue Sep 18, 2018
@mitya57
Copy link
Member

mitya57 commented Sep 18, 2018

This should be fixed now, can you please test?

  • ValueError fixed in 4c24ee3;
  • Paste Image is moved to a separate action in a19d6e6.

@holzkohlengrill
Copy link
Author

Works now smoothly. Tested markdown text:

![image0001](C:/Users/holzkohlengrill/Downloads/0-temp/image0001.png)


```
docker image ls
```

* List Docker containers (running, all, all in quiet mode)
```
docker container ls
docker container ls --all
docker container ls -aq
```

## Docker File
* `Dockerfile` defines what goes on in the environment inside your container.
* Map networking interfaces and disk drives virtualized inside this environment (ports) to the outside world


![image0001](E:/image0001.png)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants