don770omr commited on
Commit
ad56c68
·
verified ·
1 Parent(s): 7284296

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -9
app.py CHANGED
@@ -10,6 +10,8 @@ object_item_value = {
10
  'Window': {'height': 3, 'width': 0.5}},
11
  'glass': {'Door': {'height': 3, 'width': 0.5},
12
  'Window': {'height': 3, 'width': 0.5}},
 
 
13
  }
14
 
15
  lst_frac = ['0', '1/16', '1/8', '3/16', '1/4', '5/16', '3/8','7/16', '1/2',
@@ -54,32 +56,81 @@ for i in range(num_items):
54
  frac_w = st.selectbox('', lst_frac, key=f"frac_width_{i}")
55
  width += float(Fraction(frac_w))
56
 
57
- col22, col25 = st.columns([2, 2])
58
  reduction_h_glass = object_item_value['glass'][option]['height']
59
  reduction_w_glass = object_item_value['glass'][option]['width']
 
 
60
  # Input fields for dimensions (width and height)
61
  with col22:
62
- reduction_h_glass_new = st.number_input(f'Height Reduction for Glass (Item {i+1}):', key=f"reduction_h_{i}", min_value=0.0, value=float(reduction_h_glass), step=0.1)
 
 
 
 
 
63
 
64
  with col25:
65
- reduction_w_glass_new = st.number_input(f'Width Reduction for Glass (Item {i+1})', key=f"reduction_w_{i}", min_value=0.0, value=float(reduction_w_glass), step=0.1)
66
-
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  object_item_value['glass'][option]['height'] = reduction_h_glass_new
68
  object_item_value['glass'][option]['width'] = reduction_w_glass_new
 
69
 
70
- col23, col26 = st.columns([2, 2])
71
  reduction_h_shttr = object_item_value['shutter'][option]['height']
72
  reduction_w_shttr = object_item_value['shutter'][option]['width']
 
 
 
73
  # Input fields for dimensions (width and height)
74
  with col23:
75
- #col231, col232 = st.columns([2, 2])
76
- reduction_h_shttr_new = st.number_input(f'Height Reduction for Shutter (Item {i+1}):', key=f"reduction_h_shttr_{i}", min_value=0.0, value=float(reduction_h_glass), step=0.1)
77
-
 
 
 
 
78
  with col26:
79
- reduction_w_shttr_new = st.number_input(f'Width Reduction for Shutter (Item {i+1})', key=f"reduction_w_shttr_{i}", min_value=0.0, value=float(reduction_w_glass), step=0.1)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  object_item_value['shutter'][option]['height'] = reduction_h_shttr_new
82
  object_item_value['shutter'][option]['width'] = reduction_w_shttr_new
 
 
 
83
 
84
  # Prepare the results table with the new structure
85
  results = {
 
10
  'Window': {'height': 3, 'width': 0.5}},
11
  'glass': {'Door': {'height': 3, 'width': 0.5},
12
  'Window': {'height': 3, 'width': 0.5}},
13
+ 'divider': {'Door': {'height': 1, 'width': 2.0},
14
+ 'Window': {'height': 1, 'width': 2.0}},
15
  }
16
 
17
  lst_frac = ['0', '1/16', '1/8', '3/16', '1/4', '5/16', '3/8','7/16', '1/2',
 
56
  frac_w = st.selectbox('', lst_frac, key=f"frac_width_{i}")
57
  width += float(Fraction(frac_w))
58
 
59
+ col22, col25, col27 = st.columns([2, 2, 2])
60
  reduction_h_glass = object_item_value['glass'][option]['height']
61
  reduction_w_glass = object_item_value['glass'][option]['width']
62
+ divider_w_glass = object_item_value['divider'][option]['width']
63
+ divider_h_glass = object_item_value['divider'][option]['height']
64
  # Input fields for dimensions (width and height)
65
  with col22:
66
+ col221, col222 = st.columns([2, 2])
67
+ with col221:
68
+ reduction_h_glass_new_num = st.number_input(f'Height Reduction for Glass (Item {i+1}):', key=f"reduction_h_g_n_{i}", min_value=0, value=int(reduction_h_glass), step=1)
69
+ with col222:
70
+ reduction_h_glass_new_frac = st.selectbox('', lst_frac, key=f"reduction_h_g_f_{i}")
71
+ reduction_h_glass_new = reduction_h_glass_new_num + float(Fraction(reduction_h_glass_new_frac))
72
 
73
  with col25:
74
+ col251, col252 = st.columns([2, 2])
75
+ with col251:
76
+ reduction_w_glass_new_num = st.number_input(f'Width Reduction for Glass (Item {i+1})', key=f"reduction_w_g_n_{i}", min_value=0, value=int(reduction_w_glass), step=1)
77
+ with col252:
78
+ reduction_w_glass_new_frac = st.selectbox('', lst_frac, key=f"reduction_w_g_f_{i}")
79
+ reduction_w_glass_new = reduction_w_glass_new_num + float(Fraction(reduction_w_glass_new_frac))
80
+
81
+ with col27:
82
+ col271, col272 = st.columns([2, 2])
83
+ with col271:
84
+ divider_w_glass_new_num = st.number_input(f'Divider Reduction for Glass (Item {i+1})', key=f"divider_w_g_n_{i}", min_value=0, value=int(divider_w_glass), step=1)
85
+ with col272:
86
+ divider_w_glass_new_frac = st.selectbox('', lst_frac, key=f"divider_w_g_f_{i}")
87
+ divider_w_glass_new = divider_w_glass_new_num + float(Fraction(divider_w_glass_new_frac))
88
+
89
  object_item_value['glass'][option]['height'] = reduction_h_glass_new
90
  object_item_value['glass'][option]['width'] = reduction_w_glass_new
91
+ object_item_value['divider'][option]['width'] = divider_w_glass_new
92
 
93
+ col23, col26,col29 = st.columns([2, 2, 2])
94
  reduction_h_shttr = object_item_value['shutter'][option]['height']
95
  reduction_w_shttr = object_item_value['shutter'][option]['width']
96
+ divider_h_shttr = object_item_value['divider'][option]['height']
97
+ divider_w_shttr = object_item_value['divider'][option]['width']
98
+
99
  # Input fields for dimensions (width and height)
100
  with col23:
101
+ col231, col232 = st.columns([2, 2])
102
+ with col231:
103
+ reduction_h_shttr_new_num = st.number_input(f'Height Reduction for Shutter (Item {i+1}):', key=f"reduction_h_shttr_n_{i}", min_value=0, value=int(reduction_h_glass), step=1)
104
+ with col232:
105
+ reduction_h_shttr_new_frac = st.selectbox('', lst_frac, key=f"reduction_h_shttr_f_{i}")
106
+ reduction_h_shttr_new = reduction_h_shttr_new_num + float(Fraction(reduction_h_shttr_new_frac))
107
+
108
  with col26:
109
+ col261, col262 = st.columns([2, 2])
110
+ with col261:
111
+ reduction_w_shttr_new_num = st.number_input(f'Width Reduction for Shutter (Item {i+1})', key=f"reduction_w_shttr_n_{i}", min_value=0, value=int(reduction_w_glass), step=1)
112
+ with col262:
113
+ reduction_w_shttr_new_frac = st.selectbox('', lst_frac, key=f"reduction_w_shttr_f_{i}")
114
+ reduction_w_shttr_new = reduction_w_shttr_new_num + float(Fraction(reduction_w_shttr_new_frac))
115
+
116
+ with col29:
117
+ col291, col292 = st.columns([2, 2])
118
+ with col291:
119
+ divider_w_shttr_new_num = st.number_input(f'Divider Reduction for Shutter (Item {i+1})', key=f"divider_w_shttr_n_{i}", min_value=0, value=int(divider_w_glass), step=1)
120
+ #divider_h_shttr_new_num = st.number_input(f'Divider Reduction for Shutter (Item {i+1})', key=f"divider_h_shttr_n_{i}", min_value=0, value=int(divider_h_shttr), step=1)
121
+ with col292:
122
+ divider_w_shttr_new_frac = st.selectbox('', lst_frac, key=f"divider_w_shttr_f_{i}")
123
+ #divider_h_shttr_new_frac = st.selectbox('', lst_frac, key=f"divider_h_shttr_f_{i}")
124
+ divider_w_shttr_new = divider_w_shttr_new_num + float(Fraction(divider_w_shttr_new_frac))
125
+ #divider_h_shttr_new = divider_h_shttr_new_num + float(Fraction(divider_h_shttr_new_frac))
126
+
127
+ #reduction_w_shttr_new = st.number_input(f'Width Reduction for Shutter (Item {i+1})', key=f"reduction_w_shttr_{i}", min_value=0.0, value=float(reduction_w_glass), step=0.1)
128
 
129
  object_item_value['shutter'][option]['height'] = reduction_h_shttr_new
130
  object_item_value['shutter'][option]['width'] = reduction_w_shttr_new
131
+ object_item_value['divider'][option]['width'] = divider_w_shttr_new
132
+ #object_item_value['divider'][option]['height'] = divider_h_shttr_new
133
+
134
 
135
  # Prepare the results table with the new structure
136
  results = {