make use of python's bizarre conditional assignment

This commit is contained in:
eblade 2009-03-09 03:47:25 -04:00
parent 635d59b25d
commit 66e05d08b1

View File

@ -477,35 +477,17 @@ class Config:
def get_default_colors(self, site = "PokerStars"): def get_default_colors(self, site = "PokerStars"):
colors = {} colors = {}
if self.supported_sites[site].hudopacity == "": colors['hudopacity'] = float(self.supported_sites[site].hudopacity) if self.supported_sites[site].hudopacity != "" else 0.90
colors['hudopacity'] = 0.90 colors['hudbgcolor'] = self.supported_sites[site].hudbgcolor if self.supported_sites[site].hudbgcolor != "" else "#FFFFFF"
else: colors['hudfgcolor'] = self.supported_sites[site].hudfgcolor if self.supported_sites[site].hudfgcolor != "" else "#000000"
colors['hudopacity'] = float(self.supported_sites[site].hudopacity)
if self.supported_sites[site].hudbgcolor == "":
colors['hudbgcolor'] = "#FFFFFF"
else:
colors['hudbgcolor'] = self.supported_sites[site].hudbgcolor
if self.supported_sites[site].hudfgcolor == "":
colors['hudfgcolor'] = "#000000"
else:
colors['hudfgcolor'] = self.supported_sites[site].hudfgcolor
return colors return colors
def get_default_font(self, site = 'PokerStars'): def get_default_font(self, site = 'PokerStars'):
(font, font_size) = ("Sans", "8") font = self.supported_sites[site].font if self.supported_sites[site].font != "" else "Sans"
if self.supported_sites[site].font == "": font_size = self.supported_sites[site].font_size if self.supported_sites[site].font != "" else "8"
font = "Sans"
else:
font = self.supported_sites[site].font
if self.supported_sites[site].font_size == "":
font_size = "8"
else:
font_size = self.supported_sites[site].font_size
return (font, font_size) return (font, font_size)
def get_locations(self, site = "PokerStars", max = "8"): def get_locations(self, site = "PokerStars", max = "8"):
try: try:
locations = self.supported_sites[site].layout[max].location locations = self.supported_sites[site].layout[max].location
except: except:
@ -584,7 +566,7 @@ class Config:
def get_aux_parameters(self, name): def get_aux_parameters(self, name):
"""Gets a dict of mucked window parameters from the named mw.""" """Gets a dict of mucked window parameters from the named mw."""
param = {} param = {}
if self.aux_windows.has_key(name): if name in self.aux_windows:
for key in dir(self.aux_windows[name]): for key in dir(self.aux_windows[name]):
if key.startswith('__'): continue if key.startswith('__'): continue
value = getattr(self.aux_windows[name], key) value = getattr(self.aux_windows[name], key)
@ -597,7 +579,7 @@ class Config:
def get_game_parameters(self, name): def get_game_parameters(self, name):
"""Get the configuration parameters for the named game.""" """Get the configuration parameters for the named game."""
param = {} param = {}
if self.supported_games.has_key(name): if name in self.supported_games:
param['game_name'] = self.supported_games[name].game_name param['game_name'] = self.supported_games[name].game_name
param['db'] = self.supported_games[name].db param['db'] = self.supported_games[name].db
param['rows'] = self.supported_games[name].rows param['rows'] = self.supported_games[name].rows
@ -608,7 +590,7 @@ class Config:
def get_supported_games(self): def get_supported_games(self):
"""Get the list of supported games.""" """Get the list of supported games."""
sg = [] sg = []
for game in c.supported_games.keys(): for game in c.supported_games:
sg.append(c.supported_games[game].game_name) sg.append(c.supported_games[game].game_name)
return sg return sg