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

Make it possible to select the text within tooltip popups #142

Closed
sikmir opened this issue Jul 31, 2018 · 15 comments
Closed

Make it possible to select the text within tooltip popups #142

sikmir opened this issue Jul 31, 2018 · 15 comments

Comments

@sikmir
Copy link
Contributor

sikmir commented Jul 31, 2018

For now, it's impossible to select the text (let's say I want to copy coordinates) from tooltip popup:
screenshot2
I'd like something like that (selecting text from popup in IDE):
screenshot1

@tumic0
Copy link
Owner

tumic0 commented Aug 11, 2018

This makes sense, but the tooltips are now "regular system tooltips" where it is not possible. To enable this (and links - those are now also not possible) the tooltips must be completely reimplemented. This will for sure not be a trivial work so it falls into the category "maybe some day"...

@tumic0
Copy link
Owner

tumic0 commented Oct 13, 2019

Please have a look at the "tooltip" branch which contains custom tooltips that enable copy&paste (using Ctrl+C). The behaviour of items have change - they must now be clicked and there are some other limitations given by "collisions" of click events. The UX has still some glitches, but it is the best I could get to somehow work and enable links and copy&paste. But I'm still not sure if I want to merge it...

@sikmir
Copy link
Contributor Author

sikmir commented Oct 13, 2019

Hmm, using the latest code from tooltip branch I don't see any tooltips at all...

@tumic0
Copy link
Owner

tumic0 commented Oct 13, 2019

You must click on the objects now.

@sikmir
Copy link
Contributor Author

sikmir commented Oct 14, 2019

It would be good to have:

  1. Support for track/route links
  2. Support for multiple links

@tumic0
Copy link
Owner

tumic0 commented Oct 14, 2019

Added in 694847a. But I really doubt that there are some GPX files with multiple links...

@sikmir
Copy link
Contributor Author

sikmir commented Oct 14, 2019

Added in 694847a.

Thanks!

But I really doubt that there are some GPX files with multiple links...

You won't believe, but I extensively use links in GPX files within my collection of tracks;) For example, I usually add one link to "event's homepage" / "report" / "blog post" / "photoalbum available on the web" / whatever, where I can find all details about the track, and one more link usually to GPSies (RIP) / Wikiloc, where the track is occasionally published. As for me, such approach is very handy, if I want quickly find some info about past events.

@tumic0
Copy link
Owner

tumic0 commented Oct 18, 2019

Implemented in master, will be part of 7.16.

@tumic0 tumic0 closed this as completed Oct 18, 2019
@sikmir
Copy link
Contributor Author

sikmir commented Oct 18, 2019

@tumic0 What about GPX 1.0 support? It uses <url> instead of <link>. For example geocaching still provides their points in GPX 1.0 format (link to cache page in <url>).

@tumic0
Copy link
Owner

tumic0 commented Oct 20, 2019

Added in 9905de6.

@sikmir
Copy link
Contributor Author

sikmir commented Oct 21, 2019

@tumic0 One more thing here, I'm looking for a way to get POIs with images (that would be really cool). Currently, it's feasible using geotagged JPG files, but in such case POI ▶ POI files list getting too long obviously (1 entry per POI). What do you think about using <type> (Mime type of content) element of <link>, and show image preview instead of link if link's type is image/jpeg?

@tumic0
Copy link
Owner

tumic0 commented Oct 21, 2019

I do not like the idea to behave different for a link with a specific MIME type. Moreover, there is only place for one image per info at the moment and there can be multiple links. I could hovever add support for some GPX image extension if there is one as this looks like something useful and would be very easy to implement (the image info is already in every waypoint structure).

Or maybe there is some other format that supports waypoint image info (maybe KML, but from what I see its icon tag is connected with a style which is not exactly how I would define the image data is handled in GPXSee).

@sikmir
Copy link
Contributor Author

sikmir commented Oct 21, 2019

I've just found another way:

$ export CID=10401
$ export GC_PHOTOS=~/.local/share/gpxsee/POI/GeocachePhotos
$ mkdir -p $GC_PHOTOS
$ wget -O $GC_PHOTOS/$CID.jpg https://geocaching.su/photos/caches/$CID.jpg
$ cat << EOF > ~/.local/share/gpxsee/POI/geocaching.su.gpx
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="">
  <wpt lat="61.135466700" lon="29.773033300">
    <name>Тропа Хошимина в лесах Карелии</name>
    <desc>&lt;img width=&quot;240&quot; height=&quot;240&quot; src=&quot;file://$GC_PHOTOS/$CID.jpg&quot;/&gt;</desc>
    <link href="https://geocaching.su/?pn=101&amp;cid=$CID"></link>
  </wpt>
</gpx>
EOF

Result:
scr1

@tumic0
Copy link
Owner

tumic0 commented Oct 21, 2019

Yes, this is maybe the easiest way - use HTML in the description ;-).

@sikmir
Copy link
Contributor Author

sikmir commented Oct 21, 2019

Here is a full example of how to get POI+photos (geocaching.su):

#!/usr/bin/env python
import gpxpy
import gpxpy.gpx
from os.path import expanduser
import requests
import shutil

src_url = 'https://nakarte.me/geocachingSu/geocaching_su2.json'
gc_photos = expanduser('~/.local/share/gpxsee/POI/GeocachePhotos')

gpx = gpxpy.gpx.GPX()

for name, cid, lat, lon in requests.get(src_url).json():
    if 58 < lat < 62 and 27 < lon < 36:
        wpt = gpxpy.gpx.GPXWaypoint(lat, lon, name=name)
        wpt.link = 'https://geocaching.su/?pn=101&amp;cid={}'.format(cid)
        photo_url = 'https://geocaching.su/photos/caches/{}.jpg'.format(cid)
        local_photo_url = 'file://{}/{}.jpg'.format(gc_photos, cid)
        with requests.get(photo_url, stream=True) as r:
            if r.status_code == requests.codes.ok:
                with open('{}/{}.jpg'.format(gc_photos, cid), 'wb') as f:
                    shutil.copyfileobj(r.raw, f)
                    wpt.description = '<img width="240" height="240" src="{}"/>'.format(local_photo_url)
        gpx.waypoints.append(wpt)

with open('geocaching.su.gpx', 'w') as out:
    out.write(gpx.to_xml())

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