class ReadFileAction(BaseAction): '''Get file''' type = 'is.workflow.actions.documentpicker.open' keyword = 'read_file' path = VariablesField('WFGetFilePath') not_found_error = BooleanField('WFFileErrorIfNotFound') show_picker = BooleanField('WFShowFilePicker')
class ChooseFromListAction(BaseAction): '''Choose from list''' itype = 'is.workflow.actions.choosefromlist' keyword = 'choose_from_list' prompt = Field('WFChooseFromListActionPrompt', required=False) select_multiple = BooleanField('WFChooseFromListActionSelectMultiple', required=False) select_all_initially = BooleanField('WFChooseFromListActionSelectAll', required=False)
class GetURLAction(BaseAction): '''Get URL''' itype = 'is.workflow.actions.downloadurl' keyword = 'get_url' advanced = BooleanField('Advanced', required=False) method = HTTPMethodField('WFHTTPMethod', required=False) headers = DictionaryField('WFHTTPHeaders', required=False) json = DictionaryField('WFJSONValues', required=False) # todo: array or dict form = DictionaryField('WFFormValues', required=False) # todo: array or dict def __init__(self, data: Union[Dict, None] = None) -> None: self.default_fields = {} super().__init__(data=data) if data and data.get('form'): self.default_fields['WFHTTPBodyType'] = 'Form' elif data and data.get('json'): self.default_fields['WFHTTPBodyType'] = 'Json' if data and data.get('headers'): self.default_fields['ShowHeaders'] = True
class SetMobileDataAction(BaseAction): '''Set mobile data''' itype = 'is.workflow.actions.cellulardata.set' keyword = 'set_mobile_data' on = BooleanField('OnValue')
class RunShortcutAction(BaseAction): '''Run shortcut''' itype = 'is.workflow.actions.runworkflow' keyword = 'run_shortcut' show = BooleanField('WFShowWorkflow', default=False) shortcut_name = Field('WFWorkflowName')
class SetBluetoothAction(BaseAction): '''Set bluetooth''' itype = 'is.workflow.actions.bluetooth.set' keyword = 'set_bluetooth' on = BooleanField('OnValue')
class SetAirplaneModeAction(BaseAction): '''Set airplane mode''' itype = 'is.workflow.actions.airplanemode.set' keyword = 'set_airplane_mode' on = BooleanField('OnValue')
class SetWiFiAction(BaseAction): '''Set WiFi''' itype = 'is.workflow.actions.wifi.set' keyword = 'set_wifi' on = BooleanField('OnValue')
class SetLowPowerModeAction(BaseAction): '''Set Low Power mode''' itype = 'is.workflow.actions.lowpowermode.set' keyword = 'set_low_power_mode' on = BooleanField('OnValue', default=True)
class SaveFileAction(BaseAction): '''Save file''' type = 'is.workflow.actions.documentpicker.save' keyword = 'save_file' path = VariablesField('WFFileDestinationPath') overwrite = Field('WFSaveFileOverwrite') show_picker = BooleanField('WFAskWhereToSave')
class ImageConvertAction(BaseAction): '''Image convert''' type = 'is.workflow.actions.image.convert' keyword = 'convert_image' compression_quality = Field('WFImageCompressionQuality') format = Field('WFImageFormat') preserve_metadata = BooleanField('WFImagePreserveMetadata')
class NotificationAction(BaseAction): '''Show notification''' itype = 'is.workflow.actions.notification' keyword = 'notification' play_sound = BooleanField('WFNotificationActionSound', default=True) text = VariablesField('WFNotificationActionBody') title = VariablesField('WFNotificationActionTitle')
class ShowAlertAction(BaseAction): '''Show alert''' type = 'is.workflow.actions.alert' keyword = 'alert' show_cancel_button = BooleanField('WFAlertActionCancelButtonShown') text = Field('WFAlertActionMessage') title = Field('WFAlertActionTitle')
def test_boolean_field(self): f = BooleanField('test') assert f.process_value(True) is True assert f.process_value(False) is False assert f.process_value('False') is False assert f.process_value('True') is True with pytest.raises(ValueError): f.process_value('wrong value')
class ShowAlertAction(BaseAction): '''Show alert''' itype = 'is.workflow.actions.alert' keyword = 'alert' show_cancel_button = BooleanField('WFAlertActionCancelButtonShown', default=True) text = VariablesField('WFAlertActionMessage') title = VariablesField('WFAlertActionTitle')
class SetDoNotDisturbAction(BaseAction): '''Set Do Not Disturb''' itype = 'is.workflow.actions.dnd.set' keyword = 'set_do_not_disturb' default_fields = { 'AssertionType': 'Turned Off', # todo: support more "until" } enabled = BooleanField('Enabled')
class SpeakTextAction(BaseAction): '''Speak text''' itype = 'is.workflow.actions.speaktext' keyword = 'speak_text' language = ChoiceField('WFSpeakTextLanguage', choices=SPEAK_LANGUAGE_CHOICES) pitch = FloatField('WFSpeakTextPitch', default=0.95) rate = FloatField('WFSpeakTextRate', default=0.44) wait_until_finished = BooleanField('WFSpeakTextWait', default=True)
class SetClipboardAction(BaseAction): itype = 'is.workflow.actions.setclipboard' keyword = 'set_clipboard' local_only = BooleanField('WFLocalOnly', required=False) expiration_date = Field('WFExpirationDate', required=False)