Beispiel #1
0
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')
Beispiel #2
0
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)
Beispiel #3
0
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
Beispiel #4
0
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')
Beispiel #6
0
class SetBluetoothAction(BaseAction):
    '''Set bluetooth'''

    itype = 'is.workflow.actions.bluetooth.set'
    keyword = 'set_bluetooth'

    on = BooleanField('OnValue')
Beispiel #7
0
class SetAirplaneModeAction(BaseAction):
    '''Set airplane mode'''

    itype = 'is.workflow.actions.airplanemode.set'
    keyword = 'set_airplane_mode'

    on = BooleanField('OnValue')
Beispiel #8
0
class SetWiFiAction(BaseAction):
    '''Set WiFi'''

    itype = 'is.workflow.actions.wifi.set'
    keyword = 'set_wifi'

    on = BooleanField('OnValue')
Beispiel #9
0
class SetLowPowerModeAction(BaseAction):
    '''Set Low Power mode'''

    itype = 'is.workflow.actions.lowpowermode.set'
    keyword = 'set_low_power_mode'

    on = BooleanField('OnValue', default=True)
Beispiel #10
0
class SaveFileAction(BaseAction):
    '''Save file'''
    type = 'is.workflow.actions.documentpicker.save'
    keyword = 'save_file'

    path = VariablesField('WFFileDestinationPath')
    overwrite = Field('WFSaveFileOverwrite')
    show_picker = BooleanField('WFAskWhereToSave')
Beispiel #11
0
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')
Beispiel #13
0
class ShowAlertAction(BaseAction):
    '''Show alert'''
    type = 'is.workflow.actions.alert'
    keyword = 'alert'

    show_cancel_button = BooleanField('WFAlertActionCancelButtonShown')
    text = Field('WFAlertActionMessage')
    title = Field('WFAlertActionTitle')
Beispiel #14
0
    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')
Beispiel #16
0
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')
Beispiel #17
0
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)
Beispiel #18
0
class SetClipboardAction(BaseAction):
    itype = 'is.workflow.actions.setclipboard'
    keyword = 'set_clipboard'

    local_only = BooleanField('WFLocalOnly', required=False)
    expiration_date = Field('WFExpirationDate', required=False)