Skip to content

Commit

Permalink
akcustom.py: testing step
Browse files Browse the repository at this point in the history
AK NOTE: discard this before final.
  • Loading branch information
Ales Kozumplik committed Apr 28, 2011
1 parent c32e998 commit 6b7b00b
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
85 changes: 85 additions & 0 deletions pyanaconda/akcustom.py
@@ -0,0 +1,85 @@
import logging
import pyanaconda.view
import time

import iutil

log = logging.getLogger("anaconda")

def akcustomstep(anaconda):
log.critical("akcustomstep starting.")
test_gtk_sync(anaconda)

def test_busy():
status = pyanaconda.view.Status()
status.i_am_busy("my head is", "full of fuck")
time.sleep(1.5)
status.no_longer_busy()

def test_progress():
status = pyanaconda.view.Status()
h = status.progress_window("Top", "Text.", 10)
for i in range(1, 20):
status.progress_pulse(h)
time.sleep(float(1)/i)
status.destroy_window(h)

h = status.progress_window("Exec", "Text.", 10)
iutil.execWithPulseProgress('/tmp/updates/ak.py', [], progress = h)
status.destroy_window(h)

h = status.progress_window("Exec", "Text.", 10)
iutil.execWithCallback('/tmp/updates/ak.py', [], callback = update_progress,
callback_data = h)
status.destroy_window(h)

def test_passphrase():
status = pyanaconda.view.Status()
rc = status.need_passphrase_sync("/dev/sda2")
log.critical("got passphrase: %s" % str(rc))

def test_initialize_disk():
status = pyanaconda.view.Status()
ret = status.need_initialize_disk_answer_sync(path="/dev/sda",
description="DISK OIN OIN OIN",
size=1024*1024)
log.critical("akcustom: answer was: %s" % ret)

def test_kickstart_error():
status = pyanaconda.view.Status()
ret = status.announce_kickstart_error_sync("dooh.. WINNING")
log.critical("akcustom: answer was: %s" % ret)

def test_answer_long():
status = pyanaconda.view.Status()
ret = status.need_answer_long_sync("dooh", "text", "long text")
log.critical("akcustom: answer was: %s" % ret)

def test_luks_passphrase():
status = pyanaconda.view.Status()
ret = status.need_luks_passphrase_sync("passphrase", False)
log.critical("akcustom: answer was: %s" % str(ret))

def test_methodstr():
status = pyanaconda.view.Status()
exception = SystemError("easy easy")
ret = status.need_methodstr_sync("cdrom:", exception)
log.critical("akcustom: answer was: %s" % str(ret))

def test_gtk_sync(anaconda):
import pyanaconda.gui
ret = pyanaconda.gui.idle_gtk_sync(anaconda.intf.messageWindow, "title",
"text", type = "custom",
custom_buttons = ["oh", "yeah"])
log.critical("akcustom: answer was: %s" % str(ret))

amount = 0
def update_progress(data, callback_data):
global amount

if not data:
return
progress_handler = callback_data
if data == '\n':
amount += 1
progress_handler.status.update_progress(progress_handler, amount)
3 changes: 3 additions & 0 deletions pyanaconda/dispatch.py
Expand Up @@ -48,6 +48,8 @@

from packages import doReIPL

from akcustom import akcustomstep

import logging
log = logging.getLogger("anaconda")

Expand All @@ -68,6 +70,7 @@
installSteps = [
("language", ),
("keyboard", ),
("akcustomstep", akcustomstep ),
("betanag", betaNagScreen, ),
("filtertype", ),
("filter", ),
Expand Down
1 change: 1 addition & 0 deletions pyanaconda/installclass.py
Expand Up @@ -88,6 +88,7 @@ def setSteps(self, anaconda):
"keyboard",
"filtertype",
"filter",
"akcustomstep",
"storageinit",
"findrootparts",
"betanag",
Expand Down

0 comments on commit 6b7b00b

Please sign in to comment.