-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_menu.py
113 lines (81 loc) · 2.43 KB
/
generate_menu.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# -*- coding: utf-8 -*-
"""
@author: sean
"""
import PySimpleGUI as sg
from traveller_master import make_sector_master
def makeit(makeit_list):
print(makeit_list)
make_sector_master(makeit_list)
sg.theme('DarkBlue')
left_layout = [
[sg.Text("PARAMETERS")],
[sg.Text('System Density')],
[sg.Text('Sector Name')],
[sg.Text('Random Seed')]
]
middle_layout = [
[sg.Text("OPTIONS")],
[sg.InputText(size=(4,1),key=('-DENSITY-'))],
[sg.InputText(size=(10,1),key=('-NAME-'))],
[sg.InputText(size=(4,1),key=('-SEED-'))]
]
right_layout = [
[sg.Text("NOTES")],
[sg.Text("(4, 5, or 6) 1d6 >= # results in a system present")],
[sg.Text("Db and txt files will be created in /sector_db")],
[sg.Text("Using the same seed with the same density will produce the same sector")]
]
layout = [
[sg.Text("""Generate Window""")],
[sg.HSeparator()],
[
sg.Column(left_layout),
sg.VSeparator(),
sg.Column(middle_layout),
sg.VSeparator(),
sg.Column(right_layout)
],
[sg.Button('Generate'), sg.Button('Cancel')]
]
# Create the Window
window = sg.Window("""Bartleby's Sector Builder v0.8.2""", layout)
# Event Loop to process "events" and get the "values" of the inputs
event, values = window.read()
# if event == sg.WIN_CLOSED or event == 'Cancel': # if user closes window or clicks cancel
# break
try:
print('You entered ', values['-DENSITY-'], values['-NAME-'], values['-SEED-'])
density_input = values['-DENSITY-']
sector_name_input = values['-NAME-']
random_seed_input = values['-SEED-']
lumiii_input = 3
lumv_input = 14
spectrala_input = 4
spectralf_input = 6
spectralg_input = 8
spectralk_input = 10
solo_input = 13
binary_input = 17
distant_input = 11
makeit_list = [random_seed_input,
sector_name_input,
density_input,
lumiii_input,
lumv_input,
spectrala_input,
spectralf_input,
spectralg_input,
spectralk_input,
solo_input,
binary_input,
distant_input]
try:
makeit(makeit_list)
except:
print(makeit_list,' failed')
sg.popup('Operation Failed - error in make_it function')
except:
print('Operation did not succeed.')
print(values)
window.close()