GSMEthesis commited on
Commit
76d1a8b
·
verified ·
1 Parent(s): 2871ba8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -739,7 +739,7 @@ h3 {
739
 
740
  # ========== توابع اصلی ==========
741
  def enhanced_likert_scale(question_data):
742
- """لیکرت اسکیل با دکمه‌های HTML کاملاً غالب روی دکمه‌های Streamlit"""
743
  question = question_data["question"]
744
  key = question_data["key"]
745
  scale = question_data["scale"]
@@ -778,7 +778,7 @@ def enhanced_likert_scale(question_data):
778
  justify-content: center !important;
779
  gap: 8px !important;
780
  flex-wrap: wrap !important;
781
- margin: 10px 0 !important;
782
  position: relative !important;
783
  height: 40px !important;
784
  }}
@@ -813,7 +813,8 @@ def enhanced_likert_scale(question_data):
813
  position: relative !important;
814
  width: 40px !important;
815
  height: 40px !important;
816
- margin: 0 auto !important;
 
817
  }}
818
  .likert-streamlit-btn {{
819
  width: 40px !important;
@@ -825,9 +826,15 @@ def enhanced_likert_scale(question_data):
825
  margin: 0 !important;
826
  padding: 0 !important;
827
  border: none !important;
828
- background: transparent !important;
829
  z-index: 1 !important;
830
  }}
 
 
 
 
 
 
831
  /* استایل پاسخ انتخاب‌شده */
832
  .likert-response {{
833
  text-align: center !important;
@@ -859,7 +866,7 @@ def enhanced_likert_scale(question_data):
859
  x_position = start_x + i * (button_width + gap)
860
  html_content += f"""
861
  <button class="likert-btn {'selected' if is_selected else ''}"
862
- style="left: calc(50% + {x_position}px);"
863
  onclick="document.getElementById('streamlit-btn-{key}-{value}').click()">
864
  {'•' if is_selected else '○'}
865
  </button>
@@ -896,14 +903,14 @@ def enhanced_likert_scale(question_data):
896
  margin: 0 !important;
897
  padding: 0 !important;
898
  border: none !important;
899
- background: transparent !important;
900
  z-index: 1 !important;
901
  }}
902
  #streamlit-btn-{key}-{value}:hover,
903
  #streamlit-btn-{key}-{value}:focus,
904
  #streamlit-btn-{key}-{value}:active {{
905
  border: none !important;
906
- background: transparent !important;
907
  }}
908
  </style>
909
  </div>
@@ -919,8 +926,8 @@ def enhanced_likert_scale(question_data):
919
  st.session_state[key] = value
920
  st.rerun()
921
 
922
- return st.session_state.get(key)
923
-
924
  def create_ride_map():
925
  """ایجاد نقشه سفر با Folium - نسخه اصلاح شده با مناطق عمومی"""
926
  # نقاط تقریبی برای مناطق عمومی جنوب و غرب تهران
 
739
 
740
  # ========== توابع اصلی ==========
741
  def enhanced_likert_scale(question_data):
742
+ """لیکرت اسکیل با دکمه‌های HTML دقیقاً روی دکمه‌های Streamlit نامرئی"""
743
  question = question_data["question"]
744
  key = question_data["key"]
745
  scale = question_data["scale"]
 
778
  justify-content: center !important;
779
  gap: 8px !important;
780
  flex-wrap: wrap !important;
781
+ margin: 0 !important;
782
  position: relative !important;
783
  height: 40px !important;
784
  }}
 
813
  position: relative !important;
814
  width: 40px !important;
815
  height: 40px !important;
816
+ margin: 0 !important;
817
+ padding: 0 !important;
818
  }}
819
  .likert-streamlit-btn {{
820
  width: 40px !important;
 
826
  margin: 0 !important;
827
  padding: 0 !important;
828
  border: none !important;
829
+ background: white !important;
830
  z-index: 1 !important;
831
  }}
832
+ .likert-streamlit-btn:hover,
833
+ .likert-streamlit-btn:focus,
834
+ .likert-streamlit-btn:active {{
835
+ border: none !important;
836
+ background: white !important;
837
+ }}
838
  /* استایل پاسخ انتخاب‌شده */
839
  .likert-response {{
840
  text-align: center !important;
 
866
  x_position = start_x + i * (button_width + gap)
867
  html_content += f"""
868
  <button class="likert-btn {'selected' if is_selected else ''}"
869
+ style="left: calc(50% + {x_position}px); top: 0;"
870
  onclick="document.getElementById('streamlit-btn-{key}-{value}').click()">
871
  {'•' if is_selected else '○'}
872
  </button>
 
903
  margin: 0 !important;
904
  padding: 0 !important;
905
  border: none !important;
906
+ background: white !important;
907
  z-index: 1 !important;
908
  }}
909
  #streamlit-btn-{key}-{value}:hover,
910
  #streamlit-btn-{key}-{value}:focus,
911
  #streamlit-btn-{key}-{value}:active {{
912
  border: none !important;
913
+ background: white !important;
914
  }}
915
  </style>
916
  </div>
 
926
  st.session_state[key] = value
927
  st.rerun()
928
 
929
+ return st.session_state.get(key)
930
+
931
  def create_ride_map():
932
  """ایجاد نقشه سفر با Folium - نسخه اصلاح شده با مناطق عمومی"""
933
  # نقاط تقریبی برای مناطق عمومی جنوب و غرب تهران