An interface for developing campaigns ...

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

Post Reply
lwa
Inactive Developer
Posts: 271
Joined: June 11th, 2005, 8:19 am
Location: Paris, France

Post by lwa »

allefant wrote:Thanks, so now I know it can run on any of the 3 OSes :) I'll change the first line of campgen.pyw to call pythonw. Or maybe I'll find out if there's a standard way to do this.
The Mac OS X way is to make an application bundle. I can make a install kit for you, but it should be more easy if sources were located in a subdirectory. Also think about an icon for the app. Another point is that Mac OS X 10.4 python version is 2.3.5. I had some warning on first launch but be unable to reproduce them now.
allefant wrote:Something else, are the standard pathes correct? I don't know anything about OSX, so not sure it understands the "~" in the pathes.
Apparently no. When I saved a campaign, I got the following errors

Code: Select all

Campaign Directory: ~/Library/Preferences/Wesnoth/data/campaigns/No_Name
Traceback (most recent call last):
  File "/Users/lwa/Download/campgen-0.6/gui_main.py", line 279, in OnSave
    cfgfile.save_campaign(self)
(...)
RuntimeError: maximum recursion depth exceeded
And nothing is saved. You should rather use HOME environment variable or get the home with getpwuid/getpwnam (or python equivalents).

Also, the map editor distributed with the Mac OS X binary image has a bad name "Map Editor (Official)". It's uneasy to set its path until this would be fixed. The main problem with that is the file browser doesn't allow you to find the executables into Application bundles. If you want to support this, you have to check if user selected a directory sufixed by .app, parse the Info.plist inside to get the executable path. As you don't have a Mac, it will be hairy for you. On my side, I don't known python.

If you just want ot launch an application in background on Mac OS X, you can use the "open" command, for example :

Code: Select all

open -a "Battle for Wesnoth"
You will get an error if the application can't be found.
You can even send file arguments but I don't know if they will be recognized by Wesnoth apps.
ILikeProgramming
Posts: 837
Joined: April 14th, 2005, 4:17 am

Post by ILikeProgramming »

Python Shell wrote:Reading daytimelist.txt
Reading musiclist.txt

Traceback (most recent call last):
File "C:\Program Files\Wesnoth\campgen-0.6\campgen.pyw", line 21, in ?
app = gui_main.MyApp(0)
File "C:\PROGRA~1\Python23\lib\site-packages\wxPython\wx.py", line 1957, in __init__
_wxStart(self.OnInit)
File "C:\Program Files\Wesnoth\campgen-0.6\gui_main.py", line 527, in OnInit
self.show_preferences()
File "C:\Program Files\Wesnoth\campgen-0.6\gui_main.py", line 497, in show_preferences
dialog = gui_preferences.MyDialog(None, -1, "")
File "C:\Program Files\Wesnoth\campgen-0.6\gui_preferences.py", line 50, in __init__
self.__set_properties()
File "C:\Program Files\Wesnoth\campgen-0.6\gui_preferences.py", line 67, in __set_properties
self.edit_image_dir.SetMinSize((300,0))
AttributeError: wxTextCtrl instance has no attribute 'SetMinSize'
Why doesn't it work? I'm using it on Windows.
Uppi

Post by Uppi »

ILikeProgramming wrote:
Python Shell wrote:Reading daytimelist.txt
Reading musiclist.txt

Traceback (most recent call last):
File "C:\Program Files\Wesnoth\campgen-0.6\campgen.pyw", line 21, in ?
app = gui_main.MyApp(0)
File "C:\PROGRA~1\Python23\lib\site-packages\wxPython\wx.py", line 1957, in __init__
_wxStart(self.OnInit)
File "C:\Program Files\Wesnoth\campgen-0.6\gui_main.py", line 527, in OnInit
self.show_preferences()
File "C:\Program Files\Wesnoth\campgen-0.6\gui_main.py", line 497, in show_preferences
dialog = gui_preferences.MyDialog(None, -1, "")
File "C:\Program Files\Wesnoth\campgen-0.6\gui_preferences.py", line 50, in __init__
self.__set_properties()
File "C:\Program Files\Wesnoth\campgen-0.6\gui_preferences.py", line 67, in __set_properties
self.edit_image_dir.SetMinSize((300,0))
AttributeError: wxTextCtrl instance has no attribute 'SetMinSize'
Why doesn't it work? I'm using it on Windows.
Are you sure, that you are using wxpython 2.6.1?
ILikeProgramming
Posts: 837
Joined: April 14th, 2005, 4:17 am

Post by ILikeProgramming »

I reinstalled wx and it worked.
User avatar
allefant
Units Database Administrator
Posts: 516
Joined: May 6th, 2005, 3:04 pm

Post by allefant »

Could you please include the following lines at the beginning of gui_main.py (before the imports):

Code:

import wxversion
wxversion.select("2.6")


This will prevent python from loading the 2.4 version of wxpython on systems with both versions installed.
Thanks, done.
The Mac OS X way is to make an application bundle. I can make a install kit for you, but it should be more easy if sources were located in a subdirectory. Also think about an icon for the app. Another point is that Mac OS X 10.4 python version is 2.3.5. I had some warning on first launch but be unable to reproduce them now.
Should I move all .py files into a directory called "src"?
And nothing is saved. You should rather use HOME environment variable or get the home with getpwuid/getpwnam (or python equivalents).
Ok, I'll try that. In windows, I use the $ProgramFiles environment variable, in unix, python has a function to replace ~ in a path by the home dir. I'll try with $HOME in OSX.
[..]
You will get an error if the application can't be found.
You can even send file arguments but I don't know if they will be recognized by Wesnoth apps.
In Unix and Windows, I pass the name of the mapfile, so the editor opens that map, and saves again on exiting. So it's almost completely integrated.

I'll ask in #python for a soluteion. Could I send you a PM to try their solution, if I get any?
Lugo Moll
Posts: 123
Joined: August 1st, 2005, 11:15 am
Location: Sweden

Post by Lugo Moll »

Hmm... I made a small campain. The interface worked fine. The thing is, I can't play it.

I can see my campain icon in the list, and when I click it, some window flashes by and I have to exit Wesnoth. I'm using Windows XP.

Otherwise this is indeed a great program.
"Oh, what sad times are these when passing ruffians can say Ni at will to old ladies."
-Roger the shrubber
ILikeProgramming
Posts: 837
Joined: April 14th, 2005, 4:17 am

Post by ILikeProgramming »

allefant wrote: Should I move all .py files into a directory called "src"?
I think this is a good idea. However, do you know a way to access "data" from src without specifying the full path?
lwa
Inactive Developer
Posts: 271
Joined: June 11th, 2005, 8:19 am
Location: Paris, France

Post by lwa »

allefant wrote: Should I move all .py files into a directory called "src"?
Put whatever is required to run the app in subdirectories.
Just let the docs on top.

I will only write a small shell script to copy the stuff into the bundle, so users may move it where they want. Subdirectories will avoid to copy the bundle into the bundle itself :-)

Notice that Mac OS X has python 2.3.5. If a greater version is required, this will make the app unusable unless users install a recent python by theyre own way, which may be hairy for most of them.
allefant wrote: Ok, I'll try that. In windows, I use the $ProgramFiles environment variable, in unix, python has a function to replace ~ in a path by the home dir. I'll try with $HOME in OSX.
$HOME shall work on Unix too. As Mac OS X is a unix too, it's strange the function don't work.
allefant wrote: I'll ask in #python for a soluteion. Could I send you a PM to try their solution, if I get any?
Of course.
User avatar
Tomsik
Posts: 1401
Joined: February 7th, 2005, 7:04 am
Location: Poland

Post by Tomsik »

bug spotted! in gui_campaign.py you have path 'C:\\Dokumente und Einstellungen\\root\\Eigene Dateien\\prog\\python\\campgen\\data\\empty.png' !
better replace it with './data/empty.png'
do you know a way to access "data" from src without specifying the full path?
maybe '.. ./data/(something)' will work, but im at least not sure
User avatar
allefant
Units Database Administrator
Posts: 516
Joined: May 6th, 2005, 3:04 pm

Post by allefant »

Hmm... I made a small campain. The interface worked fine. The thing is, I can't play it.
Yes, I just see, I messed something up with the map path :/ The campaign you created will (most likely) with with version 0.7 though. Or you can open the scenario file (camapgins/xxx/1_xxx.cfg), and where it says mapdata=<absolute_path>, change it to mapdata="{@campaigns/xxx/maps/mapname}". Or just wait for version 0.7 on the next weekend.

[Edit: Actually, that change I made after the release.. so not sure. Make sure you have a map with at least two starting spots, and at least two sides. Or you can zip up the campaign and send to me if you want..]

It's an alpha version, so you are mostly a guinea pig so far.. :)
Notice that Mac OS X has python 2.3.5. If a greater version is required, this will make the app unusable unless users install a recent python by theyre own way, which may be hairy for most of them.
Ok. The #python people told me of the new cool "syspath" module which supports opening of apps in a cross-platform way, available with python 2.4 :P
I think this is a good idea. However, do you know a way to access "data" from src without specifying the full path?
Not sure. Under unix, I probably should install it all to /usr/local somewhere.. but for now, I'll try with "../data/".
bug spotted! in gui_campaign.py
Thanks, someone already mentioned it above. Should teach me not to do last minute changes.
Last edited by allefant on September 5th, 2005, 9:30 pm, edited 1 time in total.
lwa
Inactive Developer
Posts: 271
Joined: June 11th, 2005, 8:19 am
Location: Paris, France

Post by lwa »

allefant wrote:Not sure. Under unix, I probably should install it all to /usr/local somewhere.. but for now, I'll try with "../data/".
Use variables (ex: datadir).
lwa
Inactive Developer
Posts: 271
Joined: June 11th, 2005, 8:19 am
Location: Paris, France

Post by lwa »

allefant wrote:Ok. The #python people told me of the new cool "syspath" module which supports opening of apps in a cross-platform way, available with python 2.4 :P
Is it an optional module or is it standart in 2.4 ?

Now you have to choose if you want a more easy development using new functions for new Python or reach more users but program workaround beeing compatible.

Anyway, add something supported version in the documentation to avoid frustrations.
User avatar
allefant
Units Database Administrator
Posts: 516
Joined: May 6th, 2005, 3:04 pm

Post by allefant »

It's an official new module: http://python.org/doc/2.4.1/lib/module-subprocess.html (and i got the name wrong before). But i downgraded my debian sid's python to 2.3 for now, so that will be the requirement, and $HOME should work.
User avatar
Tomsik
Posts: 1401
Joined: February 7th, 2005, 7:04 am
Location: Poland

Post by Tomsik »

ive experimented with py2exe, i compiled 0.5, but even if i only place place file for py2exe in 0.6 dir it gives error :?
lwa
Inactive Developer
Posts: 271
Joined: June 11th, 2005, 8:19 am
Location: Paris, France

Post by lwa »

According python website, here are the python versions shipped with Mac OS X:
Mac OS X 10.2 python 2.2
Mac OS X 10.3 python 2.3
Mac OS X 10.4 python 2.3.5
Theyre is also unofficial package for Mac OS X 10.3 and more to install python 2.4.1

Theyre is echos that current Wesnoth build does not work with Mac OS X 10.2 but it should be compilable by hand. Anyway, this is a old version and few remains around.
Post Reply