Example #1
0
    def display_ui(ui, parent, style):
        """Display the UI."""

        ui.owner.init(ui, parent, style)
        ui.control = ui.owner.control
        ui.control._parent = parent

        try:
            ui.prepare_ui()
        except:
            ui.control.setParent(None)
            ui.control.ui = None
            ui.control = None
            ui.owner = None
            ui.result = False
            raise

        ui.handler.position(ui.info)
#        restore_window(ui)

        RootPanel().add(ui.control)
        pyjd.run()

        if style == BaseDialog.NONMODAL:
            ui.control.show()
        else:
#            ui.control.setWindowModality(QtCore.Qt.WindowModal)
            ui.control.exec_()

        RootPanel().add(ui.control)
        pyjd.run()
Example #2
0
def main(test_gen_out):

    pyjd.setup("public/uitest.html")
    t = RunTests(test_gen_out)
    t.add(LabelTest)
    t.add(EventTest)
    t.add(DOMTest)
    pyjd.run()
Example #3
0
        msg = name + ' ' + action + ' (' + str(x) + ', ' + str(y) + ')'
        self.msgarea1.setText(msg)
        log.debug(msg)

    def onMouseMove(self, sender, x, y):
        self._mouseActionMessage(sender.areaname, "move", x, y)
        
    def onMouseDown(self, sender, x, y):
        self._mouseActionMessage(sender.areaname, "down", x, y)

    def onMouseUp(self, sender, x, y):
        self._mouseActionMessage(sender.areaname, "up", x, y)

    def onMouseEnter(self, sender):
        self._mouseActionMessage(sender.areaname, "enter")

    def onMouseLeave(self, sender):
        self._mouseActionMessage(sender.areaname, "leave")

    def onClick(self, sender):
        msg = "you clicked on baby katie's " + sender.areaname
        self.msgarea2.setText(msg)
        log.debug(msg)
    

if __name__ == '__main__':
    pyjd.setup("http://127.0.0.1/examples/maparea/public/MapAreaDemo.html")
    app = MapAreaDemo()
    app.onModuleLoad()
    pyjd.run()
Example #4
0
import pyjd # dummy in pyjs

from pyjamas.ui.RootPanel import RootPanel
from DayFilterWidget import DayFilterWidget
from SchoolCalendarWidget import SchoolCalendarWidget

class DynaTable:

    def onModuleLoad(self):
        slot = RootPanel("calendar")
        if slot is not None:
            calendar = SchoolCalendarWidget(15)
            slot.add(calendar)
            
            slot = RootPanel("days")
            if slot is not None:
                filterWidget = DayFilterWidget(calendar)
                slot.add(filterWidget)


if __name__ == '__main__':
    pyjd.setup("http://127.0.0.1/examples/dynamictable/public/DynaTable.html") # dummy in pyjs
    app = DynaTable()
    app.onModuleLoad()
    pyjd.run() # dummy in pyjd
Example #5
0
File: cssauto.py Project: Afey/pyjs
    def onModuleLoad(self):

        text = TextBox()
        df1 = DateField()
        df2 = DateField(format='%Y/%m/%d')
        b = Button("Show Calendar", self)
        self.cal = Calendar()
        df3 = MonthField()

        vp = VerticalPanel()
        vp.setSpacing(10)
        vp.add(df1)
        vp.add(b)
        vp.add(df2)
        vp.add(df3)

        RootPanel().add(vp)

    def onClick(self, sender):
        p = CalendarPopup(self.cal)
        x = sender.getAbsoluteLeft() + 10
        y = sender.getAbsoluteTop() + 10
        p.setPopupPosition(x,y)
        p.show()

if __name__ == '__main__':
    pyjd.setup("./public/cssauto.html") # dummy in pyjs
    app = App()
    app.onModuleLoad()
    pyjd.run() # dummy in pyjs
Example #6
0
    and the margin to 100px.  Even though it is the "body" - root
    element, clicking outside the margin (indicated by the black border)
    will NOT activate key input.
    <br /><br />
    Note that many browsers screw up the sizes of the window when the
    margin is set as well as width or height to 100%, as evidenced by
    the black border being off the screen.  (Normally, you would add a
    WindowResize Listener which received the window size and then
    directly adjusted the CSS width and height of the body element
    to correct these problems (!) or, much better, add a SimplePanel
    on which the appropriate (100% width+height) CSS styles are set).
    <br /> <br />
    However that's not the issue: the point is that you <b>must</b>
    actually set the body to be 100% of the screen area in order to
    receive click events, and the above highlights why it is important
    to set margin and padding of body to 0 as well, and also to not
    set any borders.
    <br /> <br />
    Click the button to change the margin on the document "body" tag
    to zero, in order to test this out.  Note that the border may still
    be off the screen, even when the margin is zero.
    <br /> <br />
    """

    RootPanel().add(panel)
    RootPanel().add(b)
    RootPanel().add(bh)
    RootPanel().add(HTML(info))

    pyjd.run()
Example #7
0
class App:
    def onModuleLoad(self):

        text = TextBox()
        df1 = DateField()
        df2 = DateField(format='%Y/%m/%d')
        b = Button("Show Calendar", self)
        self.cal = Calendar(MinDate=(2012, 5, 10), MaxDate=(2014, 6, 8))

        vp = VerticalPanel()
        vp.setSpacing(10)
        vp.add(df1)
        vp.add(b)
        vp.add(df2)

        RootPanel().add(vp)

    def onClick(self, sender):
        p = CalendarPopup(self.cal)
        x = sender.getAbsoluteLeft() + 10
        y = sender.getAbsoluteTop() + 10
        p.setPopupPosition(x, y)
        p.show()


if __name__ == '__main__':
    pyjd.setup("./public/DateField.html")  # dummy in pyjs
    app = App()
    app.onModuleLoad()
    pyjd.run()  # dummy in pyjs
Example #8
0
import pyjd  # dummy in pyjs

from pyjamas.ui.RootPanel import RootPanel
from DayFilterWidget import DayFilterWidget
from SchoolCalendarWidget import SchoolCalendarWidget


class DynaTable:
    def onModuleLoad(self):
        slot = RootPanel("calendar")
        if slot is not None:
            calendar = SchoolCalendarWidget(15)
            slot.add(calendar)

            slot = RootPanel("days")
            if slot is not None:
                filterWidget = DayFilterWidget(calendar)
                slot.add(filterWidget)


if __name__ == '__main__':
    pyjd.setup("http://127.0.0.1/examples/dynamictable/public/DynaTable.html"
               )  # dummy in pyjs
    app = DynaTable()
    app.onModuleLoad()
    pyjd.run()  # dummy in pyjd