From: Jaka K. <lyn...@us...> - 2010-11-20 12:24:30
|
gemrb: Infinity Engine emulator The branch master has been updated via 5f0949a47b8eb4129421b8df7183e59d6c97dda7 (commit) Summary of changes: gemrb/GUIScripts/GUICommon.py | 12 ++++++++++++ gemrb/GUIScripts/LUSpellSelection.py | 9 ++++----- gemrb/GUIScripts/bg2/LUHLASelection.py | 3 +-- 3 files changed, 17 insertions(+), 7 deletions(-) from cf882eee018d371ae0fe189f338df35b58790230 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=5f0949a47b8eb4129421b8df7183e59d6c97dda7 commit 5f0949a47b8eb4129421b8df7183e59d6c97dda7 Author: Jaka Kranjc <lyn...@us...> Date: Sat Nov 20 13:20:21 2010 +0100 GUICommon: redefine ceil, so we don't need to import the math module (which isn't available on all platforms) diff --git a/gemrb/GUIScripts/GUICommon.py b/gemrb/GUIScripts/GUICommon.py index 69e05f3..241adbc 100644 --- a/gemrb/GUIScripts/GUICommon.py +++ b/gemrb/GUIScripts/GUICommon.py @@ -894,6 +894,18 @@ def SetupDamageInfo (pc, Button): return ratio_str +# redefine ceil, so we don't need to import the math module (which isn't available on all platforms) +def ceil (value): + dec = (value * 10) % 10 + if value > 0 and dec: + return float(int(value) + 1) + else: + return float(int(value)) # just truncate +# unit test: +#import math +#for i in 1, 0, -1, 1.2, 0.2, -1.2, 1.8, 0.8, -1.8: +# if ceil (i) - math.ceil (i): +# print i, ceil (i), math.ceil (i) GameWindow = GUIClasses.GWindow(0) GameControl = GUIClasses.GControl(0,0) diff --git a/gemrb/GUIScripts/LUSpellSelection.py b/gemrb/GUIScripts/LUSpellSelection.py index a0d3fac..ebcd10e 100644 --- a/gemrb/GUIScripts/LUSpellSelection.py +++ b/gemrb/GUIScripts/LUSpellSelection.py @@ -18,7 +18,6 @@ # import GemRB -from math import ceil from GUIDefines import * from ie_stats import * from ie_restype import RES_BAM @@ -187,9 +186,9 @@ def OpenSpellsWindow (actor, table, level, diff, kit=0, gen=0, recommend=True): if len (Spells[i]) > ( 24 + ExtraSpellButtons() ): HideUnhideScrollBar(0) if chargen: - ScrollBar.SetVarAssoc ("SpellTopIndex", int ( ceil ( ( len (Spells[i])-24 ) / 6.0 ) ) + 1 ) + ScrollBar.SetVarAssoc ("SpellTopIndex", int ( GUICommon.ceil ( ( len (Spells[i])-24 ) / 6.0 ) ) + 1 ) else: #there are five rows of 5 spells in level up of sorcs - ScrollBar.SetVarAssoc ("SpellTopIndex", int ( ceil ( ( len (Spells[i])-25 ) / 5.0 ) ) + 1 ) + ScrollBar.SetVarAssoc ("SpellTopIndex", int ( GUICommon.ceil ( ( len (Spells[i])-25 ) / 5.0 ) ) + 1 ) else: ScrollBar.SetVarAssoc ("SpellTopIndex", 0) HideUnhideScrollBar(1) @@ -236,9 +235,9 @@ def SpellsDonePress (): if len (Spells[i]) > ( 24 + ExtraSpellButtons() ): HideUnhideScrollBar(0) if chargen: - ScrollBar.SetVarAssoc ("SpellTopIndex", int ( ceil ( ( len (Spells[i])-24 ) / 6.0 ) ) + 1 ) + ScrollBar.SetVarAssoc ("SpellTopIndex", int ( GUICommon.ceil ( ( len (Spells[i])-24 ) / 6.0 ) ) + 1 ) else: - ScrollBar.SetVarAssoc ("SpellTopIndex", int ( ceil ( ( len (Spells[i])-25 ) / 5.0 ) ) + 1 ) + ScrollBar.SetVarAssoc ("SpellTopIndex", int ( GUICommon.ceil ( ( len (Spells[i])-25 ) / 5.0 ) ) + 1 ) else: ScrollBar.SetVarAssoc ("SpellTopIndex", 0) HideUnhideScrollBar(1) diff --git a/gemrb/GUIScripts/bg2/LUHLASelection.py b/gemrb/GUIScripts/bg2/LUHLASelection.py index 3070693..41bb156 100644 --- a/gemrb/GUIScripts/bg2/LUHLASelection.py +++ b/gemrb/GUIScripts/bg2/LUHLASelection.py @@ -18,7 +18,6 @@ # import GemRB -from math import ceil from GUIDefines import * from ie_stats import * import GUICommon @@ -89,7 +88,7 @@ def OpenHLAWindow (actor, numclasses, classes, levels): ScrollBar.SetSprites ("GUISCRCW", 0, 0,1,2,3,5,4) ScrollBar.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, HLAShowAbilities) #with enhanced GUI we have 5 rows of 5 abilities (the last one is 'the extra slot') - ScrollBar.SetVarAssoc ("HLATopIndex", int ( ceil ( ( len (HLAAbilities)-25 ) / 5.0 ) ) + 1 ) + ScrollBar.SetVarAssoc ("HLATopIndex", int ( GUICommon.ceil ( ( len (HLAAbilities)-25 ) / 5.0 ) ) + 1 ) ScrollBar.SetDefaultScrollBar () # draw our HLAs and show the window ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |