class fields(tw.api.WidgetsList): email = tw.forms.TextField( label_text=_('Email (optional)'), help_text=_( 'Optional email for sending debugging output.' ' Fill this field if you wish to receive weird emails :)'), validator=validators.Email())
class SkipButton(Button): text = _('Skip') title = _('Go to next unconfigured service') def update_params(self, d): super(SkipButton, self).update_params(d) setSkipOnClick = tw.api.js_function('setSkipOnClick') self.add_call(setSkipOnClick(self.id, d['url']))
class PosySubmitButton(tw.forms.SubmitButton): css_class = 'submit-button' suppress_label = True attrs = { 'accesskey': 'S', 'title': _('Press Alt+Shift+S to submit form'), 'value': _('Send!'), }
class ClearSettings(Button): text = _('Clear Settings') title = _('Press Alt+Shift+C to clear settings on this page') accesskey = 'C' css_class = 'clear-settings' def update_params(self, d): super(ClearSettings, self).update_params(d) self.add_call(tw.api.js_function('setClearOnClick')(self.id, d['url']))
class LanguageSelect(tw.forms.SingleSelectField): validator = None label_text = _('Language') help_text = _('Application language'), options = languages is_required = False def update_params(self, d): super(LanguageSelect, self).update_params(d) self.add_call(tw.api.js_function('setSubmitOnChange')(self.id, None))
class ClearAllSettings(Button): text = _('Clear All Settings') attrs = dict(title=_('Clear general and all service settings')) message = _('Really clear ALL settings?') params = ['message', 'url'] css_class = 'clear-all-settings' def update_params(self, d, **kw): #logging.debug('ClearAllSettings: update_params: locals: %s', locals()) super(ClearAllSettings, self).update_params(d, **kw) setClearAllOnClick = tw.api.js_function('setClearAllOnClick') # XXX: lazystring cannot be serialized to JSON, so converting to # plain unicode message = unicode(str(self.message), 'utf-8') self.add_call(setClearAllOnClick(self.id, d['url'], message))
class fields(tw.api.WidgetsList): username = tw.forms.TextField( label_text=_('Username'), help_text=_("Your account's username for this service"), validator=validators.String(not_empty=True)) password = tw.forms.PasswordField( label_text=_('Password'), help_text=_( 'Posy does not fill password fields on web pages' " for security reasons. This field will be applied only" " if not empty value is entered." " Use your browser's password manager, if you" " want this field to be filled automatically."), validator=validators.String()) enable = tw.forms.CheckBox( label_text=_('Enable'), help_text=_('Enable sending messages to this service'))
class ApplySettings(Button): type = 'submit' text = _('Apply'), accesskey = 'A' title = _('Press Alt+Shift+A to apply settings')