Skip to content

Commit b58ce44

Browse files
committed
unused clipboard module.
1 parent 7a2ceeb commit b58ce44

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

pipTerminal.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
"""
44
Pythonista3 Console Terminal.
5-
Version: 2.0.8
5+
Version: 2.1.0
66
Author: DarkRix.
77
"""
88

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
1010
from PIL import Image
11+
from objc_util import ObjCClass
1112

1213
ssl._create_default_https_context = ssl._create_unverified_context
1314

@@ -73,6 +74,19 @@ def SystemLogo(self):
7374
console.set_color(255, 0, 0) # red
7475
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)
7576

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+
7690
def copyFiles(self, FileName, dest):
7791
try:
7892
if os.path.isfile(os.path.join(os.getcwd(), FileName)):
@@ -728,20 +742,11 @@ def Argument_Paser(self, Args):
728742
except:
729743
pass
730744
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])
735746
elif Args[0] == 'pbpaste':
736-
try:
737-
print(clipboard.get())
738-
except:
739-
pass
747+
self.pbpaste()
740748
elif Args[0] == 'delclip':
741-
try:
742-
clipboard.set('')
743-
except:
744-
pass
749+
self.pbcopy('')
745750
elif Args[0] == 'showip':
746751
try:
747752
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:

0 commit comments

Comments
 (0)