Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def handleMouseDown(self, coords):
x,y = coords
but = False
SimpleUI.state['clicked'] = True
for button in self.buttons:
if (button.containsPoint(x, y)):
button.do()
SimpleUI.state['clicked'] = False
but = True
break
for platform in self.gameRects:
if platform.rect.collidepoint(x, y):
self.selected = platform.rect
if SimpleUI.state['mode'] is not 'prop': SimpleUI.state['mode'] = 'drag'
else:
platform.setBy = eg.enterbox('ButtonGroup to that sets this platform')
print("set by"+platform.setBy+"yo")
if eg.boolbox("Platform visible by default?", "One more thing", ["Yes", "No"]):
platform.visibleDefault = True
else:
platform.visibleDefault = False
but = True
break
for gbutton in self.gameButtons:
if gbutton.rect.collidepoint(x,y):
self.selected = gbutton.rect
if SimpleUI.state['mode'] is not 'prop': SimpleUI.state['mode'] = 'drag'
else:
gbutton.sets = eg.enterbox('Object Group to set')
but = True
for recorder in self.gameRecorders:
if recorder.rect.collidepoint(x,y):
def askname(msg="please enter your name"):
return easygui.enterbox(msg) # python2.x: use "raw_input" instead "input"
验证码验证部分
:param username:
:return:
'''
yzm = self.wait.until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[6]/div[2]/ul/li[4]/img')))
yzm_url = yzm.get_attribute('src')
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36'
}
r = requests.get(yzm_url, cookies=self.cookies_dict, headers=headers)
img_name = '验证码/' + username + '.png'
with open(img_name, 'wb') as p:
p.write(r.content)
login_status = self.browser.find_element_by_xpath('/html/body/div[6]/div[2]/p')
print('登录状态:' + login_status.text)
t = easygui.enterbox(msg='请输入验证码,输入next跳过此账号:',title='验证码')
if t == 'next':
print('next')
return
self.browser.find_element_by_xpath('/html/body/div[6]/div[2]/ul/li[4]/input').send_keys(t)
if os.path.exists(img_name):
os.remove(img_name)
submit = self.wait.until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[6]/div[2]/ul/li[6]/span/a')))
submit.click()
try:
result = self._get_cookie(username)
if result:
return result
except:
print('登陆失败')
return self._yzm(username)
choices.append("Frequency (set to 0 for dc stimulation)")
powers=eg.multenterbox("Enter the power that should be used for each electrode. Positive values represent anodal stimulation, and negative values represent cathodal stimulation. You can also set the duration, ramping parameters, and sham probability of the protocol","Stimulation parameters",choices)
if powers:
exMode=eg.ynbox(title="Outcome measures",msg="Do you want to add outcome measures to this protocol?")
if exMode:
outcomes=[]
selected=""
keepPrompting=True
while keepPrompting:
keepPrompting=False
prompt=eg.buttonbox(title="Select outcome measures",msg="Current outcome measures:\n"+selected,choices=["Add","Done"])
if prompt:
keepPrompting=True
if "Add" in prompt:
name=eg.enterbox(title="Outcome measure name",msg="Enter the name for this outcome measure. Enter NPHYS to use automatically collected neurophsyiological measurements")
if name:
details=eg.buttonbox(title="Logging options",msg="How do you want to collect data on this measure?",choices=['Before stimulation only','After stimulation only','Both before and after stimulation'])
name=name.replace("/","")
selected=selected+name+ " "+details.lower()+"\n"
if 'Before stimulation only' in details:
name=name+"/1"
elif 'After stimulation only' in details:
name=name+"/2"
else:
name=name+"/3"
outcomes.append(name)
else:
keepPrompting=False
pwrite=eg.filesavebox(title="Where do you want to save this protocol?",msg="Where do you want to save this protocol?")
def getGeneId(self):
gene_alias = easygui.enterbox("Please enter the locus tag or ITEP ID (sanitized or not) of the gene you wish to study.")
if gene_alias is None:
raise UserCancelError('User cancelled the operation.')
self._setUpGeneInfo(gene_alias)
self._setUpClusterInfo()
return gene_alias
def askForChoice(self):
#
# Check Python version
#
version = sys.version_info.major
if version == 3:
raw_input = input
elif version == 2:
pass
else:
raise ValueError("You should use Python 2.x at least!")
# Try to run with easygui
try:
import easygui
folder = easygui.diropenbox(title="Folder for the job") + "/"
name = easygui.enterbox("Enter the job name")
echo = easygui.buttonbox("Do you want to echo files?",
choices=["Yes", "No"])
except:
folder = raw_input('Enter folder (empty for the current one): ')
name = raw_input('Enter the job name: ')
spring_pos = raw_input("Do you have springs in your model? (y/N):")
echo = raw_input('Do you want to echo files? (y/N):')
start_time = datetime.now()
#%% PRE-PROCESSING
#
nodes, mats, elements, loads = pre.readin(folder=folder)
# Check for structural elements in the mesh
def set_parameters(self):
self.N = float(easygui.enterbox("How many nuclei at the beginning?"))
def def_input(message, defaultVal, usegui=False):
if usegui:
if not defaultVal:
defaultVal = ''
return easygui.enterbox(message, __app__, defaultVal)
else:
if defaultVal:
return input("%s [%s]:" % (message, defaultVal)) or defaultVal
else:
return input("%s " % (message))
department = g.enterbox("What is the dept you want to search for?", TITLE)
RDept = dbquery.querydept(department)
g.msgbox(RDept, TITLE)
elif CHOICE == "IP":
ip = g.enterbox("What is the ip you want to search for?", TITLE)
RIP = dbquery.queryip(ip)
g.msgbox(RIP, TITLE)
elif CHOICE == "Hostname":
hostname = g.enterbox("What is the hostname you want to search for?", TITLE)
RHost = dbquery.queryip(hostname)
g.msgbox(RHost, TITLE)
elif CHOICE == "Device Type":
device_type = g.enterbox("What is the device type you want to search for?", TITLE)
RdType = dbquery.queryip(device_type)
g.msgbox(RdType, TITLE)