diff options
author | Bruno Coudoin <bcoudoin@src.gnome.org> | 2006-10-12 23:03:13 (GMT) |
---|---|---|
committer | Bruno Coudoin <bcoudoin@src.gnome.org> | 2006-10-12 23:03:13 (GMT) |
commit | 5367d342c620930b5198330a8332d8472d0e2c21 (patch) | |
tree | f32c5783564a5fdd43965f1ebaf33fb60566fee8 | |
parent | 12908e8b9eebfd2ec90fc74fa0ac514c89a743da (diff) |
update for windows python support improved to work on windows (untested
* src/boards/Makefile.mingw: update for windows python support
* src/boards/python/electric.py: improved to work on windows (untested yet)
* src/gcompris/board.c: (gc_board_init): added missing crane activity for windows
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/boards/Makefile.mingw | 1 | ||||
-rw-r--r-- | src/boards/python/electric.py | 25 | ||||
-rw-r--r-- | src/gcompris/board.c | 2 |
4 files changed, 26 insertions, 8 deletions
@@ -1,3 +1,9 @@ +2006-10-13 Bruno coudoin <bruno.coudoin@free.fr> + + * src/boards/Makefile.mingw: update for windows python support + * src/boards/python/electric.py: improved to work on windows (untested yet) + * src/gcompris/board.c: (gc_board_init): added missing crane activity for windows + 2006-10-12 Bruno coudoin <bruno.coudoin@free.fr> * src/gcompris/gameutil.c: (gc_item_focus_set): Fixed a memleak by Miguel DE IZARRA diff --git a/src/boards/Makefile.mingw b/src/boards/Makefile.mingw index bae10d1..a2533b9 100644 --- a/src/boards/Makefile.mingw +++ b/src/boards/Makefile.mingw @@ -157,6 +157,7 @@ BOARDS_C_SRC = \ clickgame.c \ clockgame.c \ colors.c \ + crane.c \ draw.c \ erase.c \ enumerate.c \ diff --git a/src/boards/python/electric.py b/src/boards/python/electric.py index 7c31841..a40fdc0 100644 --- a/src/boards/python/electric.py +++ b/src/boards/python/electric.py @@ -83,15 +83,13 @@ class Gcompris_electric: # # Check gnucap is installed and save it's path in self.gnucap_binary # - wingnucap = os.getcwd() + "/gnucap.exe" + wingnucap = os.path.join(os.getcwd(), "/gnucap.exe") for binary in ("/usr/bin/gnucap", "/usr/local/bin/gnucap", wingnucap): - try: - os.stat(binary) + if(os.path.exists(binary)): self.gnucap_binary = binary - except: - pass + break if not self.gnucap_binary: gcompris.utils.dialog(_("Cannot find the 'gnucap' electric simulator.\nYou can download and install it from:\n<http://geda.seul.org/tools/gnucap/>\nTo be detected, it must be installed in\n/usr/bin/gnucap or /usr/local/bin/gnucap.\nYou can still use this activity to draw schematics without computer simulation."), @@ -306,10 +304,13 @@ class Gcompris_electric: # ---------------------------------------------------------------------- def run_simulation(self): + if debug: print "run_simulation %s" %(self.gnucap_binary,) if not self.gnucap_binary: return + if debug: print "self.gnucap_timer = %d" %(self.gnucap_timer,) if not self.gnucap_timer: + if debug: print "run_simulation timeout_add" self.gnucap_timer = gobject.timeout_add(self.gnucap_timer_interval, self.call_gnucap) def call_gnucap(self): @@ -323,9 +324,7 @@ class Gcompris_electric: if component.is_connected(): connected = True - if not connected: - if debug: print "call_gnucap: No connected component" - return + if debug: print "call_gnucap create the tempfile" fd, filename = tempfile.mkstemp(".gnucap", "gcompris_electric", None, True) f = os.fdopen(fd, "w+t") @@ -355,12 +354,14 @@ class Gcompris_electric: # # Run gnucap with the temporary datafile we created. # + if debug: print "calling gnucap: %s -b %s" % (self.gnucap_binary, filename) output = os.popen("%s -b %s" % (self.gnucap_binary, filename)) # # Read and analyse gnucap result # if debug: print "---------------- GNUCAP OUTPUT PARSING ---------------------" + line = "" for line in output.readlines(): if debug: print "===" if debug: print line @@ -371,6 +372,14 @@ class Gcompris_electric: if debug: print "===>" if debug: print line if debug: print "===>" + + # Close it to check errors + results = output.close() + if results: + print('Failed to run gnugap with error ', os.WEXITSTATUS(results)) + self.gnucap_timer = 0 + return + values = [] if(line.split()[0] == "0."): if debug: print "FOUND 0." diff --git a/src/gcompris/board.c b/src/gcompris/board.c index 1788e06..af722d9 100644 --- a/src/gcompris/board.c +++ b/src/gcompris/board.c @@ -95,6 +95,7 @@ void gc_board_init(void) static_boards_demo[i++] = get_click_on_letter_bplugin_info(); static_boards_demo[i++] = get_clickgame_bplugin_info(); static_boards_demo[i++] = get_colors_bplugin_info(); + static_boards_demo[i++] = get_crane_bplugin_info(); static_boards_demo[i++] = get_draw_bplugin_info(); static_boards_demo[i++] = get_enumerate_bplugin_info(); static_boards_demo[i++] = get_erase_bplugin_info(); @@ -125,6 +126,7 @@ void gc_board_init(void) static_boards[i++] = get_clickgame_bplugin_info(); static_boards[i++] = get_clockgame_bplugin_info(); static_boards[i++] = get_colors_bplugin_info(); + static_boards[i++] = get_crane_bplugin_info(); static_boards[i++] = get_draw_bplugin_info(); static_boards[i++] = get_enumerate_bplugin_info(); static_boards[i++] = get_erase_bplugin_info(); |