|
2 | 2 |
|
3 | 3 | """
|
4 | 4 | Pythonista3 Console Terminal.
|
5 |
| -Version: 2.0.8 |
| 5 | +Version: 2.1.0 |
6 | 6 | Author: DarkRix.
|
7 | 7 | """
|
8 | 8 |
|
9 |
| -import base64, clipboard, code, console, concurrent.futures, io, lib2to3.main, os, re, requests, shutil, socket, ssl, sys, urllib.error, urllib.request, urllib.parse, platform, qrcode, tempfile, time, tarfile, zipfile |
| 9 | +import base64, code, console, concurrent.futures, io, lib2to3.main, os, re, requests, shutil, socket, ssl, sys, urllib.error, urllib.request, urllib.parse, platform, qrcode, tempfile, time, tarfile, zipfile |
10 | 10 | from PIL import Image
|
| 11 | +from objc_util import ObjCClass |
11 | 12 |
|
12 | 13 | ssl._create_default_https_context = ssl._create_unverified_context
|
13 | 14 |
|
@@ -73,6 +74,19 @@ def SystemLogo(self):
|
73 | 74 | console.set_color(255, 0, 0) # red
|
74 | 75 | return "{}\n| - pyTerminal v2.0.8 on Python {}\t\t\t|\n| - Author: DarkRix.\t\t\t\t\t\t|\n| - Show All Command: help\t\t\t\t\t|\n{}\n\n".format("-"*41, platform.python_version(), "-"*41)
|
75 | 76 |
|
| 77 | + def pbcopy(self, text: str): # Copy String |
| 78 | + if type(text) == str: # text file... |
| 79 | + ObjCClass('UIPasteboard').generalPasteboard().setString(text) |
| 80 | + else: # Image file... |
| 81 | + ObjCClass('UIPasteboard').generalPasteboard().setImage_(ObjCClass('UIImage').imageWithData_(text)) |
| 82 | + |
| 83 | + def pbpaste(self): # Paste |
| 84 | + if ObjCClass('UIPasteboard').generalPasteboard().string() is not None: |
| 85 | + return ObjCClass('UIPasteboard').generalPasteboard().string().UTF8String().decode() |
| 86 | + else: |
| 87 | + return '' |
| 88 | + |
| 89 | + |
76 | 90 | def copyFiles(self, FileName, dest):
|
77 | 91 | try:
|
78 | 92 | if os.path.isfile(os.path.join(os.getcwd(), FileName)):
|
@@ -728,20 +742,11 @@ def Argument_Paser(self, Args):
|
728 | 742 | except:
|
729 | 743 | pass
|
730 | 744 | elif Args[0] == 'pbcopy':
|
731 |
| - try: |
732 |
| - clipboard.set_image(Args[1]) |
733 |
| - except: |
734 |
| - clipboard.set(str(Args[1])) |
| 745 | + self.pbcopy(Args[1]) |
735 | 746 | elif Args[0] == 'pbpaste':
|
736 |
| - try: |
737 |
| - print(clipboard.get()) |
738 |
| - except: |
739 |
| - pass |
| 747 | + self.pbpaste() |
740 | 748 | elif Args[0] == 'delclip':
|
741 |
| - try: |
742 |
| - clipboard.set('') |
743 |
| - except: |
744 |
| - pass |
| 749 | + self.pbcopy('') |
745 | 750 | elif Args[0] == 'showip':
|
746 | 751 | try:
|
747 | 752 | with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
|
0 commit comments