FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Server Development

 
 
LinkBack Thread Tools
 
Old 10-28-2009, 02:23 AM
David Cantrell
 
Default Improve detailedMessageWindow() in text.py.

Previously, detailedMessageWindow() would just give you a messageWindow
and throw out the longText.

This patch tries to implement something that will let the longText
contain somewhat formatted text and allow users to scroll. That's done
with the ListboxChoiceWindow. Selecting any item in the list box is the
same as selecting button ID 0 on the dialog.
---
text.py | 46 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/text.py b/text.py
index 6ca7d82..cd3b978 100644
--- a/text.py
+++ b/text.py
@@ -301,8 +301,50 @@ class InstallInterface:
def detailedMessageWindow(self, title, text, longText=None, type="ok",
default=None, custom_icon=None,
custom_buttons=[]):
- return self.messageWindow(title, text, type, default, custom_icon,
- custom_buttons)
+ # list box text will be longText split on newlines
+ items = longText
+ if longText:
+ items = filter(lambda s: s, longText.split('
'))
+
+ if type == "ok":
+ ListboxChoiceWindow(self.screen, title, text, items,
+ buttons=[TEXT_OK_BUTTON], width=60,
+ scroll=1, default=default)
+ elif type == "yesno":
+ if default and default == "no":
+ btnlist = [TEXT_NO_BUTTON, TEXT_YES_BUTTON]
+ else:
+ btnlist = [TEXT_YES_BUTTON, TEXT_NO_BUTTON]
+
+ (button, entry) = ListboxChoiceWindow(self.screen, title, text,
+ items, buttons=btnlist,
+ width=60, scroll=1,
+ default=default)
+
+ if button == "yes":
+ return 1
+ else:
+ return 0
+ elif type == "custom":
+ tmpbut = []
+ idx = 0
+
+ for but in custom_buttons:
+ tmpbut.append(string.replace(but,"_",""))
+
+ (button, entry) = ListboxChoiceWindow(self.screen, title, text,
+ items, buttons=tmpbut,
+ scroll=1, default=default)
+
+ for b in tmpbut:
+ if string.lower(b) == button:
+ return idx
+ idx += 1
+
+ return 0
+ else:
+ return self.messageWindow(title, text, type, default, custom_icon,
+ custom_buttons)

def createRepoWindow(self):
self.messageWindow(_("Error"),
--
1.6.2.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-28-2009, 12:28 PM
Chris Lumens
 
Default Improve detailedMessageWindow() in text.py.

> Previously, detailedMessageWindow() would just give you a messageWindow
> and throw out the longText.
>
> This patch tries to implement something that will let the longText
> contain somewhat formatted text and allow users to scroll. That's done
> with the ListboxChoiceWindow. Selecting any item in the list box is the
> same as selecting button ID 0 on the dialog.

Note that this will then get used to display the anacdump.txt file.
Does snack support a ListboxChoiceWindow of several thousand lines? You
might want to toss a "raise SystemError" in text.py for the Next handler
and see what happens.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-28-2009, 07:36 PM
David Cantrell
 
Default Improve detailedMessageWindow() in text.py.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 28 Oct 2009, Chris Lumens wrote:


Previously, detailedMessageWindow() would just give you a messageWindow
and throw out the longText.

This patch tries to implement something that will let the longText
contain somewhat formatted text and allow users to scroll. That's done
with the ListboxChoiceWindow. Selecting any item in the list box is the
same as selecting button ID 0 on the dialog.


Note that this will then get used to display the anacdump.txt file.
Does snack support a ListboxChoiceWindow of several thousand lines? You
might want to toss a "raise SystemError" in text.py for the Next handler
and see what happens.


Really? I didn't notice that. I thought python-meh was handling the
exception window stuff now.

- --
David Cantrell <dcantrell@redhat.com>

Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkroq2gACgkQ5hsjjIy1VklMIgCgwfwBKp0OwQ A6i8aR7a8E0ScA
4B8AnjOH6Xpysbq/goNqwvB69sAyqVYi
=ki9n
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-29-2009, 03:02 AM
David Cantrell
 
Default Improve detailedMessageWindow() in text.py.

Rather than use ListboxChoiceWindow(), do what ButtonChoiceWindow() does
in snack, but add an additional row with a scrolling list box for
longText.
---
text.py | 44 ++++++++++++++++++++++----------------------
1 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/text.py b/text.py
index cd3b978..848513e 100644
--- a/text.py
+++ b/text.py
@@ -301,43 +301,43 @@ class InstallInterface:
def detailedMessageWindow(self, title, text, longText=None, type="ok",
default=None, custom_icon=None,
custom_buttons=[]):
- # list box text will be longText split on newlines
- items = longText
- if longText:
- items = filter(lambda s: s, longText.split('
'))
+ t = TextboxReflowed(60, text, maxHeight=8)
+ lt = Textbox(60, 6, longText, scroll=1, wrap=1)
+ g = GridFormHelp(self.screen, title, help, 1, 3)
+ g.add(t, 0, 0)
+ g.add(lt, 0, 1, padding = (0, 1, 0, 1))

if type == "ok":
- ListboxChoiceWindow(self.screen, title, text, items,
- buttons=[TEXT_OK_BUTTON], width=60,
- scroll=1, default=default)
+ bb = ButtonBar(self.screen, [TEXT_OK_BUTTON])
+ g.add(bb, 0, 2, growx = 1)
+ return bb.buttonPressed(g.runOnce(None, None))
elif type == "yesno":
if default and default == "no":
- btnlist = [TEXT_NO_BUTTON, TEXT_YES_BUTTON]
+ buttons = [TEXT_NO_BUTTON, TEXT_YES_BUTTON]
else:
- btnlist = [TEXT_YES_BUTTON, TEXT_NO_BUTTON]
+ buttons = [TEXT_YES_BUTTON, TEXT_NO_BUTTON]

- (button, entry) = ListboxChoiceWindow(self.screen, title, text,
- items, buttons=btnlist,
- width=60, scroll=1,
- default=default)
+ bb = ButtonBar(self.screen, buttons)
+ g.add(bb, 0, 2, growx = 1)
+ rc = bb.buttonPressed(g.runOnce(None, None))

- if button == "yes":
+ if rc == "yes":
return 1
else:
return 0
elif type == "custom":
- tmpbut = []
+ buttons = []
idx = 0

- for but in custom_buttons:
- tmpbut.append(string.replace(but,"_",""))
+ for button in custom_buttons:
+ buttons.append(string.replace(button, "_", ""))

- (button, entry) = ListboxChoiceWindow(self.screen, title, text,
- items, buttons=tmpbut,
- scroll=1, default=default)
+ bb = ButtonBar(self.screen, buttons)
+ g.add(bb, 0, 2, growx = 1)
+ rc = bb.buttonPressed(g.runOnce(None, None))

- for b in tmpbut:
- if string.lower(b) == button:
+ for b in buttons:
+ if string.lower(b) == rc:
return idx
idx += 1

--
1.6.2.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-29-2009, 12:13 PM
Chris Lumens
 
Default Improve detailedMessageWindow() in text.py.

> >Note that this will then get used to display the anacdump.txt file.
> >Does snack support a ListboxChoiceWindow of several thousand lines? You
> >might want to toss a "raise SystemError" in text.py for the Next handler
> >and see what happens.
>
> Really? I didn't notice that. I thought python-meh was handling the
> exception window stuff now.

You're right. I guess python-meh is just so low maintainence that I've
completely forgotten about it already.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-29-2009, 04:11 PM
Chris Lumens
 
Default Improve detailedMessageWindow() in text.py.

> Rather than use ListboxChoiceWindow(), do what ButtonChoiceWindow() does
> in snack, but add an additional row with a scrolling list box for
> longText.

If you've tested it, it's fine with me.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 01:51 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org