Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Portlets (and other widgets) inside of dialog boxes

12 views
Skip to first unread message

mateolan

unread,
May 1, 2013, 1:50:13 PM5/1/13
to toscawidge...@googlegroups.com
Hi Widgetistas.
I have what is probably a simple issue. Following the examples on the TW2 site, the code referenced in the gist below gets me multiple widgets and columns across the screen. I'd like to get it inside of a dialog widget. I tried subclassing it inside of a dialog widget--which you will say "of course that didn't work" but I don't understand the internals well enough. I was hoping the the subclassing infrastructure true for the column and portlet widgets also was true for the dialog widget (since I like the freedom of movement of the dialog widgets). Of course I was wrong, which is why I am writing to this list. I'd like to be able to add these things into a dialog widget, but I am not sure how. I even tried using a return self, on the outside class (in this case, what I refer to as control  ControlWidget)--and then calling that class from the value of the dialog widget Any help appreciated.
Best,  
~mc

Paul Johnston

unread,
May 2, 2013, 4:59:56 AM5/2/13
to toscawidge...@googlegroups.com
Hi,

What widget library are you using? ControlWidget isn't one I'm familiar with - it's not one of the core widgets.

At a guess, you need to set the "child" on DialogWidget to be your ColumnLayout. But if you let me know where I can download that widget library, I can give more detailed advice.

Paul



--
You received this message because you are subscribed to the Google Groups "ToscaWidgets-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to toscawidgets-dis...@googlegroups.com.
To post to this group, send email to toscawidge...@googlegroups.com.
Visit this group at http://groups.google.com/group/toscawidgets-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

matthew lange

unread,
May 2, 2013, 5:57:32 AM5/2/13
to toscawidge...@googlegroups.com
ControlWidgets(ColumnLayout) is just the name I was using to subclass
ColumnLayout...just like I used col2 as the class name to subclass
Column in e.g. Class col2(Column)
I didn't see the "child" property in the TW2 Dialog Widget
Documentation on the demo site--should I be looking somewhere else?

Paul Johnston

unread,
May 2, 2013, 6:47:18 AM5/2/13
to toscawidge...@googlegroups.com
Hi,

Oh I see, you're using tw2.jqplugins. The widget browser (http://tw2-demos.threebean.org/) is the best place for docs.

The current version of DialogWidget does not support "child" - although I think it should, and this is a change we should think about making.

You may be able to workaround by setting the "value" manually, something like:

DialogWidget(value=ControlWidgets.display())

Paul


matthew lange

unread,
May 2, 2013, 1:48:45 PM5/2/13
to toscawidge...@googlegroups.com
I have been trying a variety of tricks like this. Your suggestion
throws an error:
https://gist.github.com/mateolan/5503975

Paul Johnston

unread,
May 2, 2013, 4:25:57 PM5/2/13
to toscawidge...@googlegroups.com
Hi,

Try putting this in ControlDialog:

    def prepare(self):
        super(ControlDialog, self).prepare()
        self.value = ControlWidgets.display()

Are you using TW2 with another framework - Pyramid/TurboGears/etc?

Paul



matthew lange

unread,
May 2, 2013, 5:04:21 PM5/2/13
to toscawidge...@googlegroups.com
I am using it inside of pyramid...will be trying to get the widgets to
talk to db next.

matthew lange

unread,
May 2, 2013, 11:13:33 PM5/2/13
to toscawidge...@googlegroups.com
thanks so much Paul. This worked well...a word of warning to anyone
reading this thread that it was important to remove the original call
to the ControlWidgets class from the views.py and chameleon template,
or it did very, verrry strange things...including dragging and
dropping between dialog box and main page--which could probably be
leveraged in new and interesting ways, but I am not sure yet how.
I am very happy, except that I would like to hack the dialog widget to
add cookies that will save location and state of dialog box on
exit...can you provide any hints? I really don't have a clue about
where to look.
Best,
~mc

Paul Johnston

unread,
May 3, 2013, 6:54:44 AM5/3/13
to toscawidge...@googlegroups.com
Hi Matthew,

Glad you got it working. For getting widgets to talk to the db, you can do things the Pyramid way, load the db objects in you controller and pass to the widgets. Or you can do it it tw2 way, using tw2.sqla. In this case you use widgets like DbFormPage, which contain their own controller, which loads the objects from the db.

For saving the dialog box position, I suggest you do this in JavaScript. You need an onload event that looks at the cookie and positions the dialog box. And you need an onbeforeunload event that saves the dialog box position to the cookie. I imagine you'll find an example of this online if you look around.

Paul


Reply all
Reply to author
Forward
0 new messages