def create_proposal_from_widgets(self): """Get BudgetProposal keyword arguments from our widgets and instantiate one.""" kwargs = {} kwargs['proposal_name'] = str(self.name_edit.text()) kwargs['proposal_url'] = str(self.url_edit.text()) kwargs['start_block'] = self.start_block_edit.value() kwargs['address'] = str(self.address_edit.text()) kwargs['payment_amount'] = self.amount_edit.get_amount() proposal = BudgetProposal(**kwargs) # Assign end_block using the number of payments. proposal.set_payments_count(self.payments_count_edit.value()) # Raise if proposal is invalid. proposal.check_valid() return proposal