本文整理汇总了Python中stage.Stage类的典型用法代码示例。如果您正苦于以下问题:Python Stage类的具体用法?Python Stage怎么用?Python Stage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
"""
"""
Stage.__init__(self, moduleDescription)
# Info: NTFS partitions, current partition, total drive size
self.info = self.addWidget(PartitionWidget())
# NTFS resizing
self.ntfs = self.addWidget(NtfsWidget(self.size_changed_cb))
# Info: space after last NTFS partition
self.rest = self.addWidget(ShowInfoWidget(
_("(Potential) free space at end of drive: ")))
# Get a list of NTFS partitions (all disks) and then the
# corresponding info about the disks and partitions
self.partlist = self.getNTFSparts()
# Each disk (with NTFS partitions) gets an entry in self.diskinfo.
# Each entry is a list-pair: [disk info, list of partitions' info]
# The second item, the partition-info list can be changed if a
# partition is shrunk or removed.
self.diskinfo = {}
for p in self.partlist:
d = p.rstrip("0123456789")
if not self.diskinfo.has_key(d):
self.diskinfo[d] = [install.getDeviceInfo(d), None]
self.diskChanged(d)
# List of already 'handled' partitions
self.donelist = []
self.reinit()
示例2: __init__
def __init__(self, parent, score_to_add = None):
Stage.__init__(self, parent)
self.score_to_add = score_to_add
self.high_scores = load_high_scores()
self.new_idx = None
if self.score_to_add != None:
s = Score("???", self.score_to_add)
self.new_idx = self.high_scores.potential_position(s)
if self.new_idx != None:
self.high_scores.add(s)
score_frame = Frame(self)
score_frame.pack()
for i in range(self.high_scores.max_size):
score = self.high_scores.get(i)
if score != None:
score = self.high_scores.scores[i]
name = score.name
points = str(score.points)
else:
name = "---"
points = "---"
if i == self.new_idx:
self.new_entry = Entry(score_frame)
self.new_entry.grid(row=i, column=0)
else:
Label(score_frame, text=name).grid(row=i,column=0)
Label(score_frame, text=points).grid(row=i,column=1)
b = Button(self, text="return to main", command=self.button_clicked)
b.pack()
示例3: __init__
def __init__(self):
Stage.__init__(self, moduleDescription)
self.addLabel(_("Please check that the formatting of the"
" following partitions and their use within the new"
" installation (mount-points) corresponds with what you"
" had in mind. Accidents could well result in serious"
" data loss."))
# List of partitions configured for use.
# Each entry has the form [mount-point, device, format,
# format-flags, mount-flags]
parts = install.get_config("partitions", False)
plist = []
if parts:
for p in parts.splitlines():
pl = p.split(':')
plist.append(pl + [self.getsize(pl[1])])
# In case of mounts within mounts
plist.sort()
# Swaps ([device, format, include])
swaps = install.get_config("swaps", False)
if swaps:
for s in swaps.splitlines():
p, f, i = s.split(':')
if i:
plist.append(["swap", p, f, "", "", self.getsize(p)])
self.addWidget(PartTable(plist))
示例4: __init__
def __init__(self):
Stage.__init__(self, moduleDescription)
# Set up grub's device map and a list of existing menu.lst files.
assert install.set_devicemap(), "Couldn't get device map for GRUB"
self.addOption('mbr', _("Install GRUB to MBR - make it the main"
" bootloader"), True, callback=self.mbrtoggled)
self.mbrinstall = Mbrinstall(self)
self.addWidget(self.mbrinstall, False)
# What if there is >1 drive?
if install.menulst:
self.addOption('old', _("Add new installation to existing GRUB"
" menu."), callback=self.oldtoggled)
self.oldgrub = Oldgrub(self)
self.addWidget(self.oldgrub, False)
self.addOption('part', _("Install GRUB to installation partition."))
self.ntfsboot = None
# Seek likely candidate for Windows boot partition
dinfo = install.fdiskall()
nlist = install.listNTFSpartitions()
for np in nlist:
# First look for (first) partition marked with boot flag
if re.search(r"^%s +\*" % np, dinfo, re.M):
self.ntfsboot = np
break
if (not self.ntfsboot) and nlist:
# Else just guess first NTFS partition
self.ntfsboot = nlist[0]
self.request_soon(self.init)
示例5: __init__
def __init__(self):
Stage.__init__(self, moduleDescription)
self.output = self.addWidget(Report())
self.progress = self.addWidget(Progress(), False)
self.request_soon(self.run)
示例6: __init__
class Game:
def __init__(self, world, datadir, configdir):
self.world = world
self.datadir = datadir
self.configdir = configdir
self.enemies = []
self.stage = Stage(self)
self.sprites = Group(self.stage)
self.screen = world.screen
# Visor de energia para el enemigo
self._create_player()
self.energy = Energy(10, 10, 100, 10)
self.energy.set_model(self.player.id)
self.stage.player = self.player
self.stage.load_level(1)
if VISIBLE_DEBUG:
# Visor de rendimiento
self.text = Text(world.font, world.fps, "FPS: %d")
def _create_player(self):
control = Control(0, self.configdir)
self.player = Player(self, control, self.sprites, self.datadir)
shadow_player = Shadow(self.player, self.datadir)
self.sprites.add([self.player, shadow_player])
def update(self):
self.stage.update()
self.sprites.update()
self.energy.update()
if VISIBLE_DEBUG:
self.text.update()
if DEBUG:
b1, b2, b3 = pygame.mouse.get_pressed()
if b1:
self.stage.do_camera_effect()
elif b2:
self.stage.do_camera_effect(10)
elif b3:
self.world.fps.slow()
def draw(self):
self.stage.draw(self.screen)
self.sprites.draw(self.screen)
self.screen.blit(self.energy.image, self.energy.rect)
if VISIBLE_DEBUG:
self.screen.blit(self.text.image, self.text.rect)
pygame.display.flip()
示例7: __init__
def __init__(self):
Stage.__init__(self, moduleDescription)
self.addLabel(_('Disk(-like) devices will be detected and offered'
' for automatic partitioning.\n\n'
'If a device has mounted partitions it will not be offered'
' for automatic partitioning. If you want to partition'
' such a device, you must select the "Manual Partitioning"'
' stage.'))
self.getDevices()
示例8: __init__
def __init__(self, parent, *args, **kargs):
Stage.__init__(self, parent, *args, **kargs)
Label(self, text="FALLING BLOCK GAME", font=("Helvetica", 30)).pack()
self.selections = SelectionGroup(self, "Start", "High Scores", "Exit")
self.selections.pack()
self.bind_parent("<Up>" , lambda event: self.selections.previous_selection())
self.bind_parent("<Down>", lambda event: self.selections.next_selection())
self.bind_parent("<Return>", self.selection_chosen)
示例9: __init__
def __init__(self):
Stage.__init__(self, moduleDescription)
self.addLabel(_('This will install Arch Linux'
' from this "live" system on your computer.'
' This program was written'
' for the <i>larch</i> project:\n'
' http://larch.berlios.de\n'
'\nIt is free software,'
' released under the GNU General Public License.\n\n') +
'Copyright (c) 2008 Michael Towers')
示例10: __init__
def __init__(self):
Stage.__init__(self, moduleDescription)
# Info on drive
self.device = install.get_config('autodevice', trap=False)
if not self.device:
self.device = install.listDevices()[0][0]
self.dinfo = install.getDeviceInfo(self.device)
# Info: total drive size
totalsize = self.addWidget(ShowInfoWidget(
_("Total capacity of drive %s: ") % self.device))
totalsize.set(self.dinfo[0])
# Get partition info (consider only space after NTFS partitions)
parts = install.getParts(self.device)
self.startpart = 1
self.startsector = 0
for p in parts:
if (p[1] == 'ntfs'):
self.startpart = p[0] + 1
self.startsector = p[4] + 1
avsec = (self.dinfo[1] * self.dinfo[2] - self.startsector)
self.avG = avsec * self.dinfo[3] / 1.0e9
if (self.startpart > 1):
popupMessage(_("One or more NTFS (Windows) partitions were"
" found. These will be retained. The available space"
" is thus reduced to %3.1f GB.\n"
"Allocation will begin at partition %d.") %
(self.avG, self.startpart))
self.homesizeG = 0.0
self.swapsizeG = 0.0
self.root = None # To suppress writing before widget is created
self.swapfc = None # To suppress errors due to widget not yet ready
# swap size
self.swapWidget()
self.swapfc = self.addCheckButton(_("Check for bad blocks "
"when formatting swap partition.\nClear this when running "
"in VirtualBox (it takes forever)."))
self.setCheck(self.swapfc, True)
# home size
self.homeWidget()
# root size
self.root = self.addWidget(ShowInfoWidget(
_("Space for Linux system: ")))
self.adjustroot()
示例11: stage_detail_parse
def stage_detail_parse(stage_number,url):
data={}
urlfetch.set_default_fetch_deadline(45)
images_json=[]
data_order=["day","month","avg-speed","cat","start-finish"]
page = urllib2.urlopen(url)
soup = BeautifulSoup(page, "html.parser")
tabulka = soup.find("h3", {"class" : "section"})
div = tabulka.parent
images = soup.findAll('img')
for image in images:
if "Stage" in image["src"]:
images_json.append(image["src"])
if "Final_GC" in image["src"]:
images_json.append(image["src"])
if "site-icons" in image["src"]:
data['stage-icon']=image["src"]
cont=0
data['stage-images']=images_json
for element in tabulka.parent:
if(cont<len(data_order)):
if element.name is None and "\n" not in element.string and element.string !=" " and "Tag for network 919" not in element.string:
#The interesting information doesn't have a tag
data[data_order[cont]]=element.string
cont+=1
print stage_number
stage=Stage.get_by_id(int(stage_number))
stage_data=json.loads(stage.data)
stage_data.update(data)
stage.data=json.dumps(stage_data)
stage.put()
示例12: get
def get(self):
q = Stage.query()
stages=[]
for stage in q:
stages.append(json.loads(stage.data))
self.response.headers['Content-Type'] = 'application/json'
self.response.out.write(json.dumps(stages))
示例13: __init__
def __init__(self):
Stage.__init__(self, moduleDescription)
ld = install.listDevices()
# Offer gparted - if available
if (install.gparted_available() == ""):
gparted = self.addOption('gparted',
_("Use gparted (recommended)"), True)
else:
gparted = None
# Offer cfdisk on each available disk device
mounts = install.getmounts().splitlines()
mounteds = 0
i = 0
if ld:
for d, s, n in ld:
i += 1
# Determine devices which have mounted partitions
dstring = "%16s (%10s : %s)" % (d, s, n)
style = None
for m in mounts:
if m.startswith(d):
style = 'red'
mounteds += 1
break
self.addOption('cfdisk-%s' % d,
_("Use cfdisk on %s (%s)") % (d, s),
(i == 1) and not gparted,
style=style)
else:
popupError(_("No disk(-like) devices were found,"
" so Arch Linux can not be installed on this machine"))
mainWindow.exit()
if mounteds:
self.addLabel(_('WARNING: Editing partitions on a device with'
' mounted partitions (those marked in red) is likely'
' to cause a lot of trouble!\n'
'If possible, unmount them and then restart this'
' program.'), style='red')
# Offer 'use existing partitions/finished'
self.done = self.addOption('done',
_("Use existing partitions / finished editing partitions"))
示例14: spawn_stage
def spawn_stage(self, away_message, effect_time=c.STAGE_SPAWN_TRANSITION, callback=None):
try:
self.stage = Stage(self.screen, self, away_message)
self.stage.transition_in(effect_time, callback)
except Exception:
print("Could not spawn screensaver stage:\n")
traceback.print_exc()
self.grab_helper.release()
status.Active = False
self.cancel_timers()
示例15: __init__
def __init__(self,parent):
self.parent=parent
globalvars.asdf = 0
self.lagcount=0
self.leftkeydown=0
self.rightkeydown=0
self.enemylist=[]
self.list_enemys=EnemyManager()
self.stage=Stage(self.list_enemys,globalvars.player_list)
self.list_allie_shots=pygame.sprite.RenderUpdates()
self.enemy_shots=pygame.sprite.RenderUpdates()