本文整理汇总了Python中General类的典型用法代码示例。如果您正苦于以下问题:Python General类的具体用法?Python General怎么用?Python General使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了General类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Quit_Wizard
def Quit_Wizard(self, rv):
try:
cmd.delete(self.LigDisplay)
cmd.delete(self.AtomDisplay)
cmd.deselect()
if rv != 1:
General.unmask_Objects(self.exc)
cmd.set('mouse_selection_mode', self.selection_mode)
#cmd.config_mouse('three_button_editing', 1)
if rv > 0:
self.FlexAID.WizardError = True
self.FlexAID.ActiveWizard = None
cmd.set_wizard()
cmd.set_view(self.View)
cmd.refresh()
self.top.SATRunning(False)
self.queue.put(lambda: self.top.AnchorRunning(False))
self.queue.put(lambda: self.FlexAID.root.deiconify())
self.queue.put(lambda: self.FlexAID.root.update())
except:
pass
示例2: Start
def Start(self):
self.queue.put(lambda: self.FlexAID.root.withdraw())
cmd.window('hide')
self.queue.put(lambda: cmd.window('show'))
cmd.refresh_wizard()
# Display the ligand from the PDB file
if self.DisplayLigand():
self.FlexAID.DisplayMessage("Error while trying to display the ligand from PDB file", 1)
self.Quit_Wizard(self.ErrorCode)
return
# Color the Atoms based on their type
if self.ColorByType():
self.FlexAID.DisplayMessage("Error while coloring the ligand atoms by type", 1)
self.Quit_Wizard(self.ErrorCode)
return
# Mask everythign except modifyable object (ligand)
self.exc = [self.LigDisplay]
General.mask_Objects(self.exc)
self.selection_mode = cmd.get("mouse_selection_mode")
cmd.set("mouse_selection_mode", 0) # set selection mode to atomic
# remove any possible selection before selecting atoms
cmd.deselect()
self.ErrorCode += 1
示例3: start_with_computer
def start_with_computer(enabled):
"""If enabled, create shortcut to start application with computer.
If disabled, then delete the shortcut."""
if not enabled:
if os.path.lexists(autostart_path):
FileUtilities.delete(autostart_path)
return
if os.path.lexists(autostart_path):
return
import shutil
General.makedirs(os.path.dirname(autostart_path))
shutil.copy(launcher_path, autostart_path)
os.chmod(autostart_path, 0755)
if General.sudo_mode():
General.chownself(autostart_path)
示例4: Save_SessionFile
def Save_SessionFile(self, SaveFile):
if len(SaveFile) > 0:
SaveFile = os.path.normpath(SaveFile)
if General.validate_String(SaveFile, '.nrgfs', True, True, False):
self.DisplayMessage(" ERROR: Could not save the file because you entered an invalid name.", 2)
return
if self.ValidateSaveProject(SaveFile, 'Session'):
self.DisplayMessage(" ERROR: The file can only be saved at its default location", 2)
return
try:
out = open(SaveFile, 'wb')
pickle.dump(self.SessionPath, out)
for Tab in self.listTabs:
pickle.dump(Tab.Vars, out)
out.close()
self.SaveSessionFile = SaveFile
self.DisplayMessage(" The session '" + os.path.split(SaveFile)[1] + "' was saved successfully.", 2)
except pickle.PicklingError:
self.DisplayMessage(" ERROR: Could not properly save the session: " + str(sys.exc_info()), 2)
except:
self.DisplayMessage(" Unexpected error: " + str(sys.exc_info()), 2)
示例5: Btn_Create_Clicked
def Btn_Create_Clicked(self):
name = self.ProjName.get().strip()
if name != '':
if General.validate_String(name, '', False, True, False):
print(' ERROR: The name \'' + name + '\' is invalid. Try again.')
return
Project_Dir = os.path.join(self.ActualDirPath,name)
if not os.path.isdir(Project_Dir):
try:
os.makedirs(Project_Dir)
except OSError:
print(' ERROR: Could not create the project: \'' + name + '\' under that directory.')
return
self.Update_ProjectFile(Project_Dir, name)
self.top.Project_Dir = Project_Dir
self.top.ProjectName = name
self.Quit()
self.After_Quit()
print(' Successfully created the project: \'' + name + '\'')
print(' The project was loaded by default.')
else:
print(' The project: \'' + name + '\' already exists.')
示例6: __init__
def __init__(self, action_element):
"""Initialize file search"""
self.regex = action_element.getAttribute('regex')
assert(isinstance(self.regex, (str, unicode, types.NoneType)))
self.nregex = action_element.getAttribute('nregex')
assert(isinstance(self.nregex, (str, unicode, types.NoneType)))
self.search = action_element.getAttribute('search')
self.object_type = action_element.getAttribute('type')
self.path = os.path.expanduser(os.path.expandvars(
action_element.getAttribute('path')))
if 'nt' == os.name and self.path:
# convert forward slash to backslash for compatibility with getsize()
# and for display. Do not convert an empty path, or it will become
# the current directory (.).
self.path = os.path.normpath(self.path)
self.ds = {}
if 'deep' == self.search:
self.ds['regex'] = self.regex
self.ds['nregex'] = self.nregex
self.ds['cache'] = General.boolstr_to_bool(
action_element.getAttribute('cache'))
self.ds['command'] = action_element.getAttribute('command')
self.ds['path'] = self.path
if self.object_type:
if 'f' == self.object_type:
self.object_filter = os.path.isfile
elif 'd' == self.object_type:
self.object_filter = os.path.isdir
else:
raise RuntimeError('unsupported type %s in %s' % \
(self.object_type, self.action_element))
else:
# faster to bypass
self.get_paths = self._get_paths
示例7: run
def run():
print '--> mission The Guristas Spies'
if not ship.enableDefense():
return False
if not overview.activateAccelerationGate():
return False
if not drones.launchSmall():
return False
if not general.openMissionDetails():
return False
overview.seekAndDestory()
if not general.missionObjectiveComplete():
return False
if not drones.back():
return False
print '<-- mission The Guristas Spies\n'
return True
示例8: run
def run():
print '--> mission Retribution'
if not ship.enableDefense():
return False
if not overview.activateAccelerationGate():
return False
if not overview.switchTo('lcs'):
return False
if not overview.lockTarget('guristas_outpost', 5):
return False
if not general.openMissionDetails():
return False
if not drones.launchSentry():
return False
ship.fireOnce()
drones.engage()
if not general.missionObjectiveComplete():
return False
if not drones.back():
return False
print '<-- mission Retribution\n'
return True
示例9: run
def run():
print '--> mission The Space Telescope'
if not ship.enableDefense():
return False
if not overview.activateAccelerationGate():
return False
if not overview.switchTo('lcs'):
return False
if not overview.lockTarget('guristas_space', 15):
return False
if not drones.launchSmall():
return False
ship.fireOnce()
drones.engage()
if not general.openMissionDetails():
return False
if not general.missionObjectiveComplete():
return False
if not drones.back():
return False
print '<-- mission The Space Telescope\n'
return True
示例10: run
def run():
print '--> mission Break Their Will'
if not ship.enableDefense():
return False
if not overview.switchTo('lcs'):
return False
if not overview.lockTarget('repair_station'):
return False
if not general.openMissionDetails():
return False
if not drones.launchSentry():
return False
if not drones.engage():
return False
if not general.missionObjectiveComplete():
return False
if not drones.back():
return False
print '<-- mission Break Their Will\n'
return True
示例11: run
def run():
print "--> mission Intercept the Pirate Smugglers"
result = None
begin = time.time()
while not result and time.time() - begin < 5:
time.sleep(0.2)
result = findAtFull("close")
if result:
mouse.leftClickAtP(result)
if not ship.enableDefense():
return False
if not drones.launchSmall():
return False
if not general.openMissionDetails():
return False
ship.enableAfterburn()
overview.seekAndDestory()
if not general.missionObjectiveComplete():
return False
if not drones.back():
return False
print "<-- mission Intercept the Pirate Smugglers\n"
return True
示例12: run
def run():
print '--> mission New Frontiers - Asnendanne (7 of 7)'
if not ship.enableDefense():
return False
if not general.openMissionDetails():
return False
ship.enableAfterburn()
if not overview.activateAccelerationGate():
return False
print 'pocket 1'
if not drones.launchSmall():
return False
overview.seekAndDestory()
if not general.missionObjectiveComplete():
return False
if not drones.back():
return False
print '<-- mission New Frontiers - Asnendanne (7 of 7)\n'
return True
示例13: run
def run():
print '--> mission Deadly Arrival'
if not ship.enableDefense():
return False
if not overview.switchTo('lco'):
return False
if not overview.lockTarget('ruined_structure'):
return False
if not ship.approach():
return False
if not ship.enableAfterburn():
return False
if not general.openMissionDetails():
return False
if not general.missionObjectiveComplete():
return False
print '<-- mission Deadly Arrival\n'
return True
示例14: run
def run():
print '--> mission What Comes Around Goes Around'
if not ship.enableDefense():
return False
if not drones.launchSmall():
return False
result = None
begin = time.time()
while not result and time.time() - begin < 5:
time.sleep(0.2)
result = findAtFull('close')
if result:
mouse.leftClickAtP(result)
if not general.openMissionDetails():
return False
if not general.missionObjectiveComplete():
return False
if not drones.back():
return False
print '<-- mission What Comes Around Goes Around\n'
return True
示例15: run
def run():
print '--> mission Unauthorized Military Presence'
if not ship.enableDefense():
return False
if not general.openMissionDetails():
return False
ship.enableAfterburn()
if not overview.activateAccelerationGate():
return False
if not overview.switchTo('battle'):
return False
if not overview.lockTarget('guristas_personnel'):
return False
if not ship.enableAfterburn():
return False
if not ship.approachFor(240):
return False
if not overview.lockTarget('guristas_personnel', 20):
return False
if not drones.launchSmall():
return False
if not ship.fireOnce():
return False
if not drones.engage():
return False
# mission item is in wreck
while not findAtMissionDetails('v'):
# collect
overview.pickWreck()
if not general.missionObjectiveComplete():
return False
# sometimes we already has millitans
# but the mission is not complete until all enemy dies
overview.seekAndDestory()
# just in case
overview.pickTarget('guristas_personnel')
if not drones.back():
return False
print '<-- mission Unauthorized Military Presence\n'
return True