File: save_menu.py

package info (click to toggle)
lightyears 1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 1,324 kB
  • ctags: 454
  • sloc: python: 3,499; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 
# 20,000 Light Years Into Space
# This game is licensed under GPL v2, and copyright (C) Jack Whitham 2006-07.
# 


import menu, save_game


class Save_Menu(menu.Menu):
    def __init__(self, saving):
        file_list = []

        for i in xrange(save_game.NUM_SLOTS):
            label = save_game.Get_Info(i)
            j = i
            if ( label == None ):
                x = " " * 10
                label = x + " -- Unused slot -- " + x
                if ( not saving ):
                    j = - ( i + 100 ) # can't load this one! assign silly value

            label = ( "%2d. " % ( i + 1 )) + label

            file_list.append((j, label, []))

        file_list.append((None, None, []))
        file_list.append((-1, "Cancel", []))
        
        self.saving = saving
        menu.Menu.__init__(self, file_list)

    def Is_Saving(self):
        return self.saving

    def Justify(self, width, text_width):
        return 10