本文整理汇总了Python中stage.Stage.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Stage.__init__方法的具体用法?Python Stage.__init__怎么用?Python Stage.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stage.Stage
的用法示例。
在下文中一共展示了Stage.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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)
示例2: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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()
示例4: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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))
示例5: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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()
示例7: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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)
示例8: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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')
示例9: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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()
示例10: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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"))
示例11: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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."))
示例12: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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)
示例13: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
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()
示例14: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
def __init__(self):
Stage.__init__(self, moduleDescription)
self.pwe = self.addWidget(PWEnter())
self.reinit()
示例15: __init__
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import __init__ [as 别名]
def __init__(self):
Stage.__init__(self, moduleDescription)
self.addLabel(
_("If all went well, your installation should now" " be bootable. Click on OK to quit the installer.")
)