コード例 #1
0
def push():
    """ Pushes the content of the clipboard to the stack and saves it. """
    clipboard = load_cb()
    if len(clipboard) > CB_SIZE:
        clipboard.pop(0)
    clipboard.append(pyperclip.getcb())
    save_cb(clipboard)
コード例 #2
0
def getUnrealTextFromSelection(cut=False):
    pyperclip.setcb("")  #make the cb empty
    if cut:
        cutToClipboard()
    else:
        copyToClipboard()
    text = pyperclip.getcb()
    if text == "":
        #print "# m2u debug: could not copy to clipboard"
        return None
    return text
コード例 #3
0
ファイル: udkCommand.py プロジェクト: m2u/m2u
def getUnrealTextFromSelection(cut = False):
    pyperclip.setcb("") #make the cb empty
    if cut:
        cutToClipboard()
    else:
        copyToClipboard()
    text = pyperclip.getcb()
    if text == "":
        #print "# m2u debug: could not copy to clipboard"
        return None
    return text
コード例 #4
0
def _transformObject_old(objName, trans, rot, scale):
    """transform an object with absolute transformations.

    :param objName: name of the object to modify
    :param trans: translation float tuple
    :param rot: rotation float tuple
    :param scale: 3d scale float tuple

    Transforms an object by cutting it from the level,
    replacing parameters and pasting the changed text to the level
    
    """
    rot = _convertRotationToUDK(rot)
    selectByName(objName)

    #keep = pyperclip.getcb() #backup current clipboard TODO: reenable
    pyperclip.setcb("")  #make the cb empty for while loop
    cutToClipboard()  # this will be executed somewhen, we don't know when
    old = pyperclip.getcb()
    if old == "":
        print "# m2u: could not copy to clipboard"
        return
    # we assume that transformation order is alwasy location, rotation, scale!
    locInd = str.find(old, "Location=(")
    assert locInd is not -1, (
        "# m2u: No Location attribute found, there is "
        "currently no solution implemented for that case.")
    # TODO we don't know where to add it in that case, so leave it be for now

    lastInd = locInd  #index of the last translate information found
    nextInd = str.find(old, "Rotation=(", locInd)
    if nextInd is not -1:  #found rotation as next, save the index
        lastInd = nextInd
    nextInd = str.find(old, "DrawScale3D=(", nextInd)
    if nextInd is not -1:  #found scale as next, save the index
        lastInd = nextInd
    #now we remove the transformation block from the text
    endInd = str.find(old, "\n", nextInd) + 1  # end of last statement
    part1 = old[0:locInd]  #the part before the transform stuff
    part2 = old[endInd:]  #the part after the transform stuff
    #create our own transformation block
    locRep = "Location=(X=%f,Y=%f,Z=%f)" % trans
    rotRep = "Rotation=(Pitch=%d,Yaw=%d,Roll=%d)" % rot
    scaleRep = "DrawScale3D=(X=%f,Y=%f,Z=%f)" % scale
    #add them all together as a new object string
    new = part1 + locRep + "\n" + rotRep + "\n" + scaleRep + "\n" + part2
    #print new

    pyperclip.setcb(new)
    pasteFromClipboard()
コード例 #5
0
ファイル: udkCommand.py プロジェクト: m2u/m2u
def _transformObject_old(objName, trans, rot, scale):
    """transform an object with absolute transformations.

    :param objName: name of the object to modify
    :param trans: translation float tuple
    :param rot: rotation float tuple
    :param scale: 3d scale float tuple

    Transforms an object by cutting it from the level,
    replacing parameters and pasting the changed text to the level
    
    """
    rot = _convertRotationToUDK(rot)
    selectByName(objName)
    
    #keep = pyperclip.getcb() #backup current clipboard TODO: reenable
    pyperclip.setcb("") #make the cb empty for while loop
    cutToClipboard() # this will be executed somewhen, we don't know when
    old = pyperclip.getcb()
    if old == "":
        print "# m2u: could not copy to clipboard"
        return
    # we assume that transformation order is alwasy location, rotation, scale!
    locInd = str.find(old,"Location=(")
    assert locInd is not -1, ("# m2u: No Location attribute found, there is "
                            "currently no solution implemented for that case.")
    # TODO we don't know where to add it in that case, so leave it be for now
    
    lastInd = locInd #index of the last translate information found
    nextInd = str.find(old,"Rotation=(",locInd)
    if nextInd is not -1: #found rotation as next, save the index
        lastInd = nextInd
    nextInd = str.find(old,"DrawScale3D=(",nextInd)
    if nextInd is not -1: #found scale as next, save the index
        lastInd = nextInd
    #now we remove the transformation block from the text   
    endInd = str.find(old,"\n",nextInd) + 1 # end of last statement
    part1 = old[0:locInd] #the part before the transform stuff
    part2 = old[endInd:] #the part after the transform stuff
    #create our own transformation block
    locRep = "Location=(X=%f,Y=%f,Z=%f)" % trans
    rotRep = "Rotation=(Pitch=%d,Yaw=%d,Roll=%d)" % rot
    scaleRep = "DrawScale3D=(X=%f,Y=%f,Z=%f)" % scale
    #add them all together as a new object string
    new = part1 + locRep + "\n" + rotRep + "\n" + scaleRep + "\n" + part2
    #print new
    
    pyperclip.setcb(new)
    pasteFromClipboard()
コード例 #6
0
	def get_url(self):
		bitly = BitlyHandle(BITLY_ACCESS_TOKEN)
		long_url = self.long_url.get()
		short_url = bitly.get_short_url(long_url)

		pyperclip.setcb(short_url)

		url_window = Toplevel()
		url_window.title("Short URL")

		url_label = Label(url_window, text="Short URL:")
		url_label.grid(padx=5, pady=5)

		url_text = Entry(url_window)
		url_text.insert(END, pyperclip.getcb())
		url_text.grid(pady=5)
コード例 #7
0
ファイル: pastor.py プロジェクト: zackva/pastor
from pbkdf2 import crypt

password_length = 16

base_phrase = getpass.getpass("Enter base phrase: ")

sanity_check = hashlib.sha256()
sanity_check.update(base_phrase)

print sum([ord(x) for x in sanity_check.digest()])

valid_characters = 'abcdefghijklmnopqrstuvwxyz0123456789.~!@#$%^&*()_+'

while (True):
    door_id = raw_input("Enter door id: ")
    if (door_id == ''):
        break

    key = crypt(door_id, base_phrase, 1000)
    key_data = hashlib.sha256()
    key_data.update(key)

    password = ''.join([
        valid_characters[ord(x) % len(valid_characters)]
        for x in key_data.digest()
    ][:password_length])
    pyperclip.setcb(password)
    print pyperclip.getcb()

os.system('clear')
コード例 #8
0
ファイル: plick.py プロジェクト: voidabhi/click
import sys, re
import requests
import pyperclip
import click


@click.group()
def plick():
    pass


@click.command()
@click.argument('url',
                help='url of the file to be downloaded',
                default=pyperclip.getcb().strip())
def download(url):
    url_regex = re.compile(
        r'^(?:http|ftp)s?://'  # http:// or https://
        r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'  # domain...
        r'localhost|'  # localhost...
        r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|'  # ...or ipv4
        r'\[?[A-F0-9]*:[A-F0-9:]+\]?)'  # ...or ipv6
        r'(?::\d+)?'  # optional port
        r'(?:/?|[/?]\S+)$',
        re.IGNORECASE)
    if not re.match(url_regex, url):
        print 'Invalid Url! Copy the download url to clipboard and then run `plick download`'
        return

    filename = url.split('/')[-1]
    print 'Downloading file %s' % filename
コード例 #9
0
ファイル: plick.py プロジェクト: voidabhi/click

import sys,re
import requests
import pyperclip
import click

@click.group()
def plick():
    pass

@click.command()
@click.argument('url',help='url of the file to be downloaded',default=pyperclip.getcb().strip())
def download(url):
	url_regex = re.compile(
    r'^(?:http|ftp)s?://' # http:// or https://
    r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' # domain...
    r'localhost|' # localhost...
    r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|' # ...or ipv4
    r'\[?[A-F0-9]*:[A-F0-9:]+\]?)' # ...or ipv6
    r'(?::\d+)?' # optional port
    r'(?:/?|[/?]\S+)$', re.IGNORECASE)
	if not re.match(url_regex,url):
		print 'Invalid Url! Copy the download url to clipboard and then run `plick download`'
		return
		
	filename = url.split('/')[-1]
	print 'Downloading file %s'%filename

	with open(filename,"wb") as f:
		r = requests.get(url,stream=True)
コード例 #10
0
# Version 1.0 was proudly created by Xinmei Wang (May).

import pyperclip

def cal(r, g, b):
    return r << 16 | g << 8 | b

def rgb(r,g,b,c):  
    c = cal(r,g,b)
    return hex(c)

print("Hello Designer. Welcome to Python \'RGB -> Hexadecimal Value Converter\'")
input_r = int(raw_input("input the integer value of R: "))
input_g = int(raw_input("input the integer value of G: "))
input_b = int(raw_input("input the integer value of B: "))

d = str(rgb(input_r, input_g, input_b, 0))


pyperclip.setcb('#'+d[2:])
clipboard_content = pyperclip.getcb()
print 'the Hexadecimal Value of inputted RGB color is in your clipboard'
print clipboard_content


コード例 #11
0
import unirest
import webbrowser
import pyperclip
import click
import urllib

@click.group()
def snapify():
    pass
	
@click.command()
@click.argument('url',help='url html page to be snapped',default=pyperclip.getcb().strip())
@click.argument('format',help='extension of snapshot image',default='png')
@click.argument('w',help='width of snapshot image',default='1024')
@click.argument('h',help='height of snapshot image',default='800')
def clip(url,format,w,h):	
	response = unirest.get("https://jmillerdesign-url-screenshot.p.mashape.com/api?url="+urllib.quote(url)+"&format="+format+"&width="+w+"&height="+h+"&delay=5",
	  headers={
		"X-Mashape-Authorization": "7cu8k0bYarwTOOPnOFgJQn9nWwt4tr33"
	  }
	);
	try:
	        # copying it to the clipboard
		pyperclip.setcb(response.body['screenshot'])
	except:
		pass
	finally:
		print response.body['message']
	
@click.command()
コード例 #12
0
ファイル: Flowify.py プロジェクト: proteusplum/Flowify
if len(sys.argv) != 5 and len(sys.argv)!= 4:
 sys.exit("this script requires three or four arguments: mflow username, password and name of new playlist. A fourth argument can be provided giving the file containing spotify uris. If no fourth argument is provided, the contents of the clipboard will be used.")
login=mflowlogin(sys.argv[1],sys.argv[2])
userid=login[0]
sessionid=login[1]
playlist=mflowplaylist(userid,sessionid,sys.argv[3])
if len(sys.argv)==5:
 try:
  f = open(sys.argv[4], 'r')
 except: 
  sys.exit("failed to open file!")
 uris=string.split(f.read())
else:
 try:
  import pyperclip
  uris=string.split(pyperclip.getcb())
 except:
  sys.exit("failed to open file!")

counter=0
part=2
for uri in uris:
 result=spotifylookup(uri)
 flow=mflowlookup(result,sessionid,userid)
 if flow["flowurn"]!="":
	if counter==50:
		playlist=mflowplaylist(userid,sessionid,sys.argv[3]+ " pt."+str(part))
		counter=0
		part=part+1
 	if playlistadd(userid,sessionid,flow,playlist, result):
 		counter=counter+1
コード例 #13
0
def insertTable(_no, _name, _tel, _etc):
    pyperclip.setcb("abcdedadf")
    spam = pyperclip.getcb()
コード例 #14
0

import sys,re
import requests
import pyperclip
import click

# grouping commands
@click.group()
def plick():
    pass

@click.command()
@click.argument('url',help='url of the file to be downloaded',default=pyperclip.getcb().strip())
def download(url):
	url_regex = re.compile(
    r'^(?:http|ftp)s?://' # http:// or https://
    r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' # domain...
    r'localhost|' # localhost...
    r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|' # ...or ipv4
    r'\[?[A-F0-9]*:[A-F0-9:]+\]?)' # ...or ipv6
    r'(?::\d+)?' # optional port
    r'(?:/?|[/?]\S+)$', re.IGNORECASE)
	if not re.match(url_regex,url):
		print 'Invalid Url! Copy the download url to clipboard and then run `plick download`'
		return
		
	filename = url.split('/')[-1]
	print 'Downloading file %s'%filename

	with open(filename,"wb") as f:
コード例 #15
0
ファイル: mapit.py プロジェクト: voidabhi/python-scripts
import webbrowser, sys

# fetching the query from command lines
if len(sys.argv) > 1:
    #get from command line
    address = ' '.join(sys.argv[1:]).strip()
else:
    # get from clipboard
    import pyperclip
    address = pyperclip.getcb().strip()

# appending to map url address
googlemapsurl = 'http://maps.google.com/maps?q='

# appending encoded params to url
if sys.version.startswith('2.'): # for Python 2 version
    import urllib
    googlemapsurl += urllib.quote(address)
else:
    import urllib.parse
    googlemapsurl += urllib.parse.quote(address)

# showing map url in browser
webbrowser.open(googlemapsurl)
コード例 #16
0
ファイル: pastor.py プロジェクト: appnician/pastor
import hashlib
import getpass
import pyperclip
from pbkdf2 import crypt

password_length = 16

base_phrase = getpass.getpass("Enter base phrase: ")

sanity_check = hashlib.sha256()
sanity_check.update(base_phrase)

print sum([ord(x) for x in sanity_check.digest()])

valid_characters = 'abcdefghijklmnopqrstuvwxyz0123456789.~!@#$%^&*()_+'

while (True):
    door_id = raw_input("Enter door id: ")
    if (door_id == ''):
        break

    key = crypt(door_id, base_phrase, 1000)
    key_data = hashlib.sha256()
    key_data.update(key)

    password = ''.join([valid_characters[ord(x) % len(valid_characters)] for x in key_data.digest()][:password_length])
    pyperclip.setcb(password)
    print pyperclip.getcb()

os.system('clear')
コード例 #17
0
import webbrowser, sys

# fetching the query from command lines
if len(sys.argv) > 1:
    #get from command line
    address = ' '.join(sys.argv[1:]).strip()
else:
    # get from clipboard
    import pyperclip
    address = pyperclip.getcb().strip()

# appending to map url address
googlemapsurl = 'http://maps.google.com/maps?q='

# appending encoded params to url
if sys.version.startswith('2.'):  # for Python 2 version
    import urllib
    googlemapsurl += urllib.quote(address)
else:
    import urllib.parse
    googlemapsurl += urllib.parse.quote(address)

# showing map url in browser
webbrowser.open(googlemapsurl)
コード例 #18
0
ファイル: sendmail.py プロジェクト: sucess512/python-scripts
		
		server = smtplib.SMTP()
		server.connect(smtpserver)
		server.starttls()
		server.login(login,password)
		problems = server.sendmail(from_addr, to_addr_list, message.as_string())
		server.quit()
		return problems
    
# Taking required inputs
username = raw_input("Enter Username!")
password = raw_input("Enter Password!")
to_addr = raw_input("Enter To Address")
cc_addr = raw_input("Enter CC Address")
subject = raw_input("Enter Subject!")
message = pyperclip.getcb().strip()
if(len(message)==0)
message = raw_input("Enter Message!")
_attachment = raw_input("Full name of the attachment! (assumes file is in current directory)") or 'image.jpg'

#Preparing mime message
mime_message = MIMEMultipart()

"""# Converting simple text to mime text and adding it to mime message
mime_text= MIMEText(message)
mime_message.attach(mime_text)"""

# Adding html content(image) to mime message
msgText = MIMEText('<b>'+message+'</b><br><img src="cid:'+_attachment+'"><br>', 'html')
mime_message.attach(msgText)