1 import gui
, pygame
, os
, time
, mod
, cfg
2 from pygame
.locals import *
4 class Module(mod
.Module
):
5 def __init__(self
, screen
):
6 mod
.Module
.__init
__(self
, screen
)
10 for module
in cfg
.cf
['modules'].values():
11 if module
['modfilename'] != 'mod_mainmenu':
12 self
.gui
['LIST'].add(module
['title'], cfg
.cf
['modules'].keys()[i
], self
.loadmod
, self
.showicon
)
14 self
.gui
['LIST'].makelist()
16 cfg
.lastmodname
= cfg
.modname
18 def showicon(self
, value
):
19 if os
.path
.isfile(cfg
.thpath(cfg
.cf
['modules'][value
]['prefix'] + '_icon.png')):
20 self
.changebykey('ICON', cfg
.thpath(cfg
.cf
['modules'][value
]['prefix'] + '_icon.png'))
22 self
.changebykey('ICON', cfg
.thpath('blank.png'))
24 def loadmod(self
, value
):
26 cfg
.modcf
= cfg
.cf
['modules'][value
]
27 self
.loadmodule
= value
29 def keyhandler(self
, event
):
30 if event
.type == KEYDOWN
:
31 if event
.key
== K_DOWN
: self
.gui
['LIST'].select_next()
32 if event
.key
== K_UP
: self
.gui
['LIST'].select_last()
33 if event
.key
== K_PAGEDOWN
: self
.gui
['LIST'].next_page()
34 if event
.key
== K_RETURN
: self
.gui
['LIST'].press()
35 if event
.key
== K_RIGHT
: self
.gui
['LIST'].press()