An interface for developing campaigns ...
Moderator: Forum Moderators
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:Thanks, so now I know it can run on any of the 3 OSesI'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.
Apparently no. When I saved a campaign, I got the following errorsallefant wrote:Something else, are the standard pathes correct? I don't know anything about OSX, so not sure it understands the "~" in the pathes.
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
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 can even send file arguments but I don't know if they will be recognized by Wesnoth apps.
-
- Posts: 837
- Joined: April 14th, 2005, 4:17 am
Why doesn't it work? I'm using it on Windows.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'
Are you sure, that you are using wxpython 2.6.1?ILikeProgramming wrote:Why doesn't it work? I'm using it on Windows.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'
Thanks, done.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.
Should I move all .py files into a directory called "src"?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.
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.And nothing is saved. You should rather use HOME environment variable or get the home with getpwuid/getpwnam (or python equivalents).
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.[..]
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.
I'll ask in #python for a soluteion. Could I send you a PM to try their solution, if I get any?
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.
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
-Roger the shrubber
-
- Posts: 837
- Joined: April 14th, 2005, 4:17 am
Put whatever is required to run the app in subdirectories.allefant wrote: Should I move all .py files into a directory called "src"?
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.
$HOME shall work on Unix too. As Mac OS X is a unix too, it's strange the function don't work.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.
Of course.allefant wrote: I'll ask in #python for a soluteion. Could I send you a PM to try their solution, if I get any?
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'
better replace it with './data/empty.png'
maybe '.. ./data/(something)' will work, but im at least not suredo you know a way to access "data" from src without specifying the full path?
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.Hmm... I made a small campain. The interface worked fine. The thing is, I can't play it.
[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..

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.4Notice 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.

Not sure. Under unix, I probably should install it all to /usr/local somewhere.. but for now, I'll try with "../data/".I think this is a good idea. However, do you know a way to access "data" from src without specifying the full path?
Thanks, someone already mentioned it above. Should teach me not to do last minute changes.bug spotted! in gui_campaign.py
Last edited by allefant on September 5th, 2005, 9:30 pm, edited 1 time in total.
Is it an optional module or is it standart in 2.4 ?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
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.
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.
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.
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.