Stuff that needs doing

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

Stuff that needs doing

Post  maximinus on Fri Dec 31, 2010 12:04 pm

I know that this project is very me centered (because it's only me doing the code right now) but since this is an open-source project here are some things that need doing, and could be examined / looked at by somebody else. I'll add to this post as and when I think of more things Very Happy

First, is simple code feedback (this is ugly! this could be better!). However, I'd much rather this is constructive, rather than just saying "X sucks".

#1: The game data will need to be saved and loaded. Now we COULD just use a simple binary format, but I'd rather go in the direction of a simple text format so that it is easy to read and modify by hand. Also, the format needs to extensible in that we might add things in the future. Now, until a few SVN commits ago, SPQR DID have a hand-written parser for it's own text files. However, although it worked fine it would have needed tinkering with when the data format got more complex; and also writing parsers is a bit tricky (there are always a load of edge cases).
So, we need to pick and use some other library to make all this easy for us. The obvious answer is XML .... BUT, personally I don't think it looks very readable, Another choice would be YAML, but I know less about that. So some research and testing needs to be done.

GOAL: By the end of today (1st Jan), there will a class GameData in SPQR_Data.py. Code must be able to read and write this file to disk using some text format.

#2: In theory the GUI can have themes, in that if you just change the image files it'll all look different. However, I've never really tested this and I'm sure that something would break along the way. So, to solve this task you would need to quickly make some new images to replace those in the gfx/gui folder, run SPQR and see what happens. Then find out what works / breaks, and how to fix it.

GOAL: Show that a new theme is possible and identify where it is hard.

#3: At the moment, you build the GUI code up by hand. It's similar to pygtk code: you get a window, add widgets to the window, set the callbacks and so on. This all works, but from a design point of view it's horrible. It would be better to have all the window and menu layouts in an external file that is loaded by the game. This file would be in the same format as that from problem 1.

GOAL: See post below

#4: In the GUI part, the code says that the menu MUST be first on the window list. Why is that? Change it so that this is not the case, and then extend the code so that more than one menu is available

GOAL: Add 2 menus. Add a right click menu that is context sensitive.

As always, this forum is primarily to act as a record of what we do, so if you DO decide to work on one of these problems, let us know by posting here! Good Luck Cool


Last edited by maximinus on Sat Jan 01, 2011 8:41 am; edited 1 time in total (Reason for editing : Added goals)
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Fri Dec 31, 2010 6:33 pm

maximinus wrote:I know that this project is very me centered (because it's only me doing the code right now) but since this is an open-source project here are some things that need doing, and could be examined / looked at by somebody else. I'll add to this post as and when I think of more things Very Happy

First, is simple code feedback (this is ugly! this could be better!). However, I'd much rather this is constructive, rather than just saying "X sucks".

#1: The game data will need to be saved and loaded. Now we COULD just use a simple binary format, but I'd rather go in the direction of a simple text format so that it is easy to read and modify by hand. Also, the format needs to extensible in that we might add things in the future. Now, until a few SVN commits ago, SPQR DID have a hand-written parser for it's own text files. However, although it worked fine it would have needed tinkering with when the data format got more complex; and also writing parsers is a bit tricky (there are always a load of edge cases).
So, we need to pick and use some other library to make all this easy for us. The obvious answer is XML .... BUT, personally I don't think it looks very readable, Another choice would be YAML, but I know less about that. So some research and testing needs to be done.

I will start with YAML research (nobody likes to read XML). It would be helpful if you set ( for each task in general ) a specific goal.
Like parse this particular data structure with YAML so it would be used as an example to the problem.
Further more it would made the bugs or disabilities of YAML more obvious.

I like #3 task also which is connected to the #1 but you must be more specific. English is not my mother language and I can't grasp the
"all the window and menu layouts" concept without detail. Sorry if that's to much to ask but we can do that later on.

Happy new year and best wishes to everyone. santa
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Sat Jan 01, 2011 8:51 am

Added goals, as you asked, and here is the example for number 3:

setup.py (in SVN) has code to setup the contents of a window like this:

Code:
   # get a fullsize window, and add the options to it
   window = SWINDOW.CWindow(gui, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
                      "", False, "main-window")
   window.fillWindowImage()
   # an optionmenu, a label, a seperator and 2 buttons
   label1 = SWIDGET.buildLabel(gui, "Resolution")
   label1.rect.x = 37
   label1.rect.y = 26
   
   label2 = SWIDGET.buildLabel(gui, "Play Music")
   label2.rect.x = 40
   label2.rect.y = 64
   music = SWIDGET.CCheckBox(gui, 140, 64, True)

I much rather have this built up from a data file that maybe looked like this:

Code:

window:
    name: main-window
    size: 0,0,max,max
    label:
        text: "Resolution"
        position: 37,26
    label:
        text: "Play Music"
        position:  40,64

The format is not important, the idea is that in code we can do something like:

window = BuildWindow("some file")

And it will make building windows a bit easier for non-coders.

So the goal: Change setup.py so that it sets up the window by reading from a file.
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Tue Jan 04, 2011 5:52 pm

Since I haven't found GameData class in SPQR_Data.py I started with the 3rd task
and I will continue with the first when you have it done ( SPQR_Data.py is almost empty so I am guessing
that you will start from scratch the game data ).

I gave YAML a good read and I can say that it's a very huge format. I have done some testing with PyYAML-3.09
parser and decided to use only the "Dictionaries" and "Lists" format to store windows. "Dictionaries" or can store line information
which can be repeated and "Lists" for grouping the "Dictionaries". YAML uses semi-colon ":" for "Dictionaries" as python and minus "-"
or brackets "[]" for "Lists". Last "#" is used for comments again as python. I used 2 levels of lists , first that includes all windows and second
that includes all widgets for every window. The parent-child object relation is like python with spaces in front. For example if you have a window with 2
label widgets it goes like this

Code:

# Window list start with a "-". To make the window we need title,x,y,w,h and the list collection of widgets
- title: main-window # I will use the title as a unique key to identify each window
  x: 0
  y: 0
  w: 640
  h: 480
  items: # this dictionary key has a list as value. the list are the widgets 
    #every widget will have it's own variables except the widget which will be common and determine the widget class
    - widget: CLabel
      text: Resolution
      x: 29
      y: 26
    - widget: CLabel
      text: Play Music
      x: 32
      y: 64

With this format I will try to make the setup.py window as a file and make the code to recreate it. I hope that I am in the right track Very Happy
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Tue Jan 04, 2011 6:04 pm

OK the setup.py window is 1 and has several widgets. Every widget has it's own values to be recreated and it goes like this.

Code:

# main Window
- title: main-window
  x: 0
  y: 0
  w: 640
  h: 480
  items:
    - widget: CLabel
      text: Resolution
      x: 29
      y: 26
    - widget: CLabel
      text: Play Music
      x: 32
      y: 64
    - widget: CLabel
      text: Show intro
      x: 30
      y: 100
    - widget: CCheckBox
      initial: 1
      x: 140
      y: 100
    - widget: COptionMenu
      x: 124
      y: 20
      options: ["800x600", "1024x768", "Fullscreen"]
      describe: opt-Resolution
    - widget: CSeperator
      x: 6
      y: 132
      w: 631
    - widget: CButton
      x: 165
      y: 148
      text: OK
      callbacks:
        - lclk: okClick
    - widget: CButton
      x: 50
      y: 148
      text: Cancel
      callbacks:
        - lclk: cancelClick

I haven't figure how to use computing values like "x: a+b" so for now every value will be spesific and I will come back to it later.
We can add or change values to the widget formats if we want to make them more flexible. I used for now only the given values
from the setup.py .
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Tue Jan 04, 2011 6:22 pm

Finally 2 function read the YAML file and make the window. I added or replaced the followings in setup.py.
create_window function reads the YAML file and makes the windows and create_widget is called to add
all the widgets in each window created. I don't know which windows must be modal so I need a little help for that
and I haven't done any commenting so far. I will put comment's next and make some tests but you can test it youself.
I hope I am not going the wrong way here so I am waiting your comments.

Code:


import sys, pygame, yaml

def setupWindow():   
   create_window("../test.txt")

def create_window(filename):
   var=yaml.load(open(filename))
   jlist=[]
   for j in range(len(var)):
      jlist.append(SWINDOW.CWindow(var[j]['x'],
                            var[j]['y'],
                            var[j]['w'],
                            var[j]['h'],
                            var[j]['title'],
                            False,
                            "main-window"))
      jlist[j].fillWindowImage()
      for i in range(len(var[j]['items'])):
         wid=create_widget(var[j]['items'][i])
         wid.active=True
         jlist[j].addWidget(wid)
      # only 1 window, set it modal
      jlist[j].modal = True
      SGFX.gui.addWindow(jlist[j])

def create_widget(wlist):
   if wlist['widget']=="CLabel":
      label = SWIDGET.buildLabel(wlist['text'])
      label.rect.x = wlist['x']
      label.rect.y = wlist['y']
      return label
   elif wlist['widget']=="CCheckBox":
      intro = SWIDGET.CCheckBox(wlist['x'], wlist['y'], wlist['initial'])
      return intro
   elif wlist['widget']=="COptionMenu":
      options = SWIDGET.COptionMenu(wlist['x'], wlist['y'], wlist['options'])
      options.describe = wlist['describe']
      return options
   elif wlist['widget']=="CSeperator":
      sepbar = SWIDGET.CSeperator(wlist['x'] , wlist['y'], wlist['w'])
      return sepbar
   elif wlist['widget']=="CButton":
      button = SWIDGET.CButton(wlist['x'], wlist['y'], wlist['text'])
      for c in range(len(wlist['callbacks'])):
         if wlist['callbacks'][c].keys()[0]=="lclk" :
            button.callbacks.mouse_lclk = globals()[wlist['callbacks'][c]["lclk"]]
         elif wlist['callbacks'][c].keys()[0]=="over" :
            button.callbacks.mouse_over = globals()[wlist['callbacks'][c]["over"]]
         elif wlist['callbacks'][c].keys()[0]=="rclk" :
            button.callbacks.mouse_rclk = globals()[wlist['callbacks'][c]["rclk"]]
         elif wlist['callbacks'][c].keys()[0]=="ldown" :
            button.callbacks.mouse_ldown = globals()[wlist['callbacks'][c]["ldown"]]
         elif wlist['callbacks'][c].keys()[0]=="rdown" :
            button.callbacks.mouse_rdown = globals()[wlist['callbacks'][c]["rdown"]]
         elif wlist['callbacks'][c].keys()[0]=="dclick" :
            button.callbacks.mouse_dclick = globals()[wlist['callbacks'][c]["dclick"]]
      return button

avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Tue Jan 04, 2011 8:42 pm

Looks good to me!

Just a couple of things:

I think I misled you in talking about GameData: in actual fact the class in spqr_data.py is CInfo right now, but is undergoing some changes. CInfo will hold all the data together, but the main classes you need to look at are in spqr_player.py, apqr_city.py, spqr_unit.py and spqr_region.py. Right now though these classes are changing, sometimes daily, because am now building up the data required.

I'll look at your code further and maybe add it later (today or tomorrow) if it checks out Very Happy
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Thu Jan 06, 2011 12:24 pm

Added your code to svn (revision 92). I had to change the format though, when I extracted it from the forums it used spaces! Do you want to have svn write access?

Anyhow, the bad news: I couldn't get it to work! I don't understand why, it complain about the yaml module not having a load method No Very strange, anyhow, checkout the latest svn and see what you think (and see where I've gone wrong, because there is a file /yaml/test.py that uses load just fine).
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Fri Jan 07, 2011 12:01 pm

Fixed up code and itś now in svn. I didn't look too hard ,but it fails by not finding the callback functions in globals(). Any ideas? Take a look at SVN and see what you think.
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Mon Jan 10, 2011 12:52 am

Setup.py

Code:

#!/usr/bin/python

# SPQR source code, Copyright 2005-2010 Chris Smith

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# setup code for game
# for now, you can only set the game resolution

import sys, yaml
from pygame.locals import *

from scripts import spqr_defines as SPQR
from scripts import spqr_gui as SGFX
from scripts import spqr_window as SWINDOW
from scripts import spqr_widgets as SWIDGET

SCREEN_WIDTH = 285
SCREEN_HEIGHT = 192

def setupWindow():
   """ Creates a window from a given file """
  create_window("../test.txt")

def create_window(filename):
   """ Function that opens a file in YAML format and creates the
      described window with all the given widget's"""
  # open then file
  var=yaml.load(open(filename))
  # a list where we going to store all the windows
  jlist=[]
  # loop for each window found in the file
  for j in range(len(var)):
      # first create the window and it's properties. each property
      # has a spesific key in the file's dictonary
      jlist.append(SWINDOW.CWindow(var[j]['x'],
                            var[j]['y'],
                            var[j]['w'],
                            var[j]['h'],
                            var[j]['title'],
                            False,
                            "main-window"))
      # IMPORTANT I don't know why we call this function but I am
      # guessing to empty the main image from the gui
      jlist[j].fillWindowImage()
      # loop for the widget's list for the current window
      # each window has it's own
      for i in range(len(var[j]['items'])):
       # Create the widget
        wid=create_widget(var[j]['items'][i])
        # make it active
        wid.active=True
        # add widget to the window
        jlist[j].addWidget(wid)
      # After we have added all the widget's we must make some windows
      # modal. I don't know which shouldn't be modal so I make them all
      jlist[j].modal = True
      # finally I add the window to the gui
      SGFX.gui.addWindow(jlist[j])

def create_widget(wlist):
   """ Function that creates a widget and returns it based on the
      passed list of properties """
  # First we check the key that will always be in our widget's
  # and defines the widget's purpose
  if wlist['widget']=="CLabel":
     # if this is a label make it with a text
      label = SWIDGET.buildLabel(wlist['text'])
      # and add the cords to the rect
      label.rect.x = wlist['x']
      label.rect.y = wlist['y']
      return label
  elif wlist['widget']=="CCheckBox":
      intro = SWIDGET.CCheckBox(wlist['x'], wlist['y'], wlist['initial'])
      return intro
  elif wlist['widget']=="COptionMenu":
      options = SWIDGET.COptionMenu(wlist['x'], wlist['y'], wlist['options'])
      options.describe = wlist['describe']
      return options
  elif wlist['widget']=="CSeperator":
      sepbar = SWIDGET.CSeperator(wlist['x'] , wlist['y'], wlist['w'])
      return sepbar
  elif wlist['widget']=="CButton":
     # if it is a button we create it and then we must put the callbacks in
      button = SWIDGET.CButton(wlist['x'], wlist['y'], wlist['text'])
      # for every callback we check the given function from the global list
      # TODO : check if some callback is given more than once
      for c in range(len(wlist['callbacks'])):
        if wlist['callbacks'][c].keys()[0]=="lclk" :
            button.callbacks.mouse_lclk = globals()[wlist['callbacks'][c]["lclk"]]
        elif wlist['callbacks'][c].keys()[0]=="over" :
            button.callbacks.mouse_over = globals()[wlist['callbacks'][c]["over"]]
        elif wlist['callbacks'][c].keys()[0]=="rclk" :
            button.callbacks.mouse_rclk = globals()[wlist['callbacks'][c]["rclk"]]
        elif wlist['callbacks'][c].keys()[0]=="ldown" :
            button.callbacks.mouse_ldown = globals()[wlist['callbacks'][c]["ldown"]]
        elif wlist['callbacks'][c].keys()[0]=="rdown" :
            button.callbacks.mouse_rdown = globals()[wlist['callbacks'][c]["rdown"]]
        elif wlist['callbacks'][c].keys()[0]=="dclick" :
            button.callbacks.mouse_dclick = globals()[wlist['callbacks'][c]["dclick"]]
      return button

def okClick(handle, x, y):
   for i in SGFX.gui.windows[0].items:
      if i.describe == "opt-Resolution":
         print "You selected a resolution of", i.option
         sys.exit(True)

def cancelClick(handle, x, y):
   """quit utility and don't change anything"""
   sys.exit(True)

if __name__ == "__main__":
   SGFX.gui.mainInit(SCREEN_WIDTH, SCREEN_HEIGHT, False, False)
   setupWindow()
   SGFX.gui.updateGUI()
   SGFX.gui.mainLoop()


Notice that for every window ( because in the file we can have more than 1 window ) I call fillWindowImage(). I don't
know if thats correct and further more all the window I make are modal. Tell me if I must separate the modal from non modal windows
This is the latest version and sorry for the delay.
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Mon Jan 10, 2011 1:02 am

maximinus wrote:Fixed up code and itś now in svn. I didn't look too hard ,but it fails by not finding the callback functions in globals(). Any ideas? Take a look at SVN and see what you think.

Instead we use the globals() function like :

Code:
 globals()[wlist['callbacks'][c]["lclk"]]
We can use the getattr() function. I think that this fixes the problem but we must keep all the functions that we
put inside the button callbacks to the spqr_events.py or a similar file

Code:
 getattr(SEVENTS, wlist['callbacks'][c]["lclk"])
Tell me if that works !
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Mon Jan 10, 2011 4:56 pm

maximinus wrote:Added your code to svn (revision 92). I had to change the format though, when I extracted it from the forums it used spaces! Do you want to have svn write access?

Sure if it will speed up the process and you find it more useful . Make sure that you always have a look, whatever i commit ,before using it Laughing
Or give me a different trunk or something. I don't want to overwrite something by mistake Embarassed
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Mon Jan 10, 2011 5:12 pm

You'll need to get a sourceforge account then send me your username: post it to maximinus@NO-SPAM@gmail.com (removing the no-spam part, obviously).

SVN is much better for me because I don't have to answer all of your questions (like does this work...) and you also don't have to wait for me Very Happy
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Mon Jan 10, 2011 10:47 pm

pygasos wrote:Make sure that you always have a look, whatever i commit ,before using it Laughing
Or give me a different trunk or something. I don't want to overwrite something by mistake Embarassed

Don't worry; one of the points of SVN is that it bad things can be undone.

Also I feel if you are on the same trunk that you might feel more responsible and thus take more care Very Happy
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Wed Jan 12, 2011 12:07 am

Ok I made my first 2 commit's ( sorry but the first was a test ). Now the setup.py works fine Smile
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Wed Jan 12, 2011 5:27 pm

I have made the file /data/map.yml with the ma info and added the setRegions() function o ybiuld.py.
It works fine and the game seems to work properly. In the rev 111 I added comments to the ybuild.py and made some changes.
Even if the game works fine the setup.py dosn't which in rev 110 works fine. I believe to be some path issues though I would like
your opinion. I will look into it myself today and I hope I can get it to work. Rolling Eyes
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Wed Jan 12, 2011 8:04 pm

Great! I'll have a chance to take a look at the code tomorrow when I'm at work Razz
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Thu Jan 13, 2011 10:40 am

Hi Pygasos

Looks like you haven't added the file map.yml, when I run the game I get:

File "/home/sparky/code/spqr/scripts/spqr_ybuild.py", line 29, in setRegions
var = yaml.load(open(filename))
IOError: [Errno 2] No such file or directory: '../data/map.yml'


You probably need to do something like

svn add /the/file
svn update


on your copy of the code Wink
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Thu Jan 13, 2011 10:57 am

One more thing: it would be better to move the yaml file reading into CMap.__init__(), and then tidy up how the regions are created. It'll make the code a bit cleaner.
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Thu Jan 13, 2011 10:54 pm

maximinus wrote:One more thing: it would be better to move the yaml file reading into CMap.__init__(), and then tidy up how the regions are created. It'll make the code a bit cleaner.

I added the yaml file and moved the code as you suggested. Everything works fine ( if I haven't forget to add anything else ) you can check it out both spqr.py and setup.py . As far as the tiding up I hope I made the code cleaner and not dirtier Razz
I know that it's boring for you to keep correcting me but I will eventually get better lol!
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Fri Jan 14, 2011 11:47 am

pygasos wrote:I know that it's boring for you to keep correcting me but I will eventually get better lol!

Itś far better to have someone adding to the code, whatever the code is, and what you've done so far is fine with me!
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Fri Jan 14, 2011 12:52 pm

I changed the file layout a little, and now all the data we use is under /data, all in a nice little place!

Next task would be to make the units come from a yaml, and then all of the pop-up windows that are created in spqr_events,py to read from yaml files as well Wink
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Fri Jan 14, 2011 4:51 pm

maximinus wrote:Next task would be to make the units come from a yaml, and then all of the pop-up windows that are created in spqr_events,py to read from yaml files as well Wink

I have finished the units code and yaml file. I put the code to spqr_data.py in addUnits(). I don't know If you want me to move it to spqr_unit.py?
I will begin with the pop up windows and I will update the svn later today.
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  pygasos on Fri Jan 14, 2011 10:15 pm

I was having trouble using svn command line, so I found "SVN Workbench" which is super. Of course until I get it to work it took me some time.

I upload my latest code which I have made the followings. Added unit.yml , widget_test.yml , window_test.yml . The first is the units file which I think you
will find very simple. The other 2 are window layouts for the 2 pop up in event.py . I began to work with this 2 because all the work is in them. Everything else will come easy. I have finished the window_test and now I am working in the widget_test. Window_test works fine (at least has the same bug making the buttons appear outside the window, something is not working very well in your buildButtonArea() function ). I have tide up ybuild code and so I have changed 4 files

spqr_ybuild.py
spqr_events.py
setup_window.yml
spqr_data.py

In the last file I did something and for some reason it was saved with the 2 different codes ( mine and yours with diff comments ). Shocked
I have corrected that in rev 123 and for the first time added comments which I will do every time from now on. I wrote all this text wall because I am worried not to have cause any damage in your code. I haven't managed to get what did I do to make the spqr_data.py be saved like this. So please check if everything is fine before you update to rev 123 . pale
avatar
pygasos

Posts : 36
Join date : 2010-06-01
Age : 38
Location : Athens, Greece

View user profile

Back to top Go down

Re: Stuff that needs doing

Post  maximinus on Fri Jan 14, 2011 10:34 pm

Looks fine to me! Just some comments:

Windows should not normally be set modal, I changed that, although of course we could just set in the yaml file itself.
I know about the bug in buildButtonAreas, but it's not critical right now (I want to concentrate on getting 0.3.7 out of the door by the end of the week).
avatar
maximinus
Admin

Posts : 143
Join date : 2010-03-21
Age : 44
Location : Harbin, China

View user profile http://sourceforge.net/projects/spqr/

Back to top Go down

Re: Stuff that needs doing

Post  Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum