本文整理汇总了Python中stage.Stage类的典型用法代码示例。如果您正苦于以下问题:Python Stage类的具体用法?Python Stage怎么用?Python Stage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:BackupTheBerlios,项目名称:larch-svn,代码行数:33,代码来源:ntfs.py
示例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()
开发者ID:kms70847,项目名称:Falling-Block-Game,代码行数:33,代码来源:highScoreScreen.py
示例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))
开发者ID:gvsurenderreddy,项目名称:zenos,代码行数:31,代码来源:installstart.py
示例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)
开发者ID:gvsurenderreddy,项目名称:zenos,代码行数:34,代码来源:grub.py
示例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)
开发者ID:godane,项目名称:archiso-live,代码行数:8,代码来源:installrun.py
示例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()
开发者ID:HieuLsw,项目名称:sbfury,代码行数:58,代码来源:game.py
示例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()
开发者ID:BackupTheBerlios,项目名称:larch-svn,代码行数:9,代码来源:finddevices.py
示例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)
开发者ID:kms70847,项目名称:Falling-Block-Game,代码行数:10,代码来源:titleScreen.py
示例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')
开发者ID:BackupTheBerlios,项目名称:larch-svn,代码行数:10,代码来源:welcome.py
示例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()
开发者ID:BackupTheBerlios,项目名称:larch,代码行数:52,代码来源:partitions.py
示例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()
开发者ID:pedrofraca,项目名称:tourapp,代码行数:33,代码来源:main.py
示例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))
开发者ID:pedrofraca,项目名称:tourapp,代码行数:7,代码来源:main.py
示例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"))
开发者ID:BackupTheBerlios,项目名称:larch,代码行数:47,代码来源:partmanu.py
示例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()
开发者ID:JosephMcc,项目名称:cinnamon-screensaver,代码行数:10,代码来源:manager.py
示例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()
开发者ID:atishay811,项目名称:pylaga,代码行数:11,代码来源:game.py
示例16: __init__
def __init__(self):
"""
"""
Stage.__init__(self, moduleDescription)
self.swaps = {}
inuse = install.getActiveSwaps()
self.done = []
if inuse:
self.addLabel(_("The following swap partitions are currently"
" in use and will not be formatted (they shouldn't"
" need it!)."))
for p, s in inuse:
b = self.addCheckButton("%12s - %s %4.1f GB" % (p, _("size"), s))
self.setCheck(b, True)
self.done.append(p)
self.swaps[p] = b
all = install.getAllSwaps()
fmt = []
for p, s in all:
if not (p in self.done):
fmt.append((p, s))
if fmt:
self.addLabel(_("The following swap partitions will be formatted"
" if you select them for inclusion."))
for p, s in fmt:
b = self.addCheckButton("%12s - %s %4.1f GB" % (p, _("size"), s))
self.setCheck(b, True)
self.swaps[p] = b
if all:
self.cformat = self.addCheckButton(_("Check for bad blocks "
"when formatting.\nClear this when running in VirtualBox "
"(it takes forever)."))
self.setCheck(self.cformat, True)
else:
self.addLabel(_("There are no swap partitions available. If the"
" installation computer does not have a large amount of"
" memory, you are strongly advised to create one before"
" continuing."))
开发者ID:BackupTheBerlios,项目名称:larch,代码行数:41,代码来源:swaps.py
示例17: __init__
def __init__(self):
Stage.__init__(self, moduleDescription)
self.device = None
self.mounts = install.getmounts()
# List of partitions already configured for use.
# Each entry has the form [mount-point, device, format,
# format-flags, mount-flags]
global used_partitions
used_partitions = []
parts = install.get_config("partitions", False)
if parts:
for p in parts.splitlines():
used_partitions.append(p.split(':'))
self.table = SelTable()
self.devselect = SelDevice([d[0] for d in install.listDevices()],
self.setDevice)
self.addWidget(self.devselect, False)
self.addWidget(self.table)
开发者ID:BackupTheBerlios,项目名称:larch,代码行数:21,代码来源:selpart.py
示例18: initialise
def initialise(self):
"""this function is called when the program starts.
it initializes everything it needs, then runs in
a loop until the function returns."""
#Initialize Everything
pygame.init()
self.screen = pygame.display.set_mode((640, 480))
pygame.display.set_caption('VacuumFire')
pygame.mouse.set_visible(0)
#icon
icon, foo = utils.load_image('icon.png')
pygame.display.set_icon(icon)
self.game_paused = False
#sounds
self.sounds = {};
self.sounds['music'] = utils.load_sound('archivo.ogg')
self.sounds['warning'] = utils.load_sound('warning.wav')
self.sounds['powerup'] = utils.load_sound('powerup.wav')
self.sounds['music'].play()
#Create The Backgound
self.background = Background(self.screen.get_size())
#game variables
self.score = 0
#Display The Background
self.screen.blit(self.background, (0, 0))
pygame.display.flip()
#The player's ship
self.ship = Ship()
#The player's ship
self.lifemeter = LifeMeter()
self.player = pygame.sprite.RenderPlain((self.ship))
#group that stores all enemies
self.enemies = pygame.sprite.Group()
#group that stores all powerups
self.powerups = pygame.sprite.Group()
#group that stores all the lasers the player shoots
self.fire = pygame.sprite.Group()
#group for information sprites in the screen, should be rendered the last one
self.hud = pygame.sprite.Group()
self.explosions = pygame.sprite.Group()
self.hud.add(self.lifemeter)
#The level
self.level = Stage('level_1')
self.font = utils.load_font('4114blasterc.ttf', 36)
self.clock = pygame.time.Clock()
self.game_started = False
self.game_finished = False
开发者ID:codelurker,项目名称:VacuumFire,代码行数:53,代码来源:main.py
示例19: __init__
def __init__(self, parent, state):
Stage.__init__(self, parent)
self.state = state
self.state = state
self.fps_counter = FpsCounter()
self.init_widgets()
self.init_bindings()
self.ghost_piece = None
#True when the user pauses the game
self.paused = False
#True when a coroutine is playing that should halt game logic, ex. when lines flash before disappearing
self.blocking = False
self.state.register_listener(self.model_alert)
self.state.start()
self.update_labels()
开发者ID:kms70847,项目名称:Falling-Block-Game,代码行数:22,代码来源:gameDisplay.py
示例20: spawn_stage
def spawn_stage(self, away_message, effect_time=c.STAGE_SPAWN_TRANSITION, callback=None):
"""
Create the Stage and begin fading it in. This may run quickly, in the case of
user-initiated activation, or slowly, when the session has gone idle.
"""
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()
开发者ID:,项目名称:,代码行数:14,代码来源:
注:本文中的stage.Stage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论