@@ -2172,3 +2172,35 @@ def keypress(self, size: urwid_Size, key: str) -> str:
2172
2172
self .controller .exit_popup ()
2173
2173
return key
2174
2174
return super ().keypress (size , key )
2175
+
2176
+
2177
+ class PollResultsView (PopUpView ):
2178
+ def __init__ (
2179
+ self ,
2180
+ controller : Any ,
2181
+ poll_question : str ,
2182
+ poll_options : Dict [str , Dict [str , Any ]],
2183
+ ) -> None :
2184
+ poll_results_content : List [Tuple [str , List [Tuple [str , str ]]]] = [("" , [])]
2185
+
2186
+ for option_key , option_data in poll_options .items ():
2187
+ option_text = option_data ["option" ]
2188
+ if len (option_text ) >= 13 :
2189
+ option_text = option_text [:10 ] + "…"
2190
+ voter_names = option_data ["votes" ]
2191
+
2192
+ voters_display = (
2193
+ "\n " .join (map (str , voter_names )) if voter_names else "No votes yet"
2194
+ )
2195
+
2196
+ poll_results_content [0 ][1 ].append ((option_text , voters_display ))
2197
+
2198
+ popup_width , column_widths = self .calculate_table_widths (
2199
+ poll_results_content , len (poll_question )
2200
+ )
2201
+
2202
+ widgets = self .make_table_with_categories (poll_results_content , column_widths )
2203
+
2204
+ super ().__init__ (
2205
+ controller , widgets , "SHOW_POLL_VOTES" , popup_width , poll_question
2206
+ )
0 commit comments