I've finished up some of the things I wanted to in PMPC and have decided to release an alpha version. It does not yet support map editing, but it should by the end of this week. If anyone would like to try it out, I would greatly appreciate any bug reports (most should be spit out to pokemodr.exe.txt) and suggestions you may have. If you can think of something that you'd like to modify from the original and you don't see a way to do so in the program, let me know and I'll see if I can get it added.

Right now, I have it compressed as an EXE in 7z format (zip format is over a MB larger even with Ultra compression). If you really need it in zip format, I'll upload it, but 7z is better anyway. If you need 7-zip, you can get it here.

After all that the readme (being built) can be found here and the actual 7z here
Looks very neat. I know that you mentioned servers to me, so would you care to elaborate on how PMPC differs from and is similar to the oncalc version? It seems like a fairly faithful port to me, but the networking aspect sounds exciting.
I would be more interested in the source so that I can try it out on my *nix box.... (just don't make it .7z, as that isn't a common *nix format, do zip or preferably .tar.gz or the better .tar.bz2 )
With how fast the ideas were coming at me for the calc version, it rapidly blew past the 64k limit. I just needed to get them somewhere before I forgot them. This will become a PC version of what I was trying to do on the calc. Eventually, what fits will go back onto the calc as that game. This also has a nice user-friendly interface. the calc modding program was about as un-user-friendly as it can get, but with its size, it's not going to get any better. The server thing is just so that this program can upload PokéMods to the server so that others can play them on the (future) engine.

EDIT:Sources

Code:
Traceback (most recent call last):
  File "pokemodr.py", line 4732, in ?
  File "pokemodr.py", line 4728, in main
  File "pokemodr.py", line 1059, in __init__
  File "pokemodr.py", line 1076, in LoadPrefs
  File "pokemodr.py", line 1090, in SavePrefs
TypeError: cannot concatenate 'str' and 'bool' objects
Traceback (most recent call last):
  File "pokemodr.py", line 1902, in OnEditRuleset
AttributeError: 'NoneType' object has no attribute 'SetValue'


Happened after I changed the rules to RBY and then exited (also, exiting via the little 'x' doesn't ask if you want to save like file->quit does)
Kllrnohj wrote:

Code:
Traceback (most recent call last):
  File "pokemodr.py", line 4732, in ?
  File "pokemodr.py", line 4728, in main
  File "pokemodr.py", line 1059, in __init__
  File "pokemodr.py", line 1076, in LoadPrefs
  File "pokemodr.py", line 1090, in SavePrefs
TypeError: cannot concatenate 'str' and 'bool' objects
Traceback (most recent call last):
  File "pokemodr.py", line 1902, in OnEditRuleset
AttributeError: 'NoneType' object has no attribute 'SetValue'


Happened after I changed the rules to RBY and then exited (also, exiting via the little 'x' doesn't ask if you want to save like file->quit does)

That first part was a mistake due to me adding some prefs but not how they were stored. It'll be pickled in the next upload.

The second is due to me not completely removing one option from the program. It is now.
Just a quick change/fix here...

On line 1090:


Code:
filedata+=x+'='+self.prefs[x]+'\n'


would be better as


Code:
prefsfile.write("%s=%s\n" % (str(x), str(self.prefs[x])))


(the str(x) is just to be safe, as dict keys don't necessarily have to be strings)

For 3 reasons. 1) You won't get wierd string concatenate errors 2) It saves the usage of a variable and 3) it avoids multiple string adding, which is slower, and takes memory as strings aren't mutable, so python has to recreate the entire string every time you add strings, whereas using the built in sprintf() style it can do it all at once

Pickle, of corse, would be better, but the string adding thing would apply to the rest of the program as well....
Kllrnohj wrote:
Pickle, of corse, would be better, but the string adding thing would apply to the rest of the program as well....

I got it into pickling now. I didn't know that about the string adding... I'll search for string adding (major parts any way) and see if I can get it to the string formatted style.
Huh, that sounds fascinating, Kirb. And I know all about trying to cram a lot of features into a calculator program. Very Happy The best of luck getting this all set.
Oh yeah, you might want to intercept the wxFrame::wxEVT_CLOSE_WINDOW event and have it call the same function as your wxMenu ID_QUIT so that you can ask the "do you want to save thing?" if the user closes via the "x" in the top. I *believe* you return True if you want it to close, and False otherwise... (it might be the opposite of that tho Wink )

Edit: Err... not the SAME function, but maybe something like this...


Code:
def Quit2(self, e):
     return self.ClosePokeMod()
I tried it before, but I made an infinite loop. I'll see if I can fix it this time around.

PIL is also no longer needed at all.
kirb wrote:
I tried it before, but I made an infinite loop. I'll see if I can fix it this time around.

PIL is also no longer needed at all.


Calling frame.Destroy() invokes the event wxEVT_CLOSE_WINDOW I believe. So change the quit option to just call frame.Destory() and have wxEVT_CLOSE_WINDOW event pop up and ask for close/save confirmation. The infinite loop would happen if the wxEVT_CLOSE_WINDOW event handler called frame.Destroy(), which would then of course recall the event handler Wink
I got it to ask for saving when quitting.

Code:
def Quit(self, e):
   self.ClosePokeMod()
   if self.ClosePokeMod():
      self.frame.Destroy()

I don't know why it needed self.ClosePokeMod() called twice, but it works and that's all I need. It only asks to save once also, so don't worry about that. I'll upload the new version (with these bug fixes) soon.
Uh... Forget what I originally said...

Here's how it (should) work. The ID_QUIT handler calls wxFrame.Close() function, which in turn generates a close event. The wxCloseEvent handler should check if it can veto ( event.CanVeto() ). If it CANNOT veta it MUST call wxFrame.Destroy(). Otherwise, it should pop up your "Are you sure?" dialog, and call wxFrame.Destroy() if you want to destroy the window, OR you should call wxCloseEvent.Veto() if you do NOT wish to destory the window.

So ID_QUIT function should be similar to


Code:
def menu_Quit(self, e):
   self.Close()


and wxEVT_CLOSE_WINDOW should be


Code:
def win_Close(self, e):
    if (not e.CanVeto()):
         self.Destory()
    else:
         if (self.PokeModrQuit()):
              self.Destroy()
         else:
               e.Veto()


Or something to that effect Smile
I forgot about the vetoing... So now I added "or not e.CanVeto()" to the conditional above to force closing even though the PokeMod isn't closed. That way it still askes if the user wants to save.
The CanVeto is only for the wxEVT_CLOSE_WINDOW event handler....
wx.EVT_CLOSE_WINDOW doesn't exist. wx.CLOSE(self.frame, self.Quit) works though. I think that every event has a CanVeto() on it anyway...

I also just updated the files to the newest builds. Thy're available at the same links as before.
Err... my bad, its just wx.EVT_CLOSE
Here be thy icon, Kirb. Let me know if it meets your specs.

http://www.cemetech.net/img/misc/pmpc.ico

I tried it against several different color backgrounds to make sure it looked good.
Thank you Kerm. It will do very nicely. No more boring white rectangles for the icon now Razz . Now all I have to do is get map editing complete and then it should be ready for something.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement