[pull request] Images in the encyclopedia

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

[pull request] Images in the encyclopedia

#1 Post by Mitten.O » Tue Sep 08, 2015 7:18 pm

Now that the release is done, it is once more time for wild, excessive pull requests!

So, I was playing freeorion after a fairly long break, and I was failing even more than usual at remembering the suitability wheel. I remembered that awesome, clear picture of it in the wiki and though, "Man, I wish I could look at that in-game, in some convenient place, like the suitability report." Then I realized I am a programmer and can have anything I can be bothered to make.

But hard coding a static graphic to a specific encyclopedia page seemed a bit ugly. Too ad-hoc. So I decided to enable adding any image to any encyclopedia page. The natural way to do this was to embed StaticGraphic controls. But it seemed a bit arbitrary to just support one kind of control, so I made the infrastructure support embedding any control that can be flowed nicely into the text.

I may have gone slightly overboard, but hey, it works, and I like having the wheel there, so I'm happy.

Here is the pull request, with a more technical explanation of the thing, and an image: https://github.com/freeorion/freeorion/pull/332
Any code by me in this post is released under GPL 2.0 or later.

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: [pull request] Images in the encyclopedia

#2 Post by MatGB » Tue Sep 08, 2015 9:13 pm

The technical stuff in the PR goes way over my head, but the ability to add graphics in, especially that specific graphic in that specific place, is brilliant.

Um, can I request a comment somewhere telling me how to embed an image in a different entry as I'm not figuring it out in the text (it should be doable from the default folder text files, right?)
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Sloth
Content Scripter
Posts: 685
Joined: Sat Mar 17, 2007 12:28 am

Re: [pull request] Images in the encyclopedia

#3 Post by Sloth » Tue Sep 08, 2015 9:37 pm

That's a nice option to have! This suggestion in the graphics section will be one step closer to realisation: viewtopic.php?f=10&t=9730
All released under the GNU GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0 licences.

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: [pull request] Images in the encyclopedia

#4 Post by Mitten.O » Wed Sep 09, 2015 8:11 pm

Um, can I request a comment somewhere telling me how to embed an image in a different entry as I'm not figuring it out in the text (it should be doable from the default folder text files, right?)
Oh, right! I mention this in the commit messages, but the format for an image tag is <img src="path relative to default/data/art/"></img>. It should work in any string shown in the encyclopedia window.
Any code by me in this post is released under GPL 2.0 or later.

User avatar
The Silent One
Graphics
Posts: 712
Joined: Tue Jul 01, 2003 8:27 pm

Re: [pull request] Images in the encyclopedia

#5 Post by The Silent One » Mon Sep 28, 2015 9:52 pm

Mitten.O wrote:So I decided to enable adding any image to any encyclopedia page.
Just saw this in game, very nice! I updated the EP wheel image (higher resolution, transparent background), if someone would kindly commit it?
Attachments
EP_wheel.png
EP_wheel.png (92.41 KiB) Viewed 1163 times
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12280
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: [pull request] Images in the encyclopedia

#6 Post by Geoff the Medio » Mon Sep 28, 2015 9:53 pm

A version without english works in the image is needed.

User avatar
The Silent One
Graphics
Posts: 712
Joined: Tue Jul 01, 2003 8:27 pm

Re: [pull request] Images in the encyclopedia

#7 Post by The Silent One » Mon Sep 28, 2015 9:57 pm

There you go.
Attachments
EP_wheel.png
EP_wheel.png (83.38 KiB) Viewed 1160 times
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: [pull request] Images in the encyclopedia

#8 Post by MatGB » Mon Sep 28, 2015 10:07 pm

Geoff the Medio wrote:A version without english works in the image is needed.
*cough&without English words*cough* but yes, agreed, it's rather nice but needs further explanation.

Also, and previously unknown to me, we have no explanation easily accessible in the Pedia for environmental types or descriptions thereof, at all. Which would partially explain why people find it confusing.

Um, if anyone wants to write such a guide? I could but I'm half way through so many unfinished projects...
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12280
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: [pull request] Images in the encyclopedia

#9 Post by Geoff the Medio » Mon Sep 28, 2015 10:16 pm

The Silent One wrote:There you go.
Can't / don't want to make a pull request...?

User avatar
Vezzra
Release Manager, Design
Posts: 4674
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: [pull request] Images in the encyclopedia

#10 Post by Vezzra » Mon Sep 28, 2015 11:24 pm

Geoff the Medio wrote:
The Silent One wrote:There you go.
Can't / don't want to make a pull request...?
In his case: why not commit it himself? @TheSilentOne: you are aware that you have commit access to the repo...?

User avatar
The Silent One
Graphics
Posts: 712
Joined: Tue Jul 01, 2003 8:27 pm

Re: [pull request] Images in the encyclopedia

#11 Post by The Silent One » Tue Sep 29, 2015 7:45 am

Vezzra wrote:
Geoff the Medio wrote:
The Silent One wrote:There you go.
Can't / don't want to make a pull request...?
In his case: why not commit it himself? @TheSilentOne: you are aware that you have commit access to the repo...?
Sorry, but I'm not very familiar with Github. For commiting I have so far used a very complicated solution where I had to do a lot of manual work, which I don't want to continue. (I forked the fo master, from which I then created pull requests. However, I didn't find a viable solution how to keep my fork synced with master, I always had to reset it manually).
Reading about the github workflow they tell me I should first create a branch from master, then a pull request which can then be merged, which is what I did for this picture now. Is that how I should do it? And should I delete the branch afterwards?
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12280
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: [pull request] Images in the encyclopedia

#12 Post by Geoff the Medio » Tue Sep 29, 2015 8:06 am

If you're just going to commit and push some relatively simple changes to master, and don't want / need feedback before doing so, I don't think there's any need to make a separate branch, make a pull request from it, and then merge it... You could just commit to your local master branch and push it to github. For a more complicated series of separate commits that work together and need feedback and updating, a branch would make sense. (Although I suspect adrian_broher or others might have a different view on this...)

User avatar
The Silent One
Graphics
Posts: 712
Joined: Tue Jul 01, 2003 8:27 pm

Re: [pull request] Images in the encyclopedia

#13 Post by The Silent One » Tue Sep 29, 2015 8:35 am

Thanks, I think I've got it now. One more thing: should I delete my branch after it has been merged?
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12280
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: [pull request] Images in the encyclopedia

#14 Post by Geoff the Medio » Tue Sep 29, 2015 8:40 am

If it's under the freeorion project branches, yes. If its on your own account's repositories, up to you.

User avatar
Vezzra
Release Manager, Design
Posts: 4674
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: [pull request] Images in the encyclopedia

#15 Post by Vezzra » Tue Sep 29, 2015 3:39 pm

The Silent One wrote:Sorry, but I'm not very familiar with Github. For commiting I have so far used a very complicated solution where I had to do a lot of manual work, which I don't want to continue.
Well, as Geoff already said, you don't need to use the github workflow of pull requests at all. For someone with commit access like you the git client of your choice is completely sufficient (you are familiar with git, right?). Unless you want to put up a patch for review/feedback, then you want to create a PR.

Those who don't have commit access will have to use PRs all the time of course.
However, I didn't find a viable solution how to keep my fork synced with master, I always had to reset it manually
Clone the freeorion repo locally, add your fork as another remote (or the other way round, which will change which remote the default "origin" is). After that it's just pulling changes from the FO repo and pushing them regularly to your fork.
And should I delete the branch afterwards?
If a branch has been merged and you don't plan to use it for further development, there's no point in keeping it.

Post Reply