Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Pidgeot

Pages: 1 ... 16 17 [18] 19
256
But I think we can skip this, the preferred way for updating a pack'd be to pull from a git? repo - if that is even possible. (Is it??)

Github provides a nice "Download ZIP" link to essentially grab the complete repository, but it doesn't include contents of submodules. You'd need special parsing of that to download them individually (but then you might as well just manage them individually...), or a full-blown git client - both are certainly possible, but maybe going a bit too far...

Also, I'm not sure if Github *wants* to have X thousand people doing this on a regular basis... it's not a webhost, so using it as one might be problematic in the long run. That's part of the reason why I  think it's important to not overspecialize this - it's okay to do something special for a particular host, but there needs to be a generic solution in case that host is no longer available.

257
After a lot of searching, it appears there are precisely 2 options to spawn a terminal with reasonable reliability:
What about a fallback to user specified function in pyLNP.json or user.json?
xdg-terminal *seems* reliable enough on its own, but if people have problems, PyLNP.user may need a field for this... we'll cross that bridge when we get to it.

What archive format support is required? I have zip and tar.(bz2|gz) as these are build into python
Personally I'd like to have 7z and/or xz in there eventually, but what you have now should be good enough for a first version. I see Python 3.3 has built-in support for LZMA, but that's no good for Python 2, so a stand-alone implementation would be needed for that.

If a graphics package is updated, is there a need to remove and reinstall the package itself?

I would leave this part out for now. If the user has mods installed, then we'd just end up throwing them out - once a patching system/mod installer is in place, we can consider automatic rebuilding.

258
After a lot of searching, it appears there are precisely 2 options to spawn a terminal with reasonable reliability:
  • Bundle the xdg-terminal script and just run that on Linux, or
  • Reimplement the xdg-terminal script in Python to avoid having another file in there

I can't even just yank out the auto-close feature, because pre-built executables don't necessarily HAVE a terminal window, and dfhack doesn't spawn one itself, causing an immediate crash (and even if I only supported running from source, it'll still break if you close the launcher while dfhack is running, or if you used your file manager to launch the script without a terminal). The only way to avoid the issue is to not allow launching of DFHack on Linux, and that's no good either.

...at least the license for the script ALLOWS these options, and the script just requires /bin/sh, which at least CAN be relied on. This is going to have to wait until tomorrow, though.

259
I think you want to use x-terminal-emulator if it's present, else xdg-terminal, else just let them eat xterm or set a pref.

I have five different VMs installed, and I tested the availability of the three commands you mentioned:
Mint 15/MATE, x64: x-terminal-emulator works, none of the others do.
Mint 16/XFCE, x64:  x-terminal-emulator works, none of the others do.
Mint Debian Edition/MATE, x32: None of the options work.
Fedora 20/MATE, x32: None of the options work.
Arch/MATE, x32: None of the options work.

Something more portable is necessary to make this work satisfactorily on Linux. If nothing is available, then I can always ignore that option on Linux... but that's obviously not ideal.

In my Java launcher I start 'xterm -e path_to_df_executable' when dfhack is enabled. That way you will see a terminal window. It's not the most pretty one (it's good old xterm), but it is included in most Linux distributions, so it's reliable.

Out of the 5 distros I tested, not one of them had xterm available by default. It may make sense to TRY xterm, but it isn't portable enough to stand alone.

260
The "Close GUI when launching DF" option is broken on OS X and Linux when using DFHack - after calling sys.exit() (line 129 of lnp.py), DFHack appears to lose access to the console and displays "Do 'help' or '?' for the list of available commands" repeatedly. A possible solution could be to make run_program() optionally use exec or one of its variants (i.e. when autoClose is enabled).
I'll look into it before releasing a build with this option included.

EDIT: exec* is not an option because utilities need to be launched after DF - so it's necessary to find a way to launch DF as an entirely stand-alone process, with its own terminal window. For Windows, I can use the start command; on OS X, I can use open. I haven't been able to figure out a useful possibility on Linux; I don't see a way to make Python do it directly, and I haven't been able to detect which terminal program the user is using to launch a new one. If anyone knows something I don't, I'm all ears.

261
Changes to d_init.txt and init.txt may need to be treated specially. Maybe just let graphics modify them, then post-process the files with user settings in a script.
Ideally the graphics packs will only change the fields they actually need to change, making this a non-issue.

The way I'm handling it in my launcher is to just read specific fields from the d_init.txt and init.txt files, and only overwrite those. For a full-blown patch system, the easiest way is probably to do just make a full patch and then filter out any extraneous changes to those files (or filter them out during patch creation).

262
I'll try to figure it out, but I guess it's more a local issue or depending on the python image library (PIL) or so.
It's supposed to degrade gracefully if PIL/Pillow isn't available (it's only imported for the ability to display PNGs).

Someone has a Linux machine in a VM or so? Haven't seen the need to set one up yet :)

I'm doing the Windows build natively, but the other 3 builds are all done in VMs. I use Linux Mint with MATE for the 64-bit build and Linux Mint Debian Edition with MATE for the 32-bit build; that's what I based the instructions in the README on.

263
Basic graphics processing can probably be added within the existing framework, though I assume we'll need a non-diff compare logic for image files (messy but not hard).  I'd do that at the same general stage we apply the first round of upgrades, like avoiding flattening / destroying the book title files. 

Don't graphics packs normally only *add* image files, not change them? Unless they change existing file, you really just need to copy over those extra PNGs (and if we want to store them in a single patch file, we could always do something like using Base64 to store the entire file in a plain-text format).

There's certainly a use-case for providing individual tiles to be replaced, but simple image copying should get us pretty far, I'd think, with or without TwbT.

264
Furthermore, the case used in the program matches the current Starter Pack/old LNP exactly, so it is only an issue to people who create a new pack without using an exisiting pack as a template.
Actually, the starter packs I checked (i.e. http://dffd.wimbli.com/file.php?id=7622 and http://dffd.wimbli.com/file.php?id=8936) both use lowercase for their LNP subfolders (like graphics and utilities), the program uses uppercase, that's why I came up with that issue to begin with.

I just checked both of them, and you're right. (The Starter Pack USED to have the first letter in upper case...)

I'll think about what seems like the best choice. I don't really like forcing case-insensitivity on case-sensitive file systems, so maybe I'll just end up allowing all-lowercase as well - we'll see.

That sounds very nice. If you think you can integrate it yourself, feel free to submit a patch (or pull request); leave the download part out, though (that would probably be relevant once auto-updating gets added, but for now it's just *checking*).
The version check is currently only for the pack as a whole, because there's no automated download anyway. (D)DOSing risk is minimal, and there's no requirement to use DFFD at all in the code, so I'm not too worried about that.
Will do that once I'm done, time to create a bitbucket account or are there plans to move to github? :)
I prefer Bitbucket to Github, so no plans to move. :)
Right now I'm working with a JSON file that is read and saved with all the details, i.e. packages(i.e. graphics, utilities etc.) installed, where to find them online (dffd id) and installed version. I plan to extend this to allow for checks of manually installed packages and a way to incorporate them into the version check/upgrade routine.
Currently I only plan to work with dffd as this is probably the most used way and also the easiest way to check for new versions. Not sure if it is worth it to go on with a universal version checker and I have no idea how to approach this...
The only thing you need to make it universal is a complete download URL instead of just a DFFD ID. DFFD is certainly used a lot, so it would be great to support it, but it's not perfect, so pack distributors should be able to use other sources.
Btw the goal is to have it running under Win/Linux/OSX and with python 2 and 3, right?
Currently it doesn't work on my machine with python2 due to some errors with the imagetk library. I will try to write my code python2 compatible anyways, but can't test it under Win or OSX.

That is the goal, yes - many systems still have Python 2 as the default, so I do most of my testing, etc. on that, but try to keep the code Python 3-compatible as well.

It is possible that there are some bugs I didn't catch when running on Python 3, so if you find anything, please submit a bug report.

Regarding your ImageTk issues, throw me a PM or something if you want me to take a look.

Any suggestions where to get started with the UI development/modification? Never did stuff like that before :)

This is my first Python GUI program, so I'm pretty much learning as I go, too :)

The best advice I can give is to just read code and try to see how that leads to whatever layout it puts on screen. When you're trying to add something yourself, make a sketch or mental picture of the UI you want, then add the necessary controls in code and fiddle with the layout until it gets to what you want.

265
- Support for DFhack under Linux/OSX (i.e. see my commits below)

I'm currently working on a DFHack tab; I'll throw this in while I'm at it.

- Linux and OS/X are case sensitive with respect to folder and file names (to my knowledge). Windows is insensitive with this respect. Maybe follow along the lines as suggested here https://stackoverflow.com/questions/8462449/python-case-insensitive-file-name to fix this.

I don't see this as an issue in practice. When running on a case-sensitive file system, you would (as a user) *expect* that case-sensitivity to remain intact. Furthermore, the case used in the program matches the current Starter Pack/old LNP exactly, so it is only an issue to people who create a new pack without using an exisiting pack as a template.

Regarding version check of plugins, I hacked a small script that uses headers to overcome the hurdle imposed by dffd.

That sounds very nice. If you think you can integrate it yourself, feel free to submit a patch (or pull request); leave the download part out, though (that would probably be relevant once auto-updating gets added, but for now it's just *checking*).

As a further development suggestion, one could centralize the version check somewhere and just download a specific file with all the version numbers (I suggest going with updated) instead of DDOSing the dffd server... find it here: https://gist.github.com/MagiX13/651e323c92ab86196a04

The version check is currently only for the pack as a whole, because there's no automated download anyway. (D)DOSing risk is minimal, and there's no requirement to use DFFD at all in the code, so I'm not too worried about that.

I'll be willing to help with development, even though my coding style sucks and I'm rather new to "application" programming, as you can see from here: https://github.com/MagiX13/pyLNP/commits/master

I would be willing to help with the development of this project, but I'm far away from being a reasonable programmer of any kinds...

Looks good enough to me, so don't worry too much about it. :) Besides, if your code is too bad to salvage, I can always just not accept it. :P

266
Work in progress...

Spoiler: Screenshot (click to show/hide)

The preview isn't being drawn correctly, but once I figure that part out, color scheme selection is good to go, and I'll upload a new set of builds.

Each colorscheme is a text file that overwrites colors.txt in the DF folder. The program looks in the folder LNP/Colors for these.

Here's a link to the color schemes I have prepared; just extract to the LNP folder and you'll be ready for the next build: https://www.dropbox.com/s/9175wfuzy1vs05c/Colors.zip

Edit: New builds have been posted.

267
What about tracking versions on the wiki or something? If you can use that to check updates it would hopefully also push adoption of using the wiki to document the mod - what it's for, how to use it, etc.

The wiki works fine, and as long as the page has a sufficiently unique string to look for, it'll work. For example:

Code: [Select]
"checkURL": "http://dwarffortresswiki.org/index.php/Utility:Lazy_Newb_Pack",
"versionRegex": "Lazy Newb Pack Linux V([0-9.]+)",

This reads "0.40.07" from the current wiki page.

Of course, a small text file (a la what DFFD provides through file_version.php) is preferable, because it doesn't need to download as much, and it's easier to make sure it works. If you have a personal web page, you could always just host a small text file yourself; you could also store and update a file in GitHub/BitBucket/whatever and just use a direct link to the newest version (e.g. https://bitbucket.org/Pidgeot/python-lnp/raw/tip/PyLNP.json).

268
- Update notification tool

I'm currently working on this by putting configuration entries in a file specifying a URL containing the version, the pack version, and a regular expression to pull out the latest version number - but DFFD does not allow Python to access the site, so it would be necessary to keep the information elsewhere.

The good part is I've made it general enough that it can really be hosted *anywhere* - GitHub file, forum post, whatever. It just has to be a single, continuous string, with some easily locatable text next to it. As long as Python can access the URL, it can be detected.

Does that include this page too?  http://dffd.wimbli.com/file_version.php?id=7622

That was the exact URL I used to test, so yes.

DFFD can still be used for tbe download (the download page just gets opened in the user's webbrowser, so Python doesn't get involved), but the version number itself currently needs to be somewhere else.

269
The minute you go beyond vanilla diffs, you're creating a custom patch format. This means you need to re-implement patching yourself; existing libraries cannot be reused.
I think some kind of custom format is unavoidable; it just needs to be open.

We don't need a mod managing tool if all we have are mini-mods that can be unzipped on top of a vanilla install.  We also don't get much bang for the buck if we don't store things as diffs of some type (a graphics pack can make tiny changes to lots of large files).

It's unavoidable in the long-term, definitely, but for the short-term, Peridexis is proposing to use a completely standard diff (with the pitfalls that brings along), to provide a more easily attainable starting point.

If you're making a custom format, then you'd prefer to make sure it is as complete (or extensible) as we would ever need, and that's when it takes more time - and you would likely end up with something like (but not necessarily identical to) ModBase.

270
- Update notification tool

I'm currently working on this by putting configuration entries in a file specifying a URL containing the version, the pack version, and a regular expression to pull out the latest version number - but DFFD does not allow Python to access the site, so it would be necessary to keep the information elsewhere.

The good part is I've made it general enough that it can really be hosted *anywhere* - GitHub file, forum post, whatever. It just has to be a single, continuous string, with some easily locatable text next to it. As long as Python can access the URL, it can be detected.

Pages: 1 ... 16 17 [18] 19