def stream_muting_confirmation_popup(self, button: Any) -> None: currently_muted = self.model.is_muted_stream(button.stream_id) type_of_action = "unmuting" if currently_muted else "muting" question = urwid.Text(("bold", "Confirm " + type_of_action + " of stream '" + button.stream_name + "' ?"), "center") mute_this_stream = partial(self.model.toggle_stream_muted_status, button.stream_id) self.loop.widget = PopUpConfirmationView(self, question, mute_this_stream)
def stream_muting_confirmation_popup( self, stream_id: int, stream_name: str ) -> None: currently_muted = self.model.is_muted_stream(stream_id) type_of_action = "unmuting" if currently_muted else "muting" question = urwid.Text( ("bold", f"Confirm {type_of_action} of stream '{stream_name}' ?"), "center", ) mute_this_stream = partial(self.model.toggle_stream_muted_status, stream_id) self.loop.widget = PopUpConfirmationView(self, question, mute_this_stream)
def popup_view(self, mocker, stream_button): self.controller = mocker.Mock() self.controller.view.LEFT_WIDTH = 27 self.callback = mocker.Mock() self.list_walker = mocker.patch(LISTWALKER, return_value=[]) self.divider = mocker.patch(MODULE + ".urwid.Divider") self.text = mocker.patch(MODULE + ".urwid.Text") self.wrapper_w = mocker.patch(MODULE + ".urwid.WidgetWrap") return PopUpConfirmationView( self.controller, self.text, self.callback, )
def popup_view(self, mocker, stream_button): self.controller = mocker.Mock() self.controller.view.LEFT_WIDTH = 27 self.callback = mocker.Mock() self.list_walker = mocker.patch(VIEWS + ".urwid.SimpleFocusListWalker", return_value=[]) self.divider = mocker.patch(VIEWS + '.urwid.Divider') self.text = mocker.patch(VIEWS + '.urwid.Text') self.wrapper_w = mocker.patch(VIEWS + '.urwid.WidgetWrap') return PopUpConfirmationView( self.controller, self.text, self.callback, )
def save_draft_confirmation_popup(self, draft: Composition) -> None: question = urwid.Text('Save this message as a draft?' ' (This will overwrite the existing draft.)') save_draft = partial(self.model.save_draft, draft) self.loop.widget = PopUpConfirmationView(self, question, save_draft)