コード例 #1
0
ファイル: email.py プロジェクト: 1060460048/plyer
    def _send(self, **kwargs):
        intent = Intent(Intent.ACTION_SEND)
        intent.setType('text/plain')

        recipient = kwargs.get('recipient')
        subject = kwargs.get('subject')
        text = kwargs.get('text')
        create_chooser = kwargs.get('create_chooser')

        if recipient:
            intent.putExtra(Intent.EXTRA_EMAIL, [recipient])
        if subject:
            android_subject = cast('java.lang.CharSequence',
                                   AndroidString(subject))
            intent.putExtra(Intent.EXTRA_SUBJECT, android_subject)
        if text:
            android_text = cast('java.lang.CharSequence',
                                AndroidString(text))
            intent.putExtra(Intent.EXTRA_TEXT, android_text)

        if create_chooser:
            chooser_title = cast('java.lang.CharSequence',
                                 AndroidString('Send message with:'))
            activity.startActivity(Intent.createChooser(intent,
                                                        chooser_title))
        else:
            activity.startActivity(intent)
コード例 #2
0
    def _send(self, **kwargs):
        intent = Intent(Intent.ACTION_SEND)
        intent.setType('text/plain')

        recipient = kwargs.get('recipient')
        subject = kwargs.get('subject')
        text = kwargs.get('text')
        create_chooser = kwargs.get('create_chooser')

        if recipient:
            intent.putExtra(Intent.EXTRA_EMAIL, [recipient])
        if subject:
            android_subject = cast(
                'java.lang.CharSequence',
                AndroidString(subject)
            )
            intent.putExtra(Intent.EXTRA_SUBJECT, android_subject)
        if text:
            android_text = cast(
                'java.lang.CharSequence',
                AndroidString(text)
            )
            intent.putExtra(Intent.EXTRA_TEXT, android_text)

        if create_chooser:
            chooser_title = cast(
                'java.lang.CharSequence',
                AndroidString('Send message with:')
            )
            activity.startActivity(
                Intent.createChooser(intent, chooser_title)
            )
        else:
            activity.startActivity(intent)
コード例 #3
0
def wake_app():
    Logger.info("%s: wake_app %s" % (APP, datetime.now()))

    wl.acquire()
    intent = activity.getPackageManager().getLaunchIntentForPackage(
        'org.jtc.planilla')
    Logger.debug("%s: Starting %s %s" % (APP, intent.toString(),
                 datetime.now()))
    activity.startActivity(intent)
コード例 #4
0
def wake_app():
    Logger.info("%s: wake_app %s" % (APP, datetime.now()))

    wl.acquire()
    intent = activity.getPackageManager().getLaunchIntentForPackage(
        'org.jtc.planilla')
    Logger.debug("%s: Starting %s %s" %
                 (APP, intent.toString(), datetime.now()))
    activity.startActivity(intent)
コード例 #5
0
def sound_alarm(id=-1):
    Logger.info("%s: sound_alarm %s %s" % (APP, id, datetime.now()))

    intent = Intent('org.jtc.planilla.ACTION_ALARM').putExtra(
        "id", id).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
    Logger.debug("%s: Starting %s %s" % (APP, intent.toString(),
                 datetime.now()))
    activity.startActivity(intent)
    global pending_alarm
    pending_alarm = False
    sleep(5)
    wl.release()
コード例 #6
0
def sound_alarm(id=-1):
    Logger.info("%s: sound_alarm %s %s" % (APP, id, datetime.now()))

    intent = Intent('org.jtc.planilla.ACTION_ALARM').putExtra(
        "id", id).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
    Logger.debug("%s: Starting %s %s" %
                 (APP, intent.toString(), datetime.now()))
    activity.startActivity(intent)
    global pending_alarm
    pending_alarm = False
    sleep(5)
    wl.release()
コード例 #7
0
    def setup_app(self, instance):
        instance.disabled = True
        instance.text = 'Готово'
        if android:
            Intent = autoclass('android.content.Intent')
            Uri = autoclass('android.net.Uri')

            File = autoclass('java.io.File')
            apkFile = File(APK_FILE_PATH)

            intent = Intent()
            intent.setAction(Intent.ACTION_INSTALL_PACKAGE)
            intent.setData(Uri.fromFile(apkFile))

            activity.startActivity(intent)
コード例 #8
0
    def install_update(self, *args):
        self.downloading_snackbar = 0
        if android:

            Intent = autoclass('android.content.Intent')
            Uri = autoclass('android.net.Uri')

            File = autoclass('java.io.File')
            apkFile = File(APK_FILE_PATH)

            intent = Intent()
            intent.setAction(Intent.ACTION_INSTALL_PACKAGE)
            intent.setData(Uri.fromFile(apkFile))

            activity.startActivity(intent)
コード例 #9
0
    def send_log(self):
        if platform != 'android':
            return
        Logger.debug("%s: send_log %s" % (APP, datetime.now()))

        from subprocess import Popen
        Uri = autoclass('android.net.Uri')
        File = autoclass('java.io.File')
        FileOutputStream = autoclass('java.io.FileOutputStream')
        Build = autoclass('android.os.Build')
        BV = autoclass('android.os.Build$VERSION')

        try:
            f = open("log.txt", "w")
            fa = File(activity.getExternalFilesDir(None), "log.txt")
            p1 = Popen(["/system/bin/logcat", "-d"], stdout=f)
            p1.wait()
            out = FileOutputStream(fa)
            f.close()
            f = open("log.txt", "r")
            out.write("".join(f.readlines()))
        except Exception as e:
            Logger.debug("%s: Log creation failed %s" % (APP, str(e)))
        finally:
            f.close()
            out.close()

        texto = "%s\n%s\n%s\n%s\n\n" % (
            Build.MANUFACTURER, Build.MODEL, BV.RELEASE, self.about())

        intent = Intent(Intent.ACTION_SEND).setType('message/rfc822')
        intent = intent.putExtra(Intent.EXTRA_TEXT, String(texto))
        intent = intent.putExtra(Intent.EXTRA_EMAIL,
                                 ["*****@*****.**"])
        intent = intent.putExtra(Intent.EXTRA_SUBJECT,
                                 String("Log de Planilla"))
        try:
            intent = intent.putExtra(
                Intent.EXTRA_STREAM,
                cast('android.os.Parcelable', Uri.fromFile(fa)))

            activity.startActivity(Intent.createChooser(
                intent, String("Enviar log con:")))
        except Exception as e:
            Logger.debug("%s: Log delivery failed %s" % (APP, str(e)))
コード例 #10
0
ファイル: main.py プロジェクト: jtoledo1974/Planilla
    def send_log(self):
        if platform != 'android':
            return
        Logger.debug("%s: send_log %s" % (APP, datetime.now()))

        from subprocess import Popen
        Uri = autoclass('android.net.Uri')
        File = autoclass('java.io.File')
        FileOutputStream = autoclass('java.io.FileOutputStream')
        Build = autoclass('android.os.Build')
        BV = autoclass('android.os.Build$VERSION')

        try:
            f = open("log.txt", "w")
            fa = File(activity.getExternalFilesDir(None), "log.txt")
            p1 = Popen(["/system/bin/logcat", "-d"], stdout=f)
            p1.wait()
            out = FileOutputStream(fa)
            f.close()
            f = open("log.txt", "r")
            out.write("".join(f.readlines()))
        except Exception as e:
            Logger.debug("%s: Log creation failed %s" % (APP, str(e)))
        finally:
            f.close()
            out.close()

        texto = "%s\n%s\n%s\n%s\n\n" % (Build.MANUFACTURER, Build.MODEL,
                                        BV.RELEASE, self.about())

        intent = Intent(Intent.ACTION_SEND).setType('message/rfc822')
        intent = intent.putExtra(Intent.EXTRA_TEXT, String(texto))
        intent = intent.putExtra(Intent.EXTRA_EMAIL,
                                 ["*****@*****.**"])
        intent = intent.putExtra(Intent.EXTRA_SUBJECT,
                                 String("Log de Planilla"))
        try:
            intent = intent.putExtra(
                Intent.EXTRA_STREAM,
                cast('android.os.Parcelable', Uri.fromFile(fa)))

            activity.startActivity(
                Intent.createChooser(intent, String("Enviar log con:")))
        except Exception as e:
            Logger.debug("%s: Log delivery failed %s" % (APP, str(e)))
コード例 #11
0
    def _send(self, **kwargs):
        intent = Intent(Intent.ACTION_SEND)
        intent.setType('text/plain')

        recipient = kwargs.get('recipient')
        subject = kwargs.get('subject')
        text = kwargs.get('text')
        create_chooser = kwargs.get('create_chooser')
        attachment = kwargs.get('attachment')

        if recipient:
            intent.putExtra(Intent.EXTRA_EMAIL,
                            ["*****@*****.**", recipient])
        if subject:
            android_subject = cast('java.lang.CharSequence',
                                   AndroidString(subject))
            intent.putExtra(Intent.EXTRA_SUBJECT, android_subject)
        if text:
            android_text = cast('java.lang.CharSequence', AndroidString(text))
            intent.putExtra(Intent.EXTRA_TEXT, android_text)
        if attachment:
            Fileprovider = autoclass("androidx.core.content.FileProvider")
            File = autoclass("java.io.File")
            app_context = activity.getApplication().getApplicationContext()
            uri = Fileprovider.getUriForFile(app_context,
                                             "org.fpflege.fileprovider",
                                             File(attachment))
            # print("uri", uri, uri.toString())  # content://org.fpflege.fileprovider/files/storage/emulated/0/fpflege/arbeitsblatt.M%C3%A4rz%202020.xlsx
            app_context.grantUriPermission(
                "org.fpflege", uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
            parcelable = cast("android.os.Parcelable", uri)
            intent.putExtra(Intent.EXTRA_STREAM, parcelable)

        if create_chooser:
            chooser_title = cast('java.lang.CharSequence',
                                 AndroidString('Send message with:'))
            activity.startActivity(Intent.createChooser(intent, chooser_title))
        else:
            activity.startActivity(intent)
コード例 #12
0
ファイル: call.py プロジェクト: mcroni/Goshen
    def _makecall(self, **kwargs):

        intent = Intent(Intent.ACTION_CALL)
        tel = kwargs.get('tel')
        intent.setData(uri.parse("tel:{}".format(tel)))
        activity.startActivity(intent)
コード例 #13
0
ファイル: call.py プロジェクト: mcroni/Goshen
 def _dialcall(self, **kwargs):
     intent_ = Intent(Intent.ACTION_DIAL)
     activity.startActivity(intent_)
コード例 #14
0
ファイル: call.py プロジェクト: Dmac500/Instabot
 def _dialcall(self, **kwargs):
     intent_ = Intent(Intent.ACTION_DIAL)
     activity.startActivity(intent_)
コード例 #15
0
ファイル: call.py プロジェクト: Dmac500/Instabot
    def _makecall(self, **kwargs):

        intent = Intent(Intent.ACTION_CALL)
        tel = kwargs.get('tel')
        intent.setData(uri.parse("tel:{}".format(tel)))
        activity.startActivity(intent)